Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 2 [3]
  ignore  |  Print  
  Random thoughts: Extreme speed 2D physics  (Read 8944 times)
0 Members and 1 Guest are viewing this topic.
Offline theagentd
« Reply #60 - Posted 2012-05-04 17:07:04 »

Well, I was looking for input on how to do this, and everyone just said that I should use local coordinates + a baseline. Why make it more difficult than that?

Myomyomyo.
Offline matheus23

JGO Kernel


Medals: 98
Projects: 3


You think about my Avatar right now!


« Reply #61 - Posted 2012-05-04 17:10:01 »

On collision detection:

Your ideas, you wrote in the topic. Why don't you use them? these Ideas are really good...

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline delt0r

JGO Coder


Medals: 22


Computers can do that?


« Reply #62 - Posted 2012-05-09 13:00:05 »

Ok so i am bumping a sleepy thread.... But i spent some time on this in the weekend and decided to write it down for posterity.

Long story short, simulation of the larger bodies (planets, moons and stars) is a waste of time. Getting it to work well enough that planets don't get randomly ejected to plunged into the sun is hard for long term and tedious but more to the point, a total waste of time. Consider that parametric equations of motion would actually be more *accurate* that  a PhD thesis of simulation code. It is why we use it for 99.9% of real multiyear mission probe navigation and star finders etc. It is just that good.

Now for a game you don't need the full accuracy and if you are only going for 2d you can't get the accuracy anyway (2nd order effects include orbital plane drift). So either have just planets with circular orbits (dead easy) or got the proper ellipse equation of motion, which is not much harder. Doing the calculations are just some multiplies and a few sqrts to look up the state of anything at any time. You still need to use a local coordinate system centered on whatever the thing is orbiting. But errors don't accumulate, so round off errors don't really matter.

For space craft etc, using a integrator is what i would do... BUT this means some fairly complicated controller so that it can get to where you want it to go. Again this is accurate since it only cares about where the large things are which is also accurate and stable due to parametric equations of motion.  Large time steps could still work well and bobs your uncle it is all easy. Once a ship is in orbit, it is easy to calculate a new orbit with a "burn".

So at large scale you have stars. And shot scale you have planet systems. Since the scale factor between these is more than 100, they are effectively independent. 

Oh and the other day, i did a chart of all the  1000 closest stars and made it into a 2d map where it tried to preserve the distance between all the stars to be the same as in the 3d case. Interesting. There is a lot of stars out there.

I have no special talents. I am only passionately curious.--Albert Einstein
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline theagentd
« Reply #63 - Posted 2012-05-09 19:11:00 »

Yeah, I´ll use equations for the planets´/ moons´ orbits.

The AI of the game is probably the biggest problem I´ve found in this kind of simulation. How do I calculate a "burn" which gets the ship from one orbit to another?

Myomyomyo.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #64 - Posted 2012-05-09 19:26:11 »

How do I calculate a "burn" which gets the ship from one orbit to another?
There almost never is 1 burn that will do the job. It's annoying that the target is always moving. You can probably only simulate it, and converge to a solution.

Better yet: fake it, just like with the orbits of the planets. Calculate the rough trajectory and then pull the spacecraft in the orbit.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline theagentd
« Reply #65 - Posted 2012-05-09 19:31:01 »

How do I calculate a "burn" which gets the ship from one orbit to another?
There almost never is 1 burn that will do the job. It's annoying that the target is always moving. You can probably only simulate it, and converge to a solution.

Better yet: fake it, just like with the orbits of the planets. Calculate the rough trajectory and then pull the spacecraft in the orbit.
Yeah, I know. You would at least need two burns, but yeah. How does NASA do it? xD Faking it is just not very cool...

Myomyomyo.
Offline matheus23

JGO Kernel


Medals: 98
Projects: 3


You think about my Avatar right now!


« Reply #66 - Posted 2012-05-09 19:44:58 »

How do I calculate a "burn" which gets the ship from one orbit to another?
There almost never is 1 burn that will do the job. It's annoying that the target is always moving. You can probably only simulate it, and converge to a solution.

Better yet: fake it, just like with the orbits of the planets. Calculate the rough trajectory and then pull the spacecraft in the orbit.
Yeah, I know. You would at least need two burns, but yeah. How does NASA do it? xD Faking it is just not very cool...

Just fake it. You have a 2D game, thats fake enough Grin

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Online Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #67 - Posted 2012-05-09 19:47:11 »

Yeah, I know. You would at least need two burns, but yeah. How does NASA do it? xD Faking it is just not very cool...
My guess is that they simulate, adjust, simulate, adjust.

I'm not aware of any shortcuts...

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline delt0r

JGO Coder


Medals: 22


Computers can do that?


« Reply #68 - Posted 2012-05-09 21:14:14 »

Its a bit of both. It is a Hohmann transfer orbit for the most part. This is easy to calculate. This give a transfer with the least amount of propellant with the assumption that you very short burns.

Anything else is done just as Riven has said.

Cool example: The pioneer anomaly was caused by one side of the space craft being slightly hotter than the other. The photon pressure has pushed slightly more off course than was expected. Again too accurate for your case. 

I have no special talents. I am only passionately curious.--Albert Einstein
Offline Roquen
« Reply #69 - Posted 2012-05-10 05:28:45 »

Quote
Faking it is just not very cool...
On the contrary.  Multiplying your work and the computer's work load for something that nobody will notice...that would be uncool.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline theagentd
« Reply #70 - Posted 2012-05-10 07:14:30 »

Quote
Faking it is just not very cool...
On the contrary.  Multiplying your work and the computer's work load for something that nobody will notice...that would be uncool.
Who the hell do you think am?! Optimizing it would be like 75% percent of the fun! Besides, I still have a certain point to prove to Riven... Grin

Myomyomyo.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #71 - Posted 2012-05-10 08:11:03 »

I still have a certain point to prove to Riven... Grin
Oh, don't work your ass off on my behalf. I'm too occupied traveling through time at 1 s/s! w00t! Yawn

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline theagentd
« Reply #72 - Posted 2012-05-10 09:16:53 »

I still have a certain point to prove to Riven... Grin
Oh, don't work your ass off on my behalf. I'm too occupied traveling through time at 1 s/s! w00t! Yawn
Don´t be so full of yourself! Optimizing stuff is the best part of programming!

Myomyomyo.
Offline Roquen
« Reply #73 - Posted 2012-05-10 09:54:35 »

Even if you do the simplest model possible you won't be lacking in optimization opportunities.
Offline theagentd
« Reply #74 - Posted 2012-05-10 16:00:45 »

Even if you do the simplest model possible you won't be lacking in optimization opportunities.
We'll see... >=D

Myomyomyo.
Pages: 1 2 [3]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (63 views)
2014-04-15 18:08:23

BurntPizza (61 views)
2014-04-15 03:46:01

UprightPath (74 views)
2014-04-14 17:39:50

UprightPath (57 views)
2014-04-14 17:35:47

Porlus (75 views)
2014-04-14 15:48:38

tom_mai78101 (100 views)
2014-04-10 04:04:31

BurntPizza (160 views)
2014-04-08 23:06:04

tom_mai78101 (255 views)
2014-04-05 13:34:39

trollwarrior1 (208 views)
2014-04-04 12:06:45

CJLetsGame (215 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!