Putrid Panda
Game Development Team
Sunday, 8 May 2011
Blog Closure
I have decided to stop posting here, I recently rewrote the entire engine using OpenGL 4.1. So far it has turned out to be a huge success. In fact it is starting to resemble a commercial engine and a game is in the planning stages. I dont want to reveal any more secrets that could end up in a commercial product therefore I am switching to a private forum for now. When a public site is available I will link it here.
Monday, 21 March 2011
The New Zone Server + Tips for Multithreaded Server Design Using Newton
I just finished programming the hardest thing I ever programmed in my life. The goal of my recent research was how to implement a scalable mmorpg server that could support hundreds of players at one time. I immediately agreed that this kind of server would have to be multi threaded, little did I know that the whole thing would end up running on over 15 threads. The majority of the work is done with Newton and Raknet as they ended up taking 13 of those threads. Now RakNet was never a problem, it is a wonderful library that hasnt ever crashed for me for whatever reason. The problem was Newton Dynamics, not in the library itself (Its a great library) but the fact that it was pretty hard to avoid racing conditions and heap corruptions due to the fact that I was running Newton on its own thread plus spawning 8 internal Newton threads.
After a pretty long time debugging and tuning the code I managed to get it to run without any heap corruptions/racing conditions using batching. I had to split the character controllers with the player objects in order to do that. I was using some STL algorithms to push players who needed a controller made into a vector, then sending that vector as a part of a batch to the collision thread to process, while it was processing I had to Sleep(1) on main thread. The whole system ended up being very slow because of unnecessary re allocations of the vector.
Then as I was speaking to my friend on MSN I had a brilliant idea, why waste all this processing power on making these damn controllers when I could just make a static sized array of them right at the beginning? It was a brilliant idea because the actual controllers themselves didn't take up that much memory.
That worked brilliantly except for the fact that now Newton was iterating through a large amount of bodies and doing needless processing. Unfortunately there isn't a way to NOT add a body to the Newton world when making it, but there is a way to make it freeze and not be processed (Although still collidable with other controllers).
So I ended up assigning raw controller pointers to players who joined and incrementing the controller index
so the next player can get the next controller along. Also freezing and unfreezing controllers as players join/leave. (Controllers get made frozen by default).
The last problem was to prevent the collision between frozen controllers and unfrozen controllers. Well that simple, just change the material id's and material contact callbacks to appropriate bodies. just make sure the contact callback returns 0 and the second one simply returns doing nothing.
This whole architecture turned out to resemble a library, you can borrow a book (Character controller) from the bookshelf (Array of controllers) and return it it in the condition that you received it (Reset controller position to default and any states that it had prior to when you borrowed it).
Some of my server features now
Dynamic threading
Depending on the hardware it can support up to 1000 players per zone with unlimited zone capabilities
Lockless design
Scalable solver models and architectures thanks to newton
Great cohesion between controllers and players
Still stuff to be implemented:
Hash table/Voronoi diagram? for player proximity calculations
Load balancing
After a pretty long time debugging and tuning the code I managed to get it to run without any heap corruptions/racing conditions using batching. I had to split the character controllers with the player objects in order to do that. I was using some STL algorithms to push players who needed a controller made into a vector, then sending that vector as a part of a batch to the collision thread to process, while it was processing I had to Sleep(1) on main thread. The whole system ended up being very slow because of unnecessary re allocations of the vector.
Then as I was speaking to my friend on MSN I had a brilliant idea, why waste all this processing power on making these damn controllers when I could just make a static sized array of them right at the beginning? It was a brilliant idea because the actual controllers themselves didn't take up that much memory.
That worked brilliantly except for the fact that now Newton was iterating through a large amount of bodies and doing needless processing. Unfortunately there isn't a way to NOT add a body to the Newton world when making it, but there is a way to make it freeze and not be processed (Although still collidable with other controllers).
So I ended up assigning raw controller pointers to players who joined and incrementing the controller index
so the next player can get the next controller along. Also freezing and unfreezing controllers as players join/leave. (Controllers get made frozen by default).
The last problem was to prevent the collision between frozen controllers and unfrozen controllers. Well that simple, just change the material id's and material contact callbacks to appropriate bodies. just make sure the contact callback returns 0 and the second one simply returns doing nothing.
This whole architecture turned out to resemble a library, you can borrow a book (Character controller) from the bookshelf (Array of controllers) and return it it in the condition that you received it (Reset controller position to default and any states that it had prior to when you borrowed it).
Some of my server features now
Dynamic threading
Depending on the hardware it can support up to 1000 players per zone with unlimited zone capabilities
Lockless design
Scalable solver models and architectures thanks to newton
Great cohesion between controllers and players
Still stuff to be implemented:
Hash table/Voronoi diagram? for player proximity calculations
Load balancing
Saturday, 5 March 2011
Build 0.103
Fixed a shader bug which was caused by compiling the shader on an nvidia gpu (thanks to Kaba Zaoshi)
Speed and animations are more or less synced to alpha standards
Entire new mouse movement system which is much smoother and accurate and less jerky at those lower fps regions (thanks to Kaba Zaoshi for suggestion)
Speed and animations are more or less synced to alpha standards
Entire new mouse movement system which is much smoother and accurate and less jerky at those lower fps regions (thanks to Kaba Zaoshi for suggestion)
Friday, 25 February 2011
Build 0.102
Upgraded multithreading library
Upgraded to open source version of newton, great for debugging.
Upgraded the zone loading code and assimp library
Removed unncessary network guid system
Changed login screen video and sound
Updated RakNet networking library to newer version
Updated ini parser code
Improved jitter in movement by making better use of entity extrapolation, although its not 100% fixed
Separated sideways moving speed and forwads/backwards moving speed
Animation engine now supports motion capture data
Animation engine now supports smooth cycle blending
Animation engine now supports animations on top of animations (upper body playing different animation to lower body, this enables the character to run and swing sword at the same time for example)
A bunch of new animations added for test purposes
Upgraded to open source version of newton, great for debugging.
Upgraded the zone loading code and assimp library
Removed unncessary network guid system
Changed login screen video and sound
Updated RakNet networking library to newer version
Updated ini parser code
Improved jitter in movement by making better use of entity extrapolation, although its not 100% fixed
Separated sideways moving speed and forwads/backwards moving speed
Animation engine now supports motion capture data
Animation engine now supports smooth cycle blending
Animation engine now supports animations on top of animations (upper body playing different animation to lower body, this enables the character to run and swing sword at the same time for example)
A bunch of new animations added for test purposes
Tuesday, 15 February 2011
Build 0.1 - 10% performance increase
Build notes:
Upgraded CEGUI to a newer version
All GUI code is now polymorphic
Upgraded to a newer version of SFML2
Now you can see the shader compile log instantly if the shaders refuse to compile
Added a simple free fly camera for debug mode
Upgraded entire shader interface to support multiple shaders
Changed OpenGL to use a newer version (3.3) to allow several extensions for planned graphical features
Fixed a bunch of bad graphical errors, this means the minimum hardware requirements to play the game have gone up but there might be a lower quality shader version to allow older computers to run it
OpenGL now runs on a compatability profile instead of core in order to support fixed function commands
Debug console now displays missing textures as well as log them
Reduced a lot of memory usage by deleting unecesary buffers
Switched VBO rendering code to use one large interleaved VBO instead of many small VBO's resulting in a 10% FPS increase
Fixed a hole in skybox
Skybox resolution is now set at 2048x2048, In future I am thinking of adding a fully dynamic shader based sky without a skybox
Improved anti-alising support which now allows 8x anti-alising at a slightly improved speed
Upgraded CEGUI to a newer version
All GUI code is now polymorphic
Upgraded to a newer version of SFML2
Now you can see the shader compile log instantly if the shaders refuse to compile
Added a simple free fly camera for debug mode
Upgraded entire shader interface to support multiple shaders
Changed OpenGL to use a newer version (3.3) to allow several extensions for planned graphical features
Fixed a bunch of bad graphical errors, this means the minimum hardware requirements to play the game have gone up but there might be a lower quality shader version to allow older computers to run it
OpenGL now runs on a compatability profile instead of core in order to support fixed function commands
Debug console now displays missing textures as well as log them
Reduced a lot of memory usage by deleting unecesary buffers
Switched VBO rendering code to use one large interleaved VBO instead of many small VBO's resulting in a 10% FPS increase
Fixed a hole in skybox
Skybox resolution is now set at 2048x2048, In future I am thinking of adding a fully dynamic shader based sky without a skybox
Improved anti-alising support which now allows 8x anti-alising at a slightly improved speed
Sunday, 30 January 2011
Login server update
Login server is nearly complete.
Database support is added, using PostgreSQL - an amazing open source database solution.
Secure connections have been implemented to provide maximum security.
Time for client overhaul.
Database support is added, using PostgreSQL - an amazing open source database solution.
Secure connections have been implemented to provide maximum security.
Time for client overhaul.
Saturday, 29 January 2011
Roadmap 2011
January +
Login sever interacting with database
Tidy and upgrade the client code
World server to support maps on different clusters
New height map terrain system with LOD algorithms
List of bugs to fix before alpha
Alpha
Trailer
Recruit artists
Graphical upgrades
Shadows
Stress tests
Late 2011
Finish GUI to commercial standard
Early mobs and AI
Alpha 2
Login sever interacting with database
Tidy and upgrade the client code
World server to support maps on different clusters
New height map terrain system with LOD algorithms
List of bugs to fix before alpha
Alpha
Trailer
Recruit artists
Graphical upgrades
Shadows
Stress tests
Late 2011
Finish GUI to commercial standard
Early mobs and AI
Alpha 2
Subscribe to:
Posts (Atom)