Procedural Generation?

New releases and general discussions.

Post » Sun Apr 12, 2009 10:37 am

Okay, I am working on a game (which is still in the writing stage), now it requires some procedural generation for starfields and some of the special effects. So is there a module or something, or is is it a planned feature?

Note: I am halfway done with the project information. Expect to see a recruitment thread soon.
B
1
G
3
Posts: 2
Reputation: 829

Post » Sun Apr 12, 2009 10:50 am

*tunes in*

I am interested in how to create a realistic starfield as well (with the nebulae, gas clouds, distant galaxies and whatsnot to boot!). Particles would be the most suitable for this purpose, with some creative customization. Just for the background for space games. ;)
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sun Apr 12, 2009 4:05 pm

You can just do it with events I guess. As you move along, create stuff just outside the screen in the direction the play is moving, and destroy the ones theyve gone past to save memory.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Sun Apr 12, 2009 4:30 pm

you can do procedural generation in construct, but you can't just make a module that does that, that'd be kinda like asking them to put premade sprites in construct. the procedures that generate stuff are going to be different in every game.

that being said -

here's a quick example with beautiful art collected from actual nasa photographs

[u:15zrgdzy]click here for example cap[/u:15zrgdzy]
move mouse away from center of screen to scroll, center in screen to stop

I'm not sure how much of construct you've learned, so this may or may not make sense. (i wrote this before I just changed my mind and decided to make it, took about as much time as it took to write it as to actually make it, cuz construct is cool like that) but a good start would be to make a few different basic star sprites, make them as large as the largest one you want and scale down from there. set them to not disappear when they leave the screen, and make an event at the start of layout that loops to a given number (you'll probably want to change this over and over until it looks good). for each iteration of the loop, have it create a star object, picked from the pool of stars (you can also set it so certain common looking stars have a greater chance of being picked), have it choose a random size to scale to, and make it create that star at a random location. with random brightness and angle.

this isn't in the example, but if you really want to make it look awesome you make multiple layers and make them generate random stars that are smaller on slower scrolling layers so it looks 3d, if you need some help with that it'll have to be after the easter egg hunt.

edit: as ashley said, you can save memory by creating stars as you're going along, not sure what type of game you're making and whether or not that'll ruin the effect you're going for
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sun Apr 12, 2009 9:02 pm

new version with multiscrolling
click here

also, in the first version you see a whichstar variable with random on it to choose the star, and then it never gets checked, that was supposed to be the variable temp. it's fixed on this version...not that it made much of a difference in the first

EDIT: Now with actual nasa photography...not joking this time (3 stars extracted from this photo (http://www.universe-cluster.de/fileadmi ... _stars.jpg))
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Mon Apr 13, 2009 2:16 am

The multiscrolling version is quite choppy for me. Only 10 fps. The first one however is fine.

Also, seeing as how I've already gone through making starfields and got quite annoyed with it, I'm going to let you know that you're probably going to hit a wall with this current method.

Larger layouts = more stars which takes a long time to create on startup and more resources used in general.

Edit:

This is what I came up with (with some help from the guys in chat). It's not pretty because I was just working on the theory of it, nor does it have multiple scroll layers though they should be fairly easy to add.

http://dl.getdropbox.com/u/646325/ProtoType0-2-9.cap

Eventually I just gave up with it and opted for a scrolling background.

http://dl.getdropbox.com/u/646325/Gibbous%20Panoply.exe
B
2
S
2
G
4
Posts: 136
Reputation: 1,722

Post » Mon Apr 13, 2009 3:25 am

@lucid

Even though I have not learned much yet. It's still quite understandable. I'll look at the cap's later. I'm not at my computer.
B
1
G
3
Posts: 2
Reputation: 829

Post » Mon Apr 13, 2009 8:24 am

[quote="Barri167":hxcxhzql]The multiscrolling version is quite choppy for me. Only 10 fps. The first one however is fine.

Also, seeing as how I've already gone through making starfields and got quite annoyed with it, I'm going to let you know that you're probably going to hit a wall with this current method.

Larger layouts = more stars which takes a long time to create on startup and more resources used in general.[/quote:hxcxhzql]

I'll probably make a new version just barely larger than the screen later to keep the resources down.
I wonder if there's an easy way to emulate a slower system, other than bogging down your system though, because I get the "that runs like crap on my system" thing alot with my caps for things that run silky smooth. I guess it's a good problem to have, as opposed to the other way around.

[quote="InfinitySquared":hxcxhzql]@lucid

Even though I have not learned much yet. It's still quite understandable. I'll look at the cap's later. I'm not at my computer.[/quote:hxcxhzql]

true,
hope it runs well :mrgreen:
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Mon Apr 13, 2009 12:39 pm

[quote="Mipey":2h2oa683]*tunes in*

I am interested in how to create a realistic starfield as well (with the nebulae, gas clouds, distant galaxies and whatsnot to boot!). Particles would be the most suitable for this purpose, with some creative customization. Just for the background for space games. ;)[/quote:2h2oa683]

Hi Mipey,

You can try this out "Universe Image Creator"
[url:2h2oa683]http://www.diardsoftware.com/index.html[/url:2h2oa683]
I use this and it works very well. Its been around for a long time.
You can create REALISTIC images of space in just minutes. Create Nebula, Gas Clouds, Stars, Galaxies, Planets, and More....
B
15
S
10
G
8
Posts: 107
Reputation: 4,944

Post » Mon Apr 13, 2009 2:33 pm

procedural generation is about as simple as using Random(X) in your creation events, never using sprites for explosions and stuff like that.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests