In my latest work on Ore War I’ve added a number of new features including random generation of destructible solar systems, simple orbital mechanics, and a custom paged memory pool. Check out the included video for a demonstration:

While these developments are certainly neat to look at, my upcoming work will focus on some less visible changes. I’ve decided that adding multi-player support should be my next goal, as significant changes to the architecture will only become more difficult as development progresses.

First, It will be necessary to ensure that updates to the game model are performed in discrete steps so that state can be more easily synchronized between client and server. To accomplish this I’ll be using a multi-threaded approach where the game model continually updates in a separate thread from all rendering operations using a fixed delta time step as Glenn Fiedler describes here (the whole series on physics is well worth reading). To avoid synchronization issues between the game model and rendering threads, the rendering thread will store a duplicated game model which reads serialized delta updates through a synchronized message queue before rendering each frame. The game model will use a similar approach to integrate deltas coming from the multi-player server.

Second, I’ll need to design and implement a network protocol to use between client and server. Since this is a fast paced shooter where delays will be very noticeable, I’ll be using a binary UDP protocol to exchange game state and user input. For this I’ll be drawing most of my inspiration from the Source engine’s net-code implementation, which I feel provides one of the better client side experiences. In this system clients only send user input data to the central server, and all authoritative simulation is performed on the server side. After each discrete physics update, the server generates serialized delta packets for each client based on the last state acknowledged by the specific client. This means that the server must buffer all unacknowledged game states so that deltas can be generated. However, these buffered states also allow for lag compensation as the server is capable of viewing the “past” game state to validate hit detection.

These changes will mark some of the first significant technical challenges to overcome in the Ore War project, and hopefully will provide me with some interesting material to write about in the upcoming weeks.

© 2011 The Craig Repository Suffusion theme by Sayontan Sinha