Sign in to follow this  
jcamp

Dynamic Generation of Simple 2d map

Recommended Posts

Greetings! I've been looking high and low for information on how to create a 2d map dynamically. I've created a quick png file to show you what I'm looking to do: http://www.intuitivecreations.com/map.png I've tried a few methods and read a few articles but I haven't found anything that really replicates the concept of the png file. A full tile-based 2d height map or 3d map is way over the top for this kind of thing. Anyone have any ideas? Any information would be greatly appreciated! Thanks! j

Share this post


Link to post
Share on other sites
a little more information on what exactly you're trying to do would be nice. Are you trying to make a map that doesn't use the basic square/hex/diamond shapes of most engines?

Share this post


Link to post
Share on other sites
You can use a cellular automaton with the "majority" rule for this. See
http://germain.umemat.maine.edu/faculty/hiebeler/java/CA/Majority/Majority.html
for a Java applet demonstrating this (some good settings are number of states = 10, neighborhood method = "All", neighborhood size = 10). This converges quickly to something looking like a map. Another way I can think of would be to choose a random set of points and doing a Delaunay triangulation with them, then combining the resulting triangles into larger shapes, but it would look very polygonal and non-organic (http://en.wikipedia.org/wiki/Delaunay_triangulation).

Share this post


Link to post
Share on other sites
Your map looks like a 4 x 7 rectangular grid with wobbly sides.

You could try starting with a grid then move each point a random amount (up to 1/2 unit) in a random direction. Then move the midpoint of each side up to 1/4 unit in a random direction, then the midmidpoints up to 1/8 etc until you get bored.

Share this post


Link to post
Share on other sites
Thanks for all the replies!

Let me try to respond most of you;

The map I presented is supposed to represent countries. It is not a tile/hex map as that would be easy to create dynamically.
The map also won't be in anything as complex as an opengl app, I'm literally trying to dynamically create a png file similar to the one I mentioned.

What I was trying to get help on was literally "How do you dynamically make a circle/weird polygon that's smooth and dynamically add more weird polygons that neighbor them?". I have very little background in mathmatics/game programming, but I've been a professional programmer for over ten years. Translation: I can build stuff as long as it doesn't involve trigonometry/physics :)

I have no "formal" education in programming so I'm not familiar with all these terms you guys have mentioned, but be assured google will be busy today ;)

Again thanks for the replies.

j

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