Sign in to follow this  
dsm1891

Map Generation: Code vs from File

Recommended Posts

dsm1891    2746

Hello,

 

Is there any major advantages with say... generating a tile map from predetermined structures* vs generating a tile map from reading a text file** which contained the ID's of the different files?

 

 

*one example of this that comes to mind is minecraft, where the World generator populates different biomes, the biomes select which trees / dungeons / grass ect. each iteration through the generation gets finer and finer, from not a lot of hills generation(biome) to tree block goes here, then another one, then a leaf block ect ect. All of this is done through code, which sets correct blocks to go where. 

 

**I don't really have a nice example but its pretty much just reading each component of a map (say a tree) through a file

example (0= air/not set, 1 = leaf, 2 = wood)

11111

11211

01210

00200

00200

 

 

(sorry if that was a bad explanation)

 

Thanks in advance!

Share this post


Link to post
Share on other sites
vipar    171

Well if you want to do external retrieval of data for your game, I suggest XML/JSON or serialize your map data as binary data files.

Share this post


Link to post
Share on other sites
tharealjohn    453

A major advantage is it would be easier, and would would be simpler to "design" your levels. 

 

Some disadvantages are your files are editable, so the user could mess things up. 

 

You could serialize this text data to prevent the disadvantage I mentioned. 

Share this post


Link to post
Share on other sites
FLeBlanc    3141

Sounds like you are asking about the difference between [i]procedurally generating[/i] a level (as Minecraft does) vs building a level by hand. Each method has advantages and disadvantages.

 

Procedural generation allows you to specify a relatively simple set of rules for the generation in order to produce a large amount of data. And we are talking [i]large[/i] here. I saw something somewhere that estimated the size of a Minecraft world as several million times larger than the surface area of Earth. That's pretty large, way larger than you would ever be able to build by hand. If a large open world is your goal, procedural is the way to go. No team in the world could pre-build a world the size of Minecraft without heavy use of procedural tools.

 

Additionally, procedural can help to amplify replay value, assuming the gameplay is built to support it. With pre-built levels, once a player has run through them and learned all their secrets and surprises, that bit of content is essentially "used up". It holds no more surprises for the player. With properly built procedural gen, you can always present the player with new places they haven't yet seen and new challenges, emergent from a set of simple rules, for them to overcome.

 

The drawback of procedural gen is that it is superficially easy but essentially somewhat difficult. The concepts and broad ideas are fairly simple, and you can get simple results quickly, but to achieve production results you're going to have to spend quite a bit of time and thought. You can pour a lot of time into getting the generator just right, time that in some cases might be better spent pre-building a world and polishing it to a shine. 

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