Wednesday, 12 October 2016

Random Level Generation v.1

    In my game, each level is made up of rooms. The rooms are hand designed, but the combination of rooms that spawn is chosen at random. The level has 'room spawner' objects at pre-determined locations, which use the 'choose' function in GameMaker to pick a room from the list. At the location of each of the 'spawner' objects, a random room will appear in the level.
The code is ugly, and it's inefficient, but it work's for now. I'll find a better way at a later date.
GIF of me restarting the room over and over, seeing the random levels that pop in
    The problem with this code as it stands, is that it throws up completely random results. This seems desirable, but this can throw up results where half of the rooms in the level are the same, which is a) not great for freshness and b) not very good in terms of creating believable environments (what kind of wild west town has half of their buildings being post offices?!). The easy solution that I am implementing now is to include certain rooms multiple times in the 'choose' function. This is an easy way to make the results lean towards a certain result, or away from another. I am going to keep looking at other solutions, to limit certain rooms to once per level and such.

No comments:

Post a Comment