Saturday, March 13, 2010

Connecting disparate programming models

I'm still trying to keep my graphical text rendering separate from the actual Larn game code.  Unfortuantely, that means that there are two active game loops.  I've managed to get around that by threading and sharing the TextConsole object (a char array with terminal functions (add text, move text, etc.  Basically a VT100/Ansi equivalent)).  The DX9 engine creates the Larn game on a separate thread and waits until it creates a TextConsole, which it then grabs a reference to use for pulling data for rendering.

The biggest issue that I'm having is that I'm very nervous about race conditions with the Cursor object.  I currently pass around an object reference, but I think I'm going to need to stop doing that and only pass around the Vector2 position.  It's currently possible that an update from the rendering engine will cause the cursor to start being displayed.  If the Larn engine then attempts to move the cursor, the two could stomp over each other.  I haven't seen it happen yet, but it could.  

No comments:

Post a Comment