Sign in to follow this  
gameplayprogammer

Creating a world map......

Recommended Posts

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

Share this post


Link to post
Share on other sites
If you know (or want to lean) C# here is a good link:
http://www.riemers.net/

That site contains 4 series of tutorials to learn XNA for C#. The first and the fourth are about creating a game terrain. The first is a simple one but once you follow the last series you will make a real multitextured terrain with moving water. I think this is a good place to start.

Another subject to dive into if you want to generate random terrain is Perlin Noise. It is used to generate a noise effect which you can use to generate nice terrains. :)

Share this post


Link to post
Share on other sites
lol in my opinion, DON'T try c# unless your a totally object oriented freak. well thats just my opinion, tbh i really hate classes all together but they are very essiental to programming so don't take my word for it.

Share this post


Link to post
Share on other sites
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


If it's natural-looking height map generators you're looking for, I've used this in the past to generate nice-ish heightmaps.

http://www.bin.sh/gaming/tools/world.cgi

Takes some tweaking, but you can come up with some pretty convincing maps.

From this you might look into rendering terrain using 8-bit height maps.

Good luck!

Share this post


Link to post
Share on other sites
The map in Rome: Total War certainly isn't randomly generated (hey, let's use this one, it looks just like Europe!). Either way, you can generate or otherwise create a heightmap and for the details, place some models on top of it. You can also use a model for the terrain if you want - whether that's a good idea depends on what exactly you want to do with your world map.

As for heightmaps, they're usually stored as images, where every pixel stands for a certain height. So, your program loads the heightmap image and displays a bunch of triangles based on these height values.

As for your name, gameplayprogrammer, I understand you'd rather work on game code, right? If so, I would suggest picking a game engine to do the tedious work for you (heightmap and model rendering for example), so you can focus on the game code (world map details such as water, weather, moving creatures, etc.). :)


@Code Zombie: with a bit of good will, it's possible to do procedural programming in C# just as well. And object-oriented programming can be emulated in C, too. Classes are not that essential to programming in general, because object oriented programming is not the only programming paradigm. It's a popular one though and quite useful for organizing larger projects. However, what does that have to do with this thread?

Share this post


Link to post
Share on other sites
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. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this