Networking and better particles

17 Aug 2009

Network code is working reasonably well now. The server generates a unique MD5 hash (only six characters) for an entity, then broadcasts a packet to the clients instructing them to spawn an entity of the correct type, and assign the same hash as its ID. From then on, the server turns over the reigns to the entity's controller, which can send any information it wants in its own sandboxed data packet.

The server once again takes control when the entity is deleted. It took me a while to get the (surprisingly complex) delete sequence right, since the entity must be deleted a specific point in the frame update. To make matters worse, the server actually connects to itself as a client (purely inside the game's code). It seemed like a good idea at the time, but I'm definitely having my doubts now. Hopefully now that the framework is mostly done, the actual implementation will go smoother.

In the meantime, I also added some more eye candy. Behold, better particle effects!