|
metadata

**Procedurally Generated Graphics Contest #3**
**Rules** :
- All graphics must be generated with code (no embedded or externally loaded images).
- The final image should be generated with an algorithm and must fit the selected theme.
- A new image should be created whenever the user clicks.
- It can be static or animated.
- You can make any kind of image (of any art genre) as long as it fits the theme.
- You can submit as many entries as you want.
- Individual contest. No teams allowed.
**Theme** : Planet
**Deadline** : 26-12-2012
After the deadline, a voting period will start.
|
|
|
metadata
\*Theme is not cities for anyone who saw this prior to this post. It is planet. I corrected the OP.
|
|
|
metadata
That is a trippy header pic.
~~Wait, what:~~
~~Title: PGGC #3: Planet~~
~~> *Originally posted by **[Senekis93](/forums/4/topics/313841?page=1#posts-6621843):***
> **Theme** : Cities~~
UG’s on it
|
|
|
metadata
My bad. Thanks for editing it, UG.
Copy-pasting is evil.
|
|
|
metadata
By the way, the following article may be a good read in case you’re having troubles figuring out how to turn your terrain into a sphere: [http://jacksondunstan.com/articles/1904](http://jacksondunstan.com/articles/1904)
Happy coding.
|
|
|
metadata
Who said a planet had to be spherical?
**EDIT** Anyone remember Spin the World?

|
|
|
metadata
I do. (:
And yes, that’s a good point. Planets don’t need to be spheres.
|
|
|
metadata
Hm but I feel if I was to make it anything else than spherically, I’d have to implement 3d or something.
I’m not into 3d :/
Edit: Btw how to work with seeds? (one seed string or something → one planet) Since it’s procedural and not random.
Edit 2: Found [this](http://www.stephencalenderblog.com/?p=181)
|
|
|
metadata
> *Originally posted by **[ErlendHL](/forums/4/topics/313841?page=1#posts-6622174):***
>
> Edit 2: Found [this](http://www.stephencalenderblog.com/?p=181)
That article and the ones it references are fascinating reads, thank you very much.
Edit: I’ve cleaned up Stephen Calender’s class a bit. I’ve tried to:
Minimize exposure of the class’ innards to the outside world. Only two public properties remain:
initialize(seed) and random to seed the algorithm and get a number out of it, respectively.
Remove as many magic numbers as I could. There are some left.
Clean up obtrusive comments. Again, there are some left.
Replace the Array with a vector since Mersene needs all the help it can get in terms of speed.
Here is the resulting class for those who may be interested.
`
public class Mersene
{
// For algorithmic details, see http://en.wikipedia.org/wiki/Mersenne_twister.
// This code is based off a MT19937 implementation by Stephen Calender,
// posted on http://www.stephencalenderblog.com/?p=181
//w = 32, r = 31
private static var MT:Vector.<uint>;
private static var indexMT:int;
private static const a:uint = 0x9908B0DF;
private static const m:uint = 624;
private static const n:uint = 397;
private static const u:uint = 11;
private static const s:uint = 7;
private static const b:uint = 0x9D2C5680;
private static const t:uint = 15;
private static const c:uint = 0xEFC60000;
private static const l:uint = 18;
public static function initialize(seed:uint):void
{
MT = new Vector.<uint>(m, true);
MT[0] = seed;
for (var i:int = 1; i < m; i++) MT[i] = uint(0xFFFFFFFF & (0x6C078965 * (MT[i - 1] ^ (MT[i - 1] >>> 30)) + i));
indexMT = m;
}
public static function get random():uint
{
if (indexMT == m) generateRands();
var y:uint = MT[indexMT];
y = y ^ (y >>> u);
y = y ^ ((y << s) & b);
y = y ^ ((y << t) & c);
y = y ^ (y >>> l);
indexMT++;
return y;
}
private static function generateRands():void
{
var i:int;
var y:uint;
indexMT = 0;
for (i = 0; i < m - n; i++)
{
y = (0x80000000 & MT[i]) + (0x7FFFFFFF & (MT[i+1]));
MT[i] = MT[i + n] ^ (y >>> 1) ^ ((y & 0x1) * a);
}
//special case for i + 397 > 624 to avoid a mod operator
for (i = m - n; i < m - 1; i++)
{
y = (0x80000000 & MT[i]) + (0x7FFFFFFF & (MT[i+1]));
MT[i] = MT[i + n - m] ^ (y >>> 1) ^ ((y & 0x1) * a);
}
//special case for last value, to avoid mod operator
y = (0x80000000 & MT[m - 1]) + (0x7FFFFFFF & (MT[0]));
MT[m - 1] = MT[n - 1] ^ (y >>> 1) ^ ((y & 0x1) * a);
}
}
}
`
|
|
|
metadata
I wonder, if I’d do the majority of work via shaders, will it count? The shaders, of course, will be of my authoring.
|
|
|
metadata
My crazily advanced [entry](http://www.fastswf.com/eSIYtgM)
On a bad note, I think swfs with telemetry enabled mess up fastswf because it changes the swf header information. Argh.
|
|
|
metadata
> *Originally posted by **[BobTheCoolGuy](/forums/4/topics/313841?page=1#posts-6623561):***
>
> My crazily advanced [entry](http://www.fastswf.com/eSIYtgM)
>
> On a bad note, I think swfs with telemetry enabled mess up fastswf because it changes the swf header information. Argh.
I take it that that messed up header is what causes what I’m seeing?

|
|
|
metadata
> *Originally posted by **[Draco18s](/forums/4/topics/313841?page=1#posts-6623820):***
> > *Originally posted by **[BobTheCoolGuy](/forums/4/topics/313841?page=1#posts-6623561):***
> >
> > My crazily advanced [entry](http://www.fastswf.com/eSIYtgM)
> >
> > On a bad note, I think swfs with telemetry enabled mess up fastswf because it changes the swf header information. Argh.
>
> I take it that that messed up header is what causes what I’m seeing?
>
> 
Yeah- I’m getting that too.
**E** : I got started on the background, no planet yet but I’m happy with the stars and space fog. [Here you go.](http://www.fastswf.com/ZqX10Ws)
|
|
|
metadata
> *Originally posted by **[RTL\_Shadow](/forums/4/topics/313841?page=1#posts-6624285):***
> **E** : I got started on the background, no planet yet but I’m happy with the stars and space fog. [Here you go.](http://www.fastswf.com/ZqX10Ws)
That’s a really nice background. There might be too much color variation in the fog, but it’s a really nice start.
Basing it off [some of the stuff I’ve done?](http://www.pages.drexel.edu/~mmj29/temp/interface.swf) ;)
|
|
|
metadata
> *Originally posted by **[Draco18s](/forums/4/topics/313841?page=1#posts-6623820):***
> > *Originally posted by **[BobTheCoolGuy](/forums/4/topics/313841?page=1#posts-6623561):***
> >
> > My crazily advanced [entry](http://www.fastswf.com/eSIYtgM)
> >
> > On a bad note, I think swfs with telemetry enabled mess up fastswf because it changes the swf header information. Argh.
>
> I take it that that messed up header is what causes what I’m seeing?
>
> 
Ha ha, no actually – I basically just wanted to test Adobe Scout, so I threw some perlinnoise in front of a black circle. So the actual image is more or less correct.
What’s happening with some swfs is that the code that parses out the swf width and height is breaking and returning incorrect measurements, which is causing some server-side validations to fail and reject the swf upload all together.
|
|
|
metadata
Looks nice, Bob and RTL.
Draco, are you going to join us? You already have a good start with your perlin space.
* * *
I found another great article: [http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/](http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/)
That said, understanding and making my own implementation of either model would take me more time than what I think I’ll be able to free to work on this, so I guess I’m going for something simple, like a scrolling bitmap with a circular mask applied to it.
I’ll start working on it and see if I can have a barebones version ready before I go to sleep.
|
|
|
metadata
Actually, no I didn’t even see that Senekis XD. I was basing it off a tutorial I saw a long time ago on how to make something similar with Paint.Net.
**E:** So far, [this](http://www.fastswf.com/WwzhSmU) is what I have. I really can’t figure out what is causing the planet to seem to be behind the stars and fog. And obviously Earth is a placeholder, not procedurally generated.
Pertaining Code if anyone wants to look: [http://pastebin.com/eFctGaNJ](http://pastebin.com/eFctGaNJ)
|
|
|
metadata
Quickly rushed out [an entry](http://www.fastswf.com/PGu-YkQ) made in an hour or two because I love space so much.
|
|
|
metadata
m-m, Stage3D – sure enough it’ll be behind. I’ve read already that you cannot place Stage3D before Stage, where the stars are located.
|
|
|
metadata
[My current setup](http://www.fastswf.com/D0ibHeY) based off Jackon Dunstan Sphere
> *Originally posted by **[RTL\_Shadow](/forums/4/topics/313841?page=1#posts-6625043):***
> **E** : I got started on the background, no planet yet but I’m happy with the stars and space fog. [Here you go.](http://www.fastswf.com/ZqX10Ws)
What’s this? [http://i.imgur.com/ZB98m.png?1](http://i.imgur.com/ZB98m.png?1)
|
|
|
metadata
> *Originally posted by **[Senekis93](/forums/4/topics/313841?page=1#posts-6625007):***
>
> Draco, are you going to join us? You already have a good start with your perlin space.
No. I would, but I don’t really have the time.
|
|
|
metadata
> *Originally posted by **[Kewry](/forums/4/topics/313841?page=1#posts-6625890):***
>
> What’s this? [http://i.imgur.com/ZB98m.png?1](http://i.imgur.com/ZB98m.png?1)
An upside-down view of America.
|
|
|
metadata
> *Originally posted by **[Elyzius](/forums/4/topics/313841?page=1#posts-6626126):***
> > *Originally posted by **[Kewry](/forums/4/topics/313841?page=1#posts-6625890):***
> >
> > What’s this? [http://i.imgur.com/ZB98m.png?1](http://i.imgur.com/ZB98m.png?1)
>
> An upside-down view of America.
And the black thing?
|
|
|
metadata
After studying the object with a spectrum analyzer, scientists at NASA have concluded that it is a dick.
|
|
|
metadata
> *Originally posted by **[Elyzius](/forums/4/topics/313841?page=1#posts-6626404):***
>
> After studying the object with a spectrum analyzer, scientists at NASA have concluded that it is a dick.
Heh. Don’t judge me- i was bored.
|