•      Sign In
• Create Account

### #ActualDracoLacertae

Posted 26 March 2012 - 02:26 PM

I'm watching this thread with great interest, as random-level generation has been an interest of mine for a while. An issue I've always dealt with is sometime's its difficult to enforce a particular level is solvable. If you randomly place locked doors, keys, passageways, etc, it becomes very easy to make an unwinable scenario. I came up with this solution, but I haven't implemented it yet: generate the world 1 room at a time.

Take what Ashaman73 said, and come up with a theme and goal. Lets say the goal of this level to retrieve object X, and then exit the level a different way than you came in. Instead of generating a level with object X in it, just generate a room. The player looks around, find a door. He opens it, and it leads to another room, passageway etc. As the player moves around, the level is generating just 1 step ahead according to a few simple rules:

1. First, there's a list of objects that need to be found, along with a probability representing how hard/easy the object is to find. The game starts with Object X, and the exit on the list.

2. When the player attempts to open a door, if there are any other unexplored paths in the game (doors that have been generated but not yet opened), there is a probability this door is locked. If it's unlocked, a room behind the door is generated. If it is locked, a key to this door is added to the list of objects to be found. (or see rule 5)

3. When generating a new room, if there are objects on the list that need to be found, a dice is rolled and maybe that object is in this room, and you should place it here. Also, there is a probability you will find a random key that doesn't belong to a specific door yet.

4. When generating a new room, it may contain a random number of doors to other ajoining rooms. if there are object that still need to be found, and they are necessary to win this level, and the objects haven't been placed in this room, and the player has opened the last unexplored door, then this room MUST contain at least 1 more door other than the one you entered through.

5. When generating a door, if it is locked, and the player has previously found a random key, randomly decide if this is the right key or not.

I think that from the player's point of view, a level generated as above on-the-fly will always be solvable AND will be indistinguishable from the case where the level is generated all at once ahead of time. Also, there a few advantages to this kind of scenario, for instance a player can get a 'lucky' powerup (or unlucky punishment) that changes the probabilities, and makes it hard to win. A punished player will always find the key after exploring room after room, a rewarded player will find it very soon. It also has this extra feature: In a pre-generated world if the player looks everywhere, but for some reason completely missed the one spot the key is, he'll never find it, and will become frustrated. In a on-the-fly world, the player will eventually find it, no matter where he is looking or which direction he took in the beginning of the maze.

### #1DracoLacertae

Posted 26 March 2012 - 02:23 PM

I'm watching this thread with great interest, as random-level generation has been an interest of mine for a while. An issue I've always dealt with is sometime's its difficult to enforce a particular level is solvable. If you randomly place locked doors, keys, passageways, etc, it becomes very easy to make an unwinable scenario. I came up with this solution, but I haven't implemented it yet: generate the world 1 room at a time.

Take what Ashaman73 said, and come up with a theme and goal. Lets say the goal of this level to retrieve object X, and then exit the level a different way than you came in. Instead of generating a level with object X in it, just generate a room. The player looks around, find a door. He opens it, and it leads to another room, passageway etc. As the player moves around, the level is generating just 1 step ahead according to a few simple rules:

1. First, there's a list of objects that need to be found, along with a probability representing how hard/easy the object is to find. The game starts with object X on the list, with Object X, and the exit on the list.

2. When the player attempts to open a door, if there are any other unexplored paths in the game (doors that have been generated but not yet opened), there is a probability this door is locked. If it's unlocked, a room behind the door is generated. If it is locked, a key to this door is added to the list of objects to be found. (or see rule 5)

3. When generating a new room, if there are objects on the list that need to be found, a dice is rolled and maybe that object is in this room, and you should place it here. Also, there is a probability you will find a random key that doesn't belong to a specific door yet.

4. When generating a new room, it may contain a random number of doors to other ajoining rooms. if there are object that still need to be found, and they are necessary to win this level, and the objects haven't been placed in this room, and the player has opened the last unexplored door, then this room MUST contain at least 1 more door other than the one you entered through.

5. When generating a door, if it is locked, and the player has previously found a random key, randomly decide if this is the right key or not.

I think that from the player's point of view, a level generated as above on-the-fly will always be solvable AND will be indistinguishable from the case where the level is generated all at once ahead of time. Also, there a few advantages to this kind of scenario, for instance a player can get a 'lucky' powerup (or unlucky punishment) that changes the probabilities, and makes it hard to win. A punished player will always find the key after exploring room after room, a rewarded player will find it very soon. It also has this extra feature: In a pre-generated world if the player looks everywhere, but for some reason completely missed the one spot the key is, he'll never find it, and will become frustrated. In a on-the-fly world, the player will eventually find it, no matter where he is looking or which direction he took in the beginning of the maze.

PARTNERS