Long time since I have done an update and most of this is due to work overload at EverFire Studios as I work dilligently to produce code for our up and coming Bring Out Your Dead: Black Plague TCG. This brings me to my first topic: High Precision Network Timers.
To be honest, this is a field I am not entirely experienced in and had a trouble finding a place to start. The reason that we needed this in the game was to provide the clients accurate timestamps for their turns. The first part was simple - use a standardized time system and send that time to the client. But this brings one consideration to mind - latency. If any of you have ever played any game ever, you know what lag is, more so if the game was an online based such as Battlefield 4, League of Legends, or any MMO.
How did I go about this then? Well, I wasn't sure at first but that is why research exists.
After a few days of research I decided to create a model similar to the ideas of NTP stratum servers. Sounds quite wonky at first - which confused my lead as well. But I was not actually using NTP server, daemons, or anything of that nature. What I pulled from this was the implementation of a modified Marzullo algorithm. This algorithm calculates a best effort confidence level. And, instead of the client receiving multiple time stamps, calculating the values with least difference, and then apply that time, mine is reverse and singular.
What do I mean by this? My latency calculator goes as follows:
Game server thread sends message to event listeners that there is a time update.
The engine calculates the remaining time in a turn.
The server, on this event, sends the remaining time less the latency to the client.
The client receives this message and responds with a packet that sends the server response time as well as it's request time.
I have to take into consideration the time delay used for firing off the time update message.
After collecting X amount of samples the server calculates the new latency using values selected from the calculation of time intervals of client-server requests and client-server responses.
This is then the new latency.
Using this method, I reduce server CPU time by not calculating lag every pass, but maintain a tight interval of the lag. I also ensure that when the time packet the server sends, the client will have synced time with lag put into consideration.
Now to switch gears entirely, so don't think about time now. It is rendering time in regards to my engine. For my simple engine I, as a separate project, I am implementing a heightmap on terrain and mapped texturing. All very well basic methods (I am not a fancy voxel person just yet) to accomplish simple ends.
That blurb was more of an update than anything to prove I am still working on my game engine - albeit slowly now.As you can see from the beginning though, it is on its way to being something tangible!
DX10 Heightmap/Blendmap Terrain |
So there you have it!
No comments:
Post a Comment