Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-24-2008, 04:55 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Planetary system

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.
Attached Thumbnails
Click image for larger version

Name:	orbit.png
Views:	332
Size:	36.3 KB
ID:	45665   Click image for larger version

Name:	orbit2.png
Views:	300
Size:	37.2 KB
ID:	45666   Click image for larger version

Name:	orbit3.png
Views:	286
Size:	14.7 KB
ID:	45667  
Attached Images
 
Attached Files
File Type: txt orbit.txt (15.4 KB, 368 views)

Last edited by DrakilorP2P; 08-25-2008 at 01:04 PM.. Reason: Shortened. Taking conservative approach before edit time runs out.
Reply With Quote
  #2  
Old 08-24-2008, 05:01 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
The 'toggle rotation' effect is very nice.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #3  
Old 08-24-2008, 05:35 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
That dog was kinda cool. Do I have to make a serious comment...?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #4  
Old 08-24-2008, 05:43 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Niiiice
Reply With Quote
  #5  
Old 08-24-2008, 06:01 PM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
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 View Post
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?
__________________
Reply With Quote
  #6  
Old 08-25-2008, 02:49 AM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by Crono View Post
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!
Attached Files
File Type: txt orbit.txt (15.4 KB, 250 views)
Reply With Quote
  #7  
Old 08-24-2008, 06:03 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
I'm sure he was joking on both accounts, lol.
Reply With Quote
  #8  
Old 08-24-2008, 06:59 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Pretty nice :O

I need to rep you twice now.. hmm
__________________
Reply With Quote
  #9  
Old 08-25-2008, 02:55 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Very, very nice!
__________________
Reply With Quote
  #10  
Old 08-25-2008, 03:09 AM
DarkReaper0 DarkReaper0 is offline
No.
DarkReaper0's Avatar
Join Date: May 2005
Location: Texas,USA
Posts: 344
DarkReaper0 will become famous soon enough
Send a message via MSN to DarkReaper0
-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.
Reply With Quote
  #11  
Old 09-12-2008, 08:48 PM
Vimerge Vimerge is offline
Banned
Join Date: Sep 2007
Posts: 628
Vimerge will become famous soon enough
Holy crap, this is awesome.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:36 AM.


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