PGGC #3: Planet

Subscribe to PGGC #3: Planet 85 posts

avatar for Senekis93 Senekis93 4090 posts
Flag Post


                         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.

 
avatar for UnknownGuardian UnknownGuardian 8142 posts
Flag Post

*Theme is not cities for anyone who saw this prior to this post. It is planet. I corrected the OP.

 
avatar for feartehstickman feartehstickman 521 posts
Flag Post

That is a trippy header pic.

Wait, what:
Title: PGGC #3: Planet

Originally posted by Senekis93:
Theme: Cities


UG’s on it

 
avatar for Senekis93 Senekis93 4090 posts
Flag Post

My bad. Thanks for editing it, UG.
Copy-pasting is evil.

 
avatar for Senekis93 Senekis93 4090 posts
Flag Post

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
Happy coding.

 
avatar for UnknownGuardian UnknownGuardian 8142 posts
Flag Post

Who said a planet had to be spherical?

EDIT Anyone remember Spin the World?

 
avatar for Senekis93 Senekis93 4090 posts
Flag Post

I do. (:

And yes, that’s a good point. Planets don’t need to be spheres.

 
avatar for ErlendHL ErlendHL 1313 posts
Flag Post

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

 
avatar for Ace_Blue Ace_Blue 1091 posts
Flag Post
Originally posted by ErlendHL:

Edit 2: Found this

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);
		}
	}
}
 
avatar for vesperbot vesperbot 1849 posts
Flag Post

I wonder, if I’d do the majority of work via shaders, will it count? The shaders, of course, will be of my authoring.

 
avatar for BobTheCoolGuy BobTheCoolGuy 3757 posts
Flag Post

My crazily advanced entry

On a bad note, I think swfs with telemetry enabled mess up fastswf because it changes the swf header information. Argh.

 
avatar for Draco18s Draco18s 6860 posts
Flag Post
Originally posted by BobTheCoolGuy:

My crazily advanced entry

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?

 
avatar for RTL_Shadow RTL_Shadow 1023 posts
Flag Post
Originally posted by Draco18s:
Originally posted by BobTheCoolGuy:

My crazily advanced entry

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.

 
avatar for Draco18s Draco18s 6860 posts
Flag Post
Originally posted by RTL_Shadow:
E: I got started on the background, no planet yet but I’m happy with the stars and space fog. Here you go.

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? ;)

 
avatar for BobTheCoolGuy BobTheCoolGuy 3757 posts
Flag Post
Originally posted by Draco18s:
Originally posted by BobTheCoolGuy:

My crazily advanced entry

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.

 
avatar for Senekis93 Senekis93 4090 posts
Flag Post

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/

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.

 
avatar for RTL_Shadow RTL_Shadow 1023 posts
Flag Post

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 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

 
avatar for Feffers Feffers 247 posts
Flag Post

Quickly rushed out an entry made in an hour or two because I love space so much.

 
avatar for vesperbot vesperbot 1849 posts
Flag Post

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.

 
avatar for Kewry Kewry 98 posts
Flag Post

My current setup based off Jackon Dunstan Sphere

Originally posted by RTL_Shadow:
E: I got started on the background, no planet yet but I’m happy with the stars and space fog. Here you go.

What’s this? http://i.imgur.com/ZB98m.png?1

 
avatar for Draco18s Draco18s 6860 posts
Flag Post
Originally posted by Senekis93:


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.

 
avatar for Elyzius Elyzius 235 posts
Flag Post
Originally posted by Kewry:

What’s this? http://i.imgur.com/ZB98m.png?1

An upside-down view of America.

 
avatar for Draco18s Draco18s 6860 posts
Flag Post
Originally posted by Elyzius:
Originally posted by Kewry:

What’s this? http://i.imgur.com/ZB98m.png?1

An upside-down view of America.

And the black thing?

 
avatar for Elyzius Elyzius 235 posts
Flag Post

After studying the object with a spectrum analyzer, scientists at NASA have concluded that it is a dick.

 
avatar for RTL_Shadow RTL_Shadow 1023 posts
Flag Post
Originally posted by Elyzius:

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.