The Daily Click ::. Forums ::. Klik Coding Help ::. Making a platform game with randomly generated areas?
 

Post Reply  Post Oekaki 
 

Posted By Message

J.C



Registered
  22/03/2013 05:18:14
Points
  118
23rd November, 2015 at 23/11/2015 05:13:20 -

Hi guys.

I've been thinking about putting together a platformer with the following setup:

-Game must use only a single room for everything. (Like a hub. Try playing games like Approaching Dawn or Core of Innocence for an example of what I mean)

-There will be at least 10 levels each with randomly generated areas within.

Please let me know if this is possible within MMF2's capabilities. This is something I would really like to try out with the program.

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
24th November, 2015 at 24/11/2015 02:19:19 -

Yes that is possible. But the more random you make the level layouts the less control you have over whether the levels will be any fun to play through or if they would even possible to progress through.

 
.

J.C



Registered
  22/03/2013 05:18:14
Points
  118
24th November, 2015 at 24/11/2015 04:54:07 -


Originally Posted by AndyUK
Yes that is possible. But the more random you make the level layouts the less control you have over whether the levels will be any fun to play through or if they would even possible to progress through.



Very true. So how would I go about randomizing level layouts? I've never attempted that before with the program.

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
25th November, 2015 at 25/11/2015 03:32:07 -

I think going completely random is a bad idea, you'll get almost no control over anything and there's a very high chance the design of the rooms will be rubbish. So instead of every single 16x16 square being one of a dozen different objects I think it's best to sort of create certain templates and then choose from them semi randomly.

So design your rooms, however many you want and then let the game generate a map, selecting the rooms as it goes.

This also means you can control whether rooms have exits that let you return to somewhere you've just come from. If you've just walked right out of a room you'll want an exit to the left in your new room, right?

It sounds pretty advanced but I don't think it's too difficult.

 
.

J.C



Registered
  22/03/2013 05:18:14
Points
  118
25th November, 2015 at 25/11/2015 21:52:03 -


Originally Posted by AndyUK
I think going completely random is a bad idea, you'll get almost no control over anything and there's a very high chance the design of the rooms will be rubbish. So instead of every single 16x16 square being one of a dozen different objects I think it's best to sort of create certain templates and then choose from them semi randomly.

So design your rooms, however many you want and then let the game generate a map, selecting the rooms as it goes.

This also means you can control whether rooms have exits that let you return to somewhere you've just come from. If you've just walked right out of a room you'll want an exit to the left in your new room, right?

It sounds pretty advanced but I don't think it's too difficult.



Good point.

Hmm...I've never had my games generate a map before, how does that work?

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
26th November, 2015 at 26/11/2015 06:13:56 -

It would be up to you really.
Perhaps actual active objects that are like a mini map? Then a 'you are here' object sitting on top that shows where the player is but actually is used by the game to know what room to display on screen.

I hope you know what i'm getting at here,

so say your entire game map can be as big at 10 rooms by 10 rooms your game would start by creating tiny active objects in a grid. say, 8x8 sized squares, with each one representing a different room and maybe one to mean an empty room.

and if you have different room types

Active 1 = Room type 1
Active 2 = Room type 2
Active 3 = Room type 3

When your player exits a room the 'you are here' object moves over one room too.

 
.

J.C



Registered
  22/03/2013 05:18:14
Points
  118
27th November, 2015 at 27/11/2015 00:09:31 -


Originally Posted by AndyUK
It would be up to you really.
Perhaps actual active objects that are like a mini map? Then a 'you are here' object sitting on top that shows where the player is but actually is used by the game to know what room to display on screen.

I hope you know what i'm getting at here,

so say your entire game map can be as big at 10 rooms by 10 rooms your game would start by creating tiny active objects in a grid. say, 8x8 sized squares, with each one representing a different room and maybe one to mean an empty room.

and if you have different room types

Active 1 = Room type 1
Active 2 = Room type 2
Active 3 = Room type 3

When your player exits a room the 'you are here' object moves over one room too.



That could work.

Hmm...I think I understand, but the best way for me to learn this method is to have a quick example file that goes over the basics.

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
27th November, 2015 at 27/11/2015 03:44:44 -

I'll see what I can do.
Ok so i did some stuff in MMF2. I did it quickly because I'm off to bed soon.

It doesn't account for whether the rooms can link to each other, but i hope you can understand it from taking a look.

https://dl.dropboxusercontent.com/u/50324676/Mazegenerator.zip

Edited by AndyUK

 
.

Airflow

imafirinmahlazr

Registered
  24/09/2003
Points
  -197

VIP MemberSonic SpeedSnow Cloud!Computer
28th November, 2015 at 28/11/2015 00:20:06 -

A game on the atari was randomly generated.
The player would walk off the edge of the screen and a pre-made room would be randomly selected.
You could try doing that but save the room number into an array if the array location reads zero.
Then you have a procedurally generated world with continuity.

 
n/a

J.C



Registered
  22/03/2013 05:18:14
Points
  118
28th November, 2015 at 28/11/2015 02:52:08 -


Originally Posted by Airflow
A game on the atari was randomly generated.
The player would walk off the edge of the screen and a pre-made room would be randomly selected.
You could try doing that but save the room number into an array if the array location reads zero.
Then you have a procedurally generated world with continuity.



Hmm...that could work best. I've never used arrays before in my games, so I don't know where to start with that one.

Perhaps if it is possible, could you show me the basics of this in an example file?

 
n/a

Airflow

imafirinmahlazr

Registered
  24/09/2003
Points
  -197

VIP MemberSonic SpeedSnow Cloud!Computer
28th November, 2015 at 28/11/2015 08:51:45 -

Here's an engine so you don't need to use arrays. All the array coding is done.
http://www.mediafire.com/download/ss6gug0kko6mk57/RoomGenerator.zip

Simply replace the button with 'player moves off screen or enters door' and use 'roomnum' to load a level.
If you get good at using it, there's an improved version which lets you control the rarity of rooms.

Edited by Airflow

 
n/a

Airflow

imafirinmahlazr

Registered
  24/09/2003
Points
  -197

VIP MemberSonic SpeedSnow Cloud!Computer
28th November, 2015 at 28/11/2015 09:04:43 -

I did a quick experiment with Andys approach.
Image

I rotated a 3 door room at random in all map locations.
It still creates closed areas. So all your rooms need to have 4 doors.

 
n/a

Airflow

imafirinmahlazr

Registered
  24/09/2003
Points
  -197

VIP MemberSonic SpeedSnow Cloud!Computer
28th November, 2015 at 28/11/2015 09:22:20 -

If you give 4 door rooms 50% chance spawn, you can make a playable world.
But the mazyness is low, and you get occasional dead rooms.
The chance of spawning in one is 1%. the chance of spawning in dead room twins is 0.000001%

Image

 
n/a

Fifth

Quadruped

Registered
  07/05/2003
Points
  5818

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
29th November, 2015 at 29/11/2015 09:04:48 -

Maybe something in-between?
If you can come up with a means to test what rooms are inaccessible, then you can do the 3-exit room thing, check for inaccessibility, then change inaccessible rooms to 4-exits.

The problems that might come up, though, are:
1: making something that checks for inaccessible rooms might be tricky to make and slow to run, and
2: in the rare event that most of the map is inaccessible, you'd have to convert a lot of rooms to 4-exit.

But there would still be ways to refine it. Procedural generation is a fun thing to play with.

 
Go Moon!

J.C



Registered
  22/03/2013 05:18:14
Points
  118
7th December, 2015 at 07/12/2015 19:19:23 -

Hmm...these are all very interesting ideas.

Though I wonder if it could also be done as simply as:

-Player character overlaps with invisible trigger at the end of the room

= Set Random room teleport Counter to Random (10)

And depending on the number the pool chooses; the number will teleport him to a randomized room (the player will change position relative to an invisible active object)

What do you guys think?




 
n/a
   

Post Reply



 



Advertisement

Worth A Click