Is there a simple way to make random level generation

Non-platform specific questions.

Is there a simple way to make random level generation

Postby zxcvbnm » Sat Dec 04, 2010 9:13 pm

I tried using timers and the like but cannot seem to make proper randomly generated levels. Games like canabalt and doodle jump have platforms appearing randomly to make every time you play a new challenge. Does anyone have a simple method to do this.
Check out Momo AlienStarcatcher , featured in apples new and noteworthy and has 5 star reviews!!!
http://itunes.apple.com/us/app/momo-ali ... 61779?mt=8
zxcvbnm
 
Posts: 248
Joined: Sun Aug 22, 2010 7:57 pm
Score: 10 Give a positive score

Re: Is there a simple way to make random level generation

Postby lcl » Sat Dec 04, 2010 11:07 pm

Here, kren. :D
I made it for you. :D

Use enter to create level.
You can go around level by moving the pacman with a, w and d, or
move around with view by arrow keys.

I hope that's what you needed. :wink:
Attachments
RandomLevel.zip
(13.19 KiB) Downloaded 95 times
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Is there a simple way to make random level generation

Postby zxcvbnm » Sat Dec 04, 2010 11:41 pm

Excellent work , But as far as code I only understand some of it. Can you give some basics on what you did ?
Check out Momo AlienStarcatcher , featured in apples new and noteworthy and has 5 star reviews!!!
http://itunes.apple.com/us/app/momo-ali ... 61779?mt=8
zxcvbnm
 
Posts: 248
Joined: Sun Aug 22, 2010 7:57 pm
Score: 10 Give a positive score

Re: Is there a simple way to make random level generation

Postby lcl » Sun Dec 05, 2010 12:03 am

Oh. Yeah. :D
The main function is in global code.
It has three things that you have to define when you use it.
First is how many platforms it will create, second one is maxim of how far can platforms
be from other one. The last one is maxim y distance between platforms.

The function checks if there is not as many platforms as defined when function is called
and creates new one if needed. The new platforms x and y values are randomized by previous
ones coordinates. That is what I needed random and getClone functions for.

It is pretty much the most important part.
Also, when platform is created it's coordinates are rounded for making it look better.
In create actor event there is also much other code, that code checks the position of
new platform and compares it to previous one. If the platforms are at same coordinates
or in somehow otherwise stupid positions, the code moves them. :D

That's it pretty much. Did that help you? :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Is there a simple way to make random level generation

Postby zxcvbnm » Sun Dec 05, 2010 12:39 am

Ok so the createlevel command is a function right? I never saw that command thats what threw me off. If I want more spacing between platform , where do I change that at?
Also why does the platform move up on its own to collide with you?
Check out Momo AlienStarcatcher , featured in apples new and noteworthy and has 5 star reviews!!!
http://itunes.apple.com/us/app/momo-ali ... 61779?mt=8
zxcvbnm
 
Posts: 248
Joined: Sun Aug 22, 2010 7:57 pm
Score: 10 Give a positive score

Re: Is there a simple way to make random level generation

Postby lcl » Sun Dec 05, 2010 12:45 am

Actually, createlevel is function that I wrote into global code. It is not built in ge command.

Anyway, for getting more space between platforms check the platform key down event
and change the second value in function for x distance and third for y distance. :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Is there a simple way to make random level generation

Postby needaname » Sun Dec 05, 2010 1:08 am

the ground doesn't move up, the player and view move down
needaname
 
Posts: 69
Joined: Tue Nov 09, 2010 2:07 am
Score: 4 Give a positive score

Re: Is there a simple way to make random level generation

Postby lcl » Sun Dec 05, 2010 11:45 pm

needaname wrote:the ground doesn't move up, the player and view move down

What was that supposed to mean?? :lol:
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Is there a simple way to make random level generation

Postby needaname » Mon Dec 06, 2010 7:30 am

zxcvbnm wrote:Also why does the platform move up on its own to collide with you?

was answering this question, i was saying gravity is moving the player/view down. so, the platform doesn't move up.
needaname
 
Posts: 69
Joined: Tue Nov 09, 2010 2:07 am
Score: 4 Give a positive score

Re: Is there a simple way to make random level generation

Postby lcl » Mon Dec 06, 2010 8:48 am

needaname wrote:
zxcvbnm wrote:Also why does the platform move up on its own to collide with you?

was answering this question, i was saying gravity is moving the player/view down. so, the platform doesn't move up.

Oh yeah, thanks, I didn't notice that question. :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest