PDA

View Full Version : Procedurally Generated Levels?



Uncle_Jo
02-18-2012, 09:32 PM
Hey there. First post here. I was wondering if one could create a game that produces procedurally generated levels with this ZC program? I've checked out the scripting language and it seems to include a random integer function. Also arrays seem supported as well.

For those that do not know what I'm getting at. I'm thinking of using this program to make a roguelike. You may be familiar with the game Nethack or Crawl. Basically, at runtime, the program will produce a random dungeon for you to play in. It does this by randomizing and placing tiles/blocks in a specific location and in specific patterns as to create rooms and corridors. It can get pretty involved. With monster spawn points, random placement of bosses, items, etc...

So is this possible with this program?

-Jo

Uncle_Jo
02-18-2012, 10:05 PM
To be more specific from a programming perspective. What one would need to do fill a 2 dimensional array with integers. Each integer would correspond to a tile or block type on the screen. Think of the array as a map. Filling this array is done with a loop and there are various algorithms to run in that loop to make different and interesting architectures. After the architecture is complete one would then go through and place items, enemies and bosses on appropriate empty spaces. There are quite a few algorithms for this as well.

Every time you fire up the player program you'd get an entirely different dungeon. The creation algorithm executes at run time so there can be a bit of delay before the game starts. But with modern machines that's not much of a problem. Generally games of this type allow only one life, no restarts. So you end up taking a crack at many many different dungeons before you beat the game (if you ever do). It's fun because the developer of the game gets a new experience every time instead of knowing all the secrets and blowing right through the game.

Imzogelmo
02-18-2012, 10:23 PM
I'm pretty confident that screens and map layouts could be done, with sufficiently-complex algorithms. However, whether any kind of interesting and yet solvable puzzles could be created randomly (and consistently) is a serious topic for debate.

EDIT: On the other hand, you really aren't limited to Zelda-styled games anyway.. If it were a space-exploration type game, procedural generation would work fairly well, and could potentially make a HUGE space for exploration.