ID:153858
 
Ok, I'm not sure if this belongs here or another forum, but I'm putting it here anyways.
What are some of the general phsyics that would be required for a space shuttle? I know I'd need a form of gravity, and some form of weight to thrust forumala, but I'm not sure how to get about doing this.
Also, What kind of mathematics would be required for an AI space combat system? and would they be possible in BYOND?
any help is appreciated, thanks!
-yamamushi
It depends on how you want the AI to work, but some form is definately possible in BYOND. I'd hope you'd use pixel movement, which would require [simple] trigonometry. I haven't made a space game on BYOND, but (when I have made space games off BYOND) I usually have two vars for speed, one for x and one for y. Since there is theoretically no friction, you wouldn't naturally slow down besides objects' gravitational forces. You could probably have a simple routine to check all objects that generate a substantial gravitational pull within a certain range, and "thrust" in that objects direction proportional to your distance from it.
In response to OneFishDown
Also, the acceleration is expressed in the simple formula:

a = f / m
acceleration = force / mass

So if you have an engine with a 1 Newton (1 meter/kg/s/s) and a 100 kilogram ship, then your ship would accelerate at 1/100th of a meter per second. It's probably most convenient to use Newtons for thrust and kilograms for mass, since those are the commonly accepted physics units.
In response to Garthor
l * w * h = v :-D
In response to Daemon5532
Thank your for that totally irrelevent geometry formula.
In response to Daemon5532
thanks, for the l*w*h = v, I never knew the formula for volume could go as far as solving all my problems, even world hunger and deforestation!



j/k
If the objects that are creating the noticeable gravitational fields are stationary, you could map out the gravitational fields in terms of acceleration vectors (x and y) which is independent of the mass of the spaceship.

F = G*m1*m2/r^2
This is the equation for the gravitational force between two objects where m1 is the spaceship (in this case), m2 is the mass of the planet (or other massive object), G is the gravitational constant 1.67*10^-23 (I believe), and r is the distance between them.

Thus:
F/m1 = G*m2/r^2

Using one of Newton's laws of motion (can't remember which):
F = m1*a
Thus:
a = F/m1

Combining the two gives:
a = G*m2/r^2

This can be calculated for each turf ahead of time since it is only based upon the distance to the turf and the mass of the planet. This is actually the magnitude of the acceleration but you could convert it into x and y components fairly easily.

Then, for each tick add the acceleration vector of the ships current location to the ships velocity.

If the planets are moving then of course you couldn't calculate the values for each turf ahead of time and would have to do it on the fly (using the same equations).
*has rewriten this post like 5 times now as she remembers bits from her physics classes in HS >.<;;;;*

To bring it down to its basic points, you need gravity and intertia o.o

To calculate gravity you use:

Force of Gravity = MassA * MassB
Gravitational Constant* -------------
Distance^2

^2 means to the second power, remember yer bedmas too o.o

You could prolly ditch the Gravitation Constant as well if you truly wanted to o.o -true- physics games tend to wind up very, very boring x.X;

Intertia (momentum)

This one is fairly simple.

Interia = Mass * Velocity

Simply said, if you want to move something, you're gonna haveta go against its current movement (or lack therof) o.o

As an extention of Interia though, you're also going to want to include a meathod of determining interia and direction from a collision between 2 bodies o.o (and prolly use gravity in there as well ^_~ )

Uhm.. I just saw a formula that did at least part of that, but I cant find it now x.X; Suffice it to say that the formula's are out there and that putting them together actually might not be -that- hard o.o

Uhm.. yea o.o Ill stop before I have to rewrite this a 6th time x.X;


El o.o
In response to Elorien
While you're all thinking of gravitiational constants and such, remember that due to the minute forces of gravity emmitted by everything, staying still is impossible in space.

Also, dur to the meters per second per second, they are accelerating 1/100th of a meter per second, so in 100 seconds, you'd be going a meter a second.
In response to Hazman
Gravity gets negligible pretty quickly (due to it being inversely proportional to the square of the distance) so you pretty much can stay still in space (of course this depends on where you are in relation to other objects). If you move a foot in 1,000 years you are basically not moving for most considerations.
In response to English
Right. OK. The gravity may be neglibable, but if you apply thrust, you can't apply exactly the same amount of backwards thrust.
In response to Hazman
And that is why we have computers doing it for us.
In response to Hazman
Sure you can -- you'll apply exactly the same amount of reverse thrust and wind up travelling at the same negligible velocity you were before.

For purposes of computers and processing power, it's extremely useful to ignore gravity if it affects something by less than 0.01 G. In other words, less than 0.049 m/s/s.
In response to Spuzzum
This is just a tad OT compared to the original thread, but oh well >:P

Relitavity is just that, relative. As far as movment goes, theres no real way to find out if you arent moving at all. Even just sitting there in front of your computer your moving. The earth is turning in circles on its axis, the earth is rotating around the sun, the sun is rotating around the galaxy, the galaxy is moving outwords from the center of the universe (as far as we can tell, who knows, maybe everythings moving off in one direction and the stuff that looks like its actually moving the opposite direction is just moving more slowly then we are)

Theres no real way to plot your position, exept in relation to other objects. ^^ It is theoriticaly possible to come to a complete stop, but how can you ever be sure? ^_^

Kinda makes it simple for a game though. ^_^ Specially when the math is already there for you to use *L*

El