Yesterday I managed to finish hooking up enough of the networking that the game can start while running as an activity and the status updates flow properly from the server to the clients. We did the "lobby" code all using the olpcgames wrapper's built-in functionality, with the actual game code using an ExportedGObject for efficiency (to allow us to use the dbus encoding/decoding mechanisms in C).
Ryan and Andrew's "screen" system is working quite nicely to break up the logic and make coding easier. I've had to move some of the networking logic out into the "game" level so that the events can be caught whenever they happen.
Performance at the moment is totally unacceptable (the host machine can't even keep up with the state updates, so it gets progressively slower and eventually dies (silently)). In a low-level system you'd deal with that by discarding older status updates before you decode them. I can discard them, but only after they've been fully decoded.
Need to look at optimising the simulation as well. There's lots of opportunities there (the biggest one being that resources (the heaviest part of the simulation) don't need to be simulating at the same rate as unit movements and the like, that makes the logic a bit hairy, but it should save an enormous amount of processing power).
There are also a few points where I'm violating the thread barrier. That needs to be fixed, obviously. Anyway, guess I'll dive back into it.
Pingbacks are closed.