Map Generation: Code vs from File

Started by
2 comments, last by FLeBlanc 10 years, 9 months ago

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!

Mobile Developer at PawPrint Games ltd.

(Not "mobile" as in I move around a lot, but as in phones, mobile phone developer)

(Although I am mobile. no, not as in a babies mobile, I move from place to place)

(Not "place" as in fish, but location.)

Advertisement

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.

CEO of Dynamic Realities

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.

jmillerdev.com

Follow me @jmillerdev

Sounds like you are asking about the difference between procedurally generating 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 large 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.

This topic is closed to new replies.

Advertisement