Monday, December 22, 2008

MMORPG Day 5

I got a lot done on Day 5. I started working on a Height Map loader which can load a 3D map from a 2D height map. It looks really good although I don't have any great maps yet.

First I had to create a height map to test the loader. I wasn't sure if I should use a picture or a text file. I decided on a text file since it's easier to store additional information about the map this way. I decided on a really simple format:


// A random 5*5 Sized Map
1,-2,4,1,4
-2,8,5,6,2
1,0,0,2,3
4,6,2,5,7
-1,0,4,3,2



To load that height map I first created a grid of 5*5 Vertices and connected them together with triangles so that they would form a Square pattern like so:


After that I simply assigned a number to each vertex so that they would be the height they should be in. A resulting height map of the Loader looked something like this in my 3D Engine:


Now I just would have to find the perfect size of the squares and the Height Map loader would be finished. I though of 32 times 32 pixels because most 2D video games use this tile size. I found 32 pixels too small to fit a 3D human into so I set it to 50 pixels. 50 Pixels is quite good and I'll probably stay at that size but I'm not sure yet.

Now to finish the Map loader I need to find a way to load objects (ex. trees, houses, chairs) into the map and place them at the appropriate position. Then I need to find a way to add colour to the whole thing, grey is kind of boring. After that I should find a way to make the Camera focus on a certain tile (probably the one with the player on it). I'm not quite sure how much more time I have before Christmas so I'm saying that the next MMORPG Day might be more than 3 days from now.

Merry Christmas!

No comments: