Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Planetary system (https://forums.graalonline.com/forums/showthread.php?t=81411)

DrakilorP2P 08-24-2008 04:55 PM

Planetary system
 
5 Attachment(s)
Thanks to Ziro (xXziroXx) for proof-reading this thread. He said he couldn't find much wrong with it, but since his opinion can't be trusted, I asked someone else who was quoted saying "Not funny."

Abstract:
It's a so called "physics engine" combined with a "graphics engine" in order to produce a rather excessively rapid simulation of a planetary system.
I originally tried to do this using Kepler's equations but that just gave me nightmares, so I settled for simple gravity, which can achieve the same thing.
The example setup creates a few planets which orbits around different axises with the immovable sun located at (0, 0, 0). You can alternatively make all bodies attract each other with gravity, allowing you to make moons. The problem with this is that it opens up a whole new can of worms stuffed with "Oh <deity>, I can't make them orbit for longer than twenty seconds."

Features:
  • Perspective projection giving an illusion of 3D.
  • Scaling according to your screen size (sort of, should work in most cases).
  • Rotation of the entire scene, revealing the planets to be made out of paper cutouts, which doesn't make sense but looks cool.
  • Anti-Newtonian gravity. If he saw that the gravitational constant equals one, he would choke on an apple.
  • Gimmicky object oriented programming that allows you to instantiate things you would never dream of instantiating. It's the paradigm of the year 3000!
  • Confusing z-x-z rotation.

No, I'm not releasing source code for anyone to just use without thinking. The attached document was accidentally posted and I don't know how to remove it. Don't read it! Forbidden knowledge, etc.

(The text that you have entered is too long (20830 characters). Please shorten it to 10000 characters long.)

Terms of use:
The origins of this script must be confused. Whenever you see fit to give credit, you must claim that you wrote it.
The most important rule to remember is that you must never attribute me. If you in anyway mention, hint, suggest or imply that I wrote this, I will connect to your server and say mean things to you.

Frequently asked questions that aren't really frequently asked since I just made them up:
Q: How do I spawn something?
A: yourWorld.newMass(position, velocity, massInKilograms);

Q: That's nice, but it always comes out as a white square.
A: The basic mass object doesn't include details about drawing. You must "derive" to do this. The example setup demonstrates this in newPlanet() and newCustomWorld(), which derives newMass() and newWorld() respectively. I didn't tell you about the gimmicky OOP just to be funny.

Q: What's up with renderer.color, renderer.rotate, renderer.translate etc?
A: These functions change certain variables which will affect all subsequent drawings, not unlike OpenGL. If you ever want to start from scratch, use yourRenderer.reset().

Q: Can I put players in orbit?
A: Technically, yes. I'm not going to do it for you. Make it a father-and-son-time of DIY so you'll have something to fight about. It'll be just like good old times.

Q: Sounds like fun! I'm going to remove //#CLIENTSIDE so it looks the same for everyone.
A: Please PM me your address so I can be the first to kill you.

Q: My planet's velocity breaches the speed of light when it gets really close to the sun. Isn't this impossible according to Einstein's special theory of relativity?
A: Einstein was a hobo. Are you going to listen to some chick on an Internet forum or a hobo? You're going to listen to me of course!

Q: Where do I test it?
A: Connect to Mythic Legends and type /startorbit. Reconnect to get out of there. If it's not working, stop reading old threads.

Peace out.

Tigairius 08-24-2008 05:01 PM

The 'toggle rotation' effect is very nice.

xXziroXx 08-24-2008 05:35 PM

That dog was kinda cool. Do I have to make a serious comment...?

Codein 08-24-2008 05:43 PM

Niiiice :D

Crono 08-24-2008 06:01 PM

Looks and sounds really nice.

You can remove unwanted attachments by clicking "Manage Attachments" and then "Remove", but I can't tell if you were just being sarcastic?

Quote:

Originally Posted by DrakilorP2P (Post 1417051)
A: Einstein was a hobo. Are you going to listen to some chick on an Internet forum or a hobo? You're going to listen to me of course!

You sure this was proof read? ;)

Codein 08-24-2008 06:03 PM

I'm sure he was joking on both accounts, lol.

Chompy 08-24-2008 06:59 PM

Pretty nice :O

I need to rep you twice now.. hmm

DrakilorP2P 08-25-2008 02:49 AM

1 Attachment(s)
Quote:

Originally Posted by Crono (Post 1417072)
You can remove unwanted attachments by clicking "Manage Attachments" and then "Remove", but I can't tell if you were just being sarcastic?

its not working HELP!

cbk1994 08-25-2008 02:55 AM

Very, very nice!

DarkReaper0 08-25-2008 03:09 AM

-Standing Ovation-

I now have something to stare at for hours yet again!

Quote:

Q: Sounds like fun! I'm going to remove //#CLIENTSIDE so it looks the same for everyone.
A: Please PM me your address so I can be the first to kill you.
rofl.

Vimerge 09-12-2008 08:48 PM

Holy crap, this is awesome.


All times are GMT +2. The time now is 02:22 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.