Better Random World Gen?

Get help using Construct 2

Post » Sun Jun 16, 2013 1:30 am

Hi Guys! For the last couple of days, I've been working on creating a better random generation system for my survival game "Bevar in the Wild". I've been trying to make the game generate some islands with trees and grass and stuff on them, and then add collisions to make sure the player doesn't walk into the ocean.
However, I did make a system (using tiled backgrounds) that did that, but the islands were square shaped, and overlapping islands looks odd, and it just looked dumb, and I couldn't add collisions to the ocean! So, next I tried tile gen. Well it worked sort of well, and it caused a LOT of lag (64x64 tiles and a 12480x12480 layout @__@, over 30,000 tiles!) I tried to use R0J0hounds scrolling tile thing, but it kind of jacked it up >__< it didnt really work. Plus I wanted a finite map, not an infinite. So my question is, anyone know a better way to randomly generate a world with islands?
B
30
S
7
G
3
Posts: 366
Reputation: 6,252

Post » Sun Jun 16, 2013 2:32 am

That sounds interesting, I've been thinking about designing something like this myself, but if R0j0 has already done one it will probably be awesome. Do you have a link to it? I'll have a look into it as well.
B
36
S
8
G
3
Posts: 328
Reputation: 7,757

Post » Sun Jun 16, 2013 3:04 am

@EyeHawk Here is the link to R0J0's tile thingymalingy CAPX: http://dl.dropbox.com/u/5426011/examples16/inf_map3.capxInvaderX2013-06-16 03:05:08
B
30
S
7
G
3
Posts: 366
Reputation: 6,252

Post » Sun Jun 16, 2013 3:08 am

I tried something like this not a while ago

I can't share it because my implementation isn't finished yet

But the diamond-square generation algorithm seems like a plausible solution !
B
41
S
17
G
17
Posts: 2,247
Reputation: 17,436

Post » Sun Jun 16, 2013 4:34 am

Cool thanks for the link. Wow and the capx is only a few lines for doing something so complicated! Rojo made another capx a while back which may help which was like the legend of zelda type games - would that help?

I was going to think about a continuously scrolling type game, rather than a "flick to the next" screen sort of game. I have an idea on how to do it, but was hoping someone would have made it already

To answer your other question about making it a finite island, you could always just keep track of your distance from your origin, so that when you get to the maximum distance, the screen will no longer scroll and no more map would be generated.
B
36
S
8
G
3
Posts: 328
Reputation: 7,757

Post » Sun Jun 16, 2013 4:55 pm

@EyeHawk I guess that makes sense, but the thing is, how would I get it to generate islands properly, and spawn the trees and junk? Squiddster's seems to generate some good island type things, but I cant get it to work with R0J0hound's scrolling.
B
30
S
7
G
3
Posts: 366
Reputation: 6,252

Post » Mon Jun 17, 2013 12:08 am

Off the top of my head, you for all of the new parts of the map that get generated (assuming each one is a big sprite), you could create image points on it.

Then use the OnCreate condition to then populate those areas with trees and stuff.

You wouldn't have to create an image point per tree, you could just do a for loop and randomly dot them around each image point.
B
36
S
8
G
3
Posts: 328
Reputation: 7,757

Post » Tue Jun 18, 2013 12:34 am

@EyeHawk Woah! That's a great idea!Though, I need to homehow create tiles in the Player window ONLY, so it doesnt generate a lot of lag, and I can do the scrolling thingy
B
30
S
7
G
3
Posts: 366
Reputation: 6,252

Post » Tue Jun 18, 2013 9:52 am

There's 2 things you can do:
1. Move the world and not the player (this is what I do in my latest win8 comp submission http://www.scirra.com/forum/topic69074.html)
2. Create the layout so it's about double the window size - whenever your player gets to a certain distance on the current 'tile', a new one is created on the edge prepopulated with the trees and other assets
B
36
S
8
G
3
Posts: 328
Reputation: 7,757


Return to How do I....?

Who is online

Users browsing this forum: bigezy80, Laurent, Yahoo [Bot] and 9 guests