Strife: Beginnings of an MMORPG
MMORPG terrain heightmap loading MMO RPG Strife camera
I recently started with the groundwork for a MMORPG with the working title of "Strife" using my own game engine. I want to use this journal to share my progress as well as a personal progress log I can look back on.
At this point I'm not going to go into high level game design choices instead I am going straight into the technical aspects of what I did so far.
Currently the total world size is 20x10 kilo meters (of which 99% is still flat). The world is build up from 1023x1023 meter blocks. Each block is based on 4, 8 bit per channel 1024x1024 textures. The first texture has 3 channels and is used as a heightmap. All 3 channels are used giving 24 bits in total to store the height value. That is a maximum of 16777216. Each unit is a little less than a centimetre in the game world (or 2m/256 to be precise), so that gives a total range of 131 kilo meter. As can be deducted from the above each "pixel" is 1 meter apart. The second texture has 3 channels and is used to store uncompressed normals. At a later stage I will probably optimize that. The third and fourth textures both have 4 channels and are being used to store texture blend values. 1 blend value per channel. At a later stage I might store 2 values in 1 channel since 4 bits should be enough. Terrain is rendered by displacement in the vertex shader. And yes I did indeed rip these tile textures from wow ^^ they serve as excellent place holders. More on tile textures and blending later (still need to work out some details).
The game dynamically loads and destroys tiles as the player moves. A grid of 7x7 tiles are always loaded around the player. Currently there is only one quality for all textures which might change, although It does not seem to be too heavy on video memory so it might stay like this. I do however have a LOD solution in place for rendering. A 1024x1024 block will split up and be drawn in multiple smaller blocks unless it is very far away from the player. The closer it is to the player the more the blocks will be split up. Apart from that, far away blocks will also be drawn using less vertices. For example a 1024 block 3 kilo meter away might be drawn using 64x64 vertices but a 128x128 block that the player stands on will be drawn using 128x128 vertices. My LOD system works nicely but it is still pretty rough and there is plenty of room for improvement. However it runs at max fps (60) on my pc and I have not even implemented any frustum culling yet
Camera and Movement
The height of any point on the terrain is determined using barycentric interpolation. I've implemented camera and movement controls that are very similar to wow's. Probably because I am really used to it and it is very smooth and easy to navigate with. And after playing Neverwinter Nights 2 I realised how agonizing bad camera and movement controls are.
This is what is currently taking most of my time. As you can see my world editor has 3 regions. A 3D view, A 2D view and a solid black area that is reserved for all the buttons and other controls to come (currently its still completely hotkey driven). To edit the terrain height you draw on the 2D area (as if you were creating heightmaps in a paint application) but the difference is that you control the height range you work with. See the blue and green areas on both the 3D and 2D views? Those are the upper and lower limits. They get shifter around by using the numkeys and any area in the 2D view that falls in that range will be coloured from white(highest) to black(lowest). This allows you to edit fine details using the full range of white to black.
That is it for my first entry. I hope to have more to share soon.
Thanks for reading!