Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Lode

Relativity, lightspeed and COMPUTER GAMES!

This topic is 5978 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve got a big problem! I''m going to make a space combat game that has a huge space with lots of stars. But I want it to be physically accurate (constant velocity, engines and gravitation will accelerate your ship, and so on). I''m also going to implement relativity. Please try to understand what I''m saying now because this is a part of my question: In my game, there will be NO ABSOLUTE REFERENCE POINT! All the stars will be moving, each star with it''s own velocity. The velocity of your ship can only be measured RELATIVE to one of the stars or an enemy ship, and because each star/ship is moving, your speed will be different compared to each star. The computer will use an absolute coordinate system internally, but this will be HIDDEN for the player, the player will never know where he is or when he''s standing still according to the absolute computer coordinate system. A player can only stand still according to one star, but then again he''s moving according to another star because that star has another velocity. There will be different races in my game, humans, aliens, I haven''t invented names yet so I''ll take an example race A and race B. Both races need to invent a way to determinate their position in space, and they both do this RELATIVE to a certain star, but again this star is moving so their coordinate system isn''t absolute but what else can they do in a relative world? And, race A and race B use a different star for their coordinate system so this is another proof that there''s nothing absolute. I repeat one more time: everything is relative, you can only measure your velocity relative to a star that is moving by itself already, and nothing can stand still because you always have to compare it to other things that all move in different directions. Now, I want to implement a maximum LIGHTSPEED in my game. The closer you go to lightspeed, the more energy the engines of your ship require to accelerate, the slower your time goes (you''ll see the enemies going faster because your time goes slower), and you will become longer (or: you''ll see space being contracted). BUT HERE IS MY PROBLEM!!! Against what do I have to compare this lightspeed!! Every star is moving and there''s no absolute reference point, so how do I have to see when lightspeed is reached? Because, as I said above, you can''t measure your speed, you can only measure it against another object, a star, planet or enemy ship, so in other words I have to choose a certain object (e.g. enemy ship) to compare my speed at, but then the movement of this ship will determinate lightspeed and if I''d have chosen another ship or star there would have been another lightspeed. I want this to be like in real space and, heh, against what is lightspeed compared there? I hope you understand this! Please, is there someone with Einstein-ambitions who can help me? Thanks a lot!!!!! (Sorry for all the capitals and exclamations)

Share this post


Link to post
Share on other sites
Advertisement
Well, actually in Newtonian physics, there is no absolute reference point either. My advice would be to skip the light speed thing. It would be complicated, slower, and not really noticeable unless you got really fast. Here''s the thing. If you were going at light speed, everything else would be going by you so fast, that the human would not be able to interact with it. You could argue that it is possible to set the value c to be a lesser value, in which case the effects would become noticeable. However, it would be weird, and not physically accurate, which is what I assume you are going for.



That being said... if you are going to do this, you need to know some basic special relativity (general relativity is kinda tough without a lot of math background!).

When we say that something is going at near lightspeed, we mean that it is going at near lightspeed according to our reference frame. This means that I, the observer, will always have a speed of zero, and the speed that I perceive an object to be going at will not necessarily be the speed that another observer sees it to be going at. Einstein''s theory says that if something is actually travelling at c, all observers see it travelling at c no matter how fast they are going. This theory is really weird!!

Hypothetically, let''s say I was at rest (which I always am from my perspective) and suppose I see a spaceship flying to my right at almost light speed, and I see a spaceship flying to my left at almost light speed. My logical conclusion (based on Newtonian physics) would be that if I were in one of the spaceships, I would see the other spaceship going at twice light speed. What actually happens, is that if I were to boost to the reference frame of that other spaceship, it would be going at almost light speed.

Finally, as far as math equations go, if you consider time to be an extra dimension, things always travel at light speed through that 4-dimensional space. Don''t forget, even in S.R., if I see you travelling forwards with some speed, you will see me travelling backwards with the same speed.


Sorry this is so long... =)

Share this post


Link to post
Share on other sites
quote:
Original post by Lode
I''ve got a big problem!

I''m going to make a space combat game that has a huge space with lots of stars.


I''ve heard space is big.
quote:

In my game, there will be NO ABSOLUTE REFERENCE POINT! All the stars will be moving, each star with it''s own velocity. The velocity of your ship can only be measured RELATIVE to one of the stars or an enemy ship, and because each star/ship is moving, your speed will be different compared to each star.

The computer will use an absolute coordinate system internally, but this will be HIDDEN for the player, the player will never know where he is or when he''s standing still according to the absolute computer coordinate system. A player can only stand still according to one star, but then again he''s moving according to another star because that star has another velocity.


Frontier: Elite 2 already did this. Not that that means you can''t, because it ought to be done more often.

How will the stars move? Will they just rotate around the galaxy''s centre, or will you simulate gravity? If you do, how will you deal with simulating the gravitational interactions between billions of objects? Even without gravity, how will you move billions of objects each game tick?
quote:

......
Against what do I have to compare this lightspeed!! Every star is moving and there''s no absolute reference point, so how do I have to see when lightspeed is reached?


Lightspeed isn''t ever reached - no matter how long you accelerate for, you''ll never measure your speed to be lightspeed relative to any other object (apart from light itself, which, of course, always moves at lightspeed).
quote:

Because, as I said above, you can''t measure your speed, you can only measure it against another object, a star, planet or enemy ship


You can measure your speed - it''s just that the laws of physics don''t allow for absolute speed. Bare in mind that it isn''t that reality keeps a hidden absolute speed like a game would, there simply is no absolute speed - all speed is relative.
quote:

, so in other words I have to choose a certain object (e.g. enemy ship) to compare my speed at, but then the movement of this ship will determinate lightspeed and if I''d have chosen another ship or star there would have been another lightspeed. I want this to be like in real space and, heh, against what is lightspeed compared there?


In real space, lightspeed is compared against anything - everyone measures the speed of light to be the same, regardless of their speed relative to other objects. The light-barrier is not like the sound-barrier - it cannot be broken. You can accelerate at 1g long enough that your speed ought to be many times that of light, and you won''t notice anything odd happening locally (although look outside and there''ll be a different story - the universe would probably be in heat-death mode). If you measure your speed relative to anything nearby, you''ll never find your speed to be greater than, or even equal to, that of light. Although you''ll be travelling vast distances from a global perspective, from your point of view the outside universe is compressed into a thin slice: what looks like light-millenia from the outside looks like millimetres to you.

But, are you sure you want to simulate relativity? It can introduce timing issues that are difficult to resolve. It''s also literally impossible to make a multiplayer game that does relativity unless your players have access to a time machine.



Just Plain Wrong

Share this post


Link to post
Share on other sites
quote:

Against what do I have to compare this lightspeed!!
Every star is moving and there''s no absolute reference
point, so how do I have to see when lightspeed is reached? Because, as I said above, you can''t measure
your speed, you can only measure it against another
object, a star, planet or enemy ship, so in other words
I have to choose a certain object (e.g. enemy ship) to compare my speed at, but then the movement of this ship
will determinate lightspeed and if I''d have chosen
another ship or star there would have been another
lightspeed. I want this to be like in real space and,
heh, against what is lightspeed compared there?


You can compare it against anything. In particular it might be convenient to compare it to the star a ship departs from or anything else along the way. The lorentz transformation guarantees that if you''re travelling below the speed of light in one reference frame, then you''ll be travelling below the speed of light in any other.

And if you happened to be massless and were travelling at the speed of light, then you''d be measured as travelling at the speed of light in any reference frame (including your own) so there is no "another lightspeed"

One thing I''m unable to figure out is how you''d calculate how much acceleration a ship''s engines are able to impart because, as you mentioned, the inertial mass of the ship depends upon velocity so with a fixed amount of thrust the acceleration becomes less and less. I might have to get out my relativity book.

Make sure you have understood and played around with the lorentz transformation. All of special relativity is just simple algebra. It''s the consequences that are difficult to grasp.

Share this post


Link to post
Share on other sites
Ok one more thing:

if the player goes close to lightspeed, will he:
A) because he goes so fast, his time goes slower, and thus the player sees the time of the rest of the universe go faster (and when he stops, he''s younger than ships that didn''t fly so fast).
OR
B) the player thinks he''s hanging still and the rest of the universe is flying at lightspeed, so the player sees the time of the rest of the universe go slower and his own time go faster (so when he stops he''s older than ships that didn''t fly so fast).
?


To answer some comments:
-There won''t be a multiplayer (Max Payne''s bullet time is also impossible in multiplayer)
-I think I''ll let some stars rotate around each other, and let the whole thing rotate around a big, dangerous black hole.
-I want lightspeed in the game, to prevent the player to go from one solar system to another by just accelerating. Instead, he has to use a "subspace modus" that uses a very expensive fuel but brings you from one point to another in a few seconds.

Share this post


Link to post
Share on other sites
Hi!

I''m no expert on Einsteinian physics (or general physics) so I might have misunderstood this in part or whole, but I''ll do
my best to supply what I know.

quote:
Lode wrote
...
The closer you go to lightspeed, the more energy the engines of your ship require to accelerate,
...



Yes, this is true as a result of the increase of mass. A body in motion (hereafter known as X), in respect to a referencesystem (A), will get heavier when seen from THAT REFERENCESYSTEM. The formula for this is

m = m0 / sqrt(1-(v^2/c^2))
m0 = mass of X at rest (in respect to A)
v = velocity (in respect to A)
c = speed of light

Now substitute this into Newtons formula for acceleration
a = F / m

This will also solve your lightspeed problem as when the velocity (v) approaces speed of light (c) the mass will go to
infinity (and thus the acceleration will be 0).

quote:

if the player goes close to lightspeed, will he:
A) because he goes so fast, his time goes slower, and thus the player sees the time of the rest of the universe go faster (and when he stops, he''s younger than ships that didn''t fly so fast).
OR
B) the player thinks he''s hanging still and the rest of the universe is flying at lightspeed, so the player sees the time of the rest of the universe go slower and his own time go faster (so when he stops he''s older than ships that didn''t fly so fast).



Both this is true. As before it has to do with which referencesystem one uses. If a astronaut travels at near lightspeed in respect to the earth we who are on earth sees that the time slows down for the astronaut while he sees it slow down for us (as it''s we who are moving in reference to him).
Another thing you have to consider when travelling around lightspeed is that Einsteins special relativity doesn''t comply to objects in acceleration or gravitional fields. If that''s the case you have to use the (much) more complicated theory of general relativity.

quote:

...
will you simulate gravity? If you do, how will you deal with simulating the gravitational interactions between billions of objects?
...


I don''t think it''s even possible to do that. IIRC it''s impossible to simulate (exactly) gravitiy (using Newtons formulas) for even more than two objects. Maby you could approximate it, but to do the calculations in realtime for more than a few object I think is impossible. (if you''re not an owner of a Cray or something like that).
As you are already dealing with Einstein and relativity you also has to use the formulas of the general theory of relativity to calculate gravitational forces, which makes it even worse.

You also has to consider that the general relativity imply that heavy objects (big gravitational sources) like stars affect the 4-dimensional space-time.

This become a long post, but I hope it straighted some questions.
If you want to read more I recommend
http://www.newtonphysics.on.ca/EINSTEIN/index.html
http://www.modernrelativity.com/


BR
Mårten Svanfeldt
Sweden

Share this post


Link to post
Share on other sites
My aim is to implement a game with relativity - although i want to put it in a normal game :-) Physical perfection people :-)

anyway, if you were to do the gravity thing, I have several points which, are my points so may not be completely accurate or anything, so don''t flame me :-)

a) Most of the stars gravity point could be computed non-real time, as they are not going to noticeably change.

b) If they were, you would only ever need to change it when going to high speeds, so you could calculate it then

c) you could do just an approximation of gravity ( single point center of mass, etc)

d) THe universe would HAVE to be generated procedurally ( imagine designing a billion stars ) but also used procedurally at run time, because of storage space ( for a billion stars, storing 1 bit per star, 119mb, 1 byte per star, about a gigabyte).

e) With it generated procedurally, you would have to store them all in order to move them around.

My overall aim is still to make an epic space game :-) I will just have to generate EVERYTHING procedurally, and not have moving centers.

Note: I can actually think of a couple of ways to give a vague impression of moving, procedural galaxies

Share this post


Link to post
Share on other sites
quote:
Original post by Lode
-There won''t be a multiplayer (Max Payne''s bullet time is also impossible in multiplayer)


Hmm. How did they justify the existence of bullet-time in MP and especially The Matrix? Obviously, it makes everything "slow down" relative to the observer, but that almost implies that the observer (the person experiencing bullet-time) is causing the slowdown. Even "freeing your mind" wouldn''t make things slow down, since they''d have to slow down relative to their former selves in order for them to appear slowed-down to you.

Later,
ZE.



//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[if you have a link proposal, email me.]

Share this post


Link to post
Share on other sites
Or not. Maybe they''re executing at their normal rate and when you entered bullet-time, you''d appear to be moving super-fast relative to them...

Share this post


Link to post
Share on other sites
Well to play a bullet time game in multiplayer you''d need steroïds like in Duke Nuke''m

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!