Creating a world map......

Started by
10 comments, last by gameplayprogammer 15 years, 8 months ago
Quote:Original post by gameplayprogammer
i am looking to try to make a map similar to the Rome:Total War world map. i am completely new to making world maps. I know there is alot of art work involved, i am interested in the code part, how to make bumps on the map for mountains, how to make the seas move. All that cool stuff. Anyone know how i would start?


couldn't add an image to the post but here is a link to what i mean.

http://media.moddb.com/images/mods/1/11/10474/Map_Difference.jpg


Well terrain-wise. You need to create a dynamic quad-patch (just sufficient to maximum viewable extent of the viewport, no point thinking about rendering Australia when you're viewing Europe etc.), with each square consisting of two Triangles. These squares should mirror each-other in the horizontal and vertical axes. Then you have a world array heightmap e.g. 1024x1024 with heights of each vertice point. As you view the world, you take these coordinates and set your quad-patch's Z positions to reflect this.

It's quite a simple thing really. So now you have a bumpy terrain, where you can customize the height of each point.

Next step, is you may want to blend between two textures at varying points. e.g. You have a Grass texture, and a Sand texture. Again for this, you can use a 'Blend Map', with varying blend ratios for each vertice e.g. 0 (use 100% Grass texture), 1 (use 100% Sand texture).

You can throw in a lighting map too. Which is basically just the scalar product of the normals for each triangle face against your theoretical light source vector (i.e. your sun). i.e. if the face is in perfect alignment with the light source, then you'll get 100% brightness for that point, if it is 90 degrees or more away then you'll get 0% brightness for that point, of course you'd have ambient lighting aswell so it's more like:

(pseudo code)

LightSource.Lighting = (Face.Normal . LightSource.Normal);if(LightSource.Lighting<0) LightSource.Lighting = 0;Face.Lighting = Ambient.Lighting + (Face.Normal . LightSource.Normal).


As for randomly generating the height map. Just reset the height map to 0's. Then have a function which can apply hill's to it. Hills of Radius R, and peak P. Then randomly apply these hills around the world. Big hills will appear as Hills, while the tiny hills (i.e. of radius 1 or 2 tiles, and a height that is a fraction of tile) will result in the natural bumps.

Writing your own terrain engine can be quite fun, and you can achieve some funky results. But make sure you have atleast a basic level of Vector/Geometry math.

Oh yeah, as for the sea/wave effect. Play with Sin(World.time * T + Face.x * X + Face.y * Y)*A + K. Where the capital letters are your constants. :)
Advertisement
i think you done this thing before :-) thats a great run through, thanks for the help.

This topic is closed to new replies.

Advertisement