Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Galaxy generator in 20 lines of code!

Author
Message
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 6th Oct 2007 10:24
This creates a galaxy the size of the screen depending on the parameters you enter into it:



I have included a .PNG image as well, as .PNG files don't lose any quality.

I can't be bothered to invent a signature

Attachments

Login to view attachments
aluseus GOD
17
Years of Service
User Offline
Joined: 19th Mar 2007
Location: I\'m here. Now I\'m there. I keep moving
Posted: 7th Oct 2007 02:41
its not that exciting....

Not even a strait suit, you, caramel, the recycling bin, uber code, and chuck norris combined can keep me safe from me. Mostly cuz I exist.
Ankillito
17
Years of Service
User Offline
Joined: 10th Dec 2006
Location: Litigious California
Posted: 7th Oct 2007 09:00
well, i think it's kinda cool...

http://forum.thegamecreators.com/xt/xt_apollo_pic.php?i=1234759
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 7th Oct 2007 14:50
Quote: "its not that exciting...."

Can you do better?

I thought it was quite cool. I like how the colour changes too. Have you put it into the 20 Line Challenge board yet?

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 8th Oct 2007 14:40
Good work. I like it

[/center]
Jrock
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Riven
Posted: 9th Oct 2007 05:00
Excellent job


Practice makes perfect. But if nobody is perfect, why practice?
Kaitia
17
Years of Service
User Offline
Joined: 8th Sep 2007
Location:
Posted: 21st Oct 2007 17:47
Can you make space ships and put them in there?

''To program or not to program that is the question''
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 21st Oct 2007 18:47
The produced galaxies are 2D, but you can use the same algorithm to produce 3D ones. And if you wanted to, you could put space ships in there.

Your signature has been erased by a hyper-intelligent pan-dimensional being (a mod)
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 29th Oct 2007 22:12 Edited at: 29th Oct 2007 22:14
This is awesome!

Here, i added some randomness to it, and the ability to keep making galaxies :
(Press spacekey to generate another galaxy):


calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 30th Oct 2007 18:30
Thanks.

Here's the latest version (with which you can make different-coloured galaxies):

I have supplied it in function form so that you can use it easier.



Your signature has been erased by a hyper-intelligent pan-dimensional being (a mod)
Commander in Chief
18
Years of Service
User Offline
Joined: 15th Apr 2006
Location: Carbondale, PA, USA
Posted: 31st Oct 2007 22:53
Heh, I tried the original with 100 million (100,000,000) stars. Unfortunately, it was so slow that print screen wouldn't capture. Oh well.

Hardware: nVidia GeForce 8500GT 256mb, 240gb HD Space, Pentium 4 CPU 2.80GHz, 512mb RAM, Realtek HD Audio
Software: 3Ds Max 9, Adobe Photoshop CS, Adobe AfterEffects CS3
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 31st Oct 2007 23:28
Try put that function in loop

It makes some intresting results indeed.

[center]

Click for details!
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 2nd Nov 2007 02:28
I've just added my galaxy generator to he codebase to see what you think of that one. I liked yours cos of the colours you've laid out.

Warning! May contain Nuts!
Gamer Making
18
Years of Service
User Offline
Joined: 20th Sep 2006
Location: sitting at the comp programming
Posted: 9th Nov 2007 03:45
nice job. Could use some improvements.

Bach Tran
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 12th Nov 2007 13:57
When I get round to it I'll be updating a lot of the code. Possibly so the user can zoom into the galaxy itself and view planets around the individual stars. This was just a first draft of the code.
If you have any other ideas for improvements I'll definately consider adding them.
I've got some other things I've been experimenting with.

Warning! May contain Nuts!
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 17th Nov 2007 22:17
Well here's an idea for this cool lil' thing. You should let the galaxy spin around. Keeping in mind the theory of super massive black holes at the center of each galaxy, you should have some stars that are too close get sucked in.

Keep up the good work.

Cheers,

-naota

"I'd newbie slap here, but I've no idea how far I'd need slap before they'd come back with a clue." - VanB
Aex.Uni forums

Login to post a reply

Server time is: 2024-11-22 13:21:15
Your offset time is: 2024-11-22 13:21:15