The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => Starbase Café => Topic started by: jaychant on March 24, 2009, 11:26:09 pm



Title: UQM collisions
Post by: jaychant on March 24, 2009, 11:26:09 pm
As I've mentioned before, I'm making a top-down arcade space game which takes a lot of inspiration from SC2.

To keep it simple, how does UQM handle collisions? Meaning, what approximately happens when two things collide? I'm ready for something extremely complicated or even just direction at where it is in the source code.


Title: Re: UQM collisions
Post by: Alvarin on March 25, 2009, 07:17:56 pm
Seing noone has answered this yet , I'll put my cent in - I do not know how the SC2 code approaches this issue and don't remember the exact physics formula for it , but what you do is momentum - multiplication of mass and velocity for each object , and then the lighter object will get bigger potion of the impulse , divided by mass will give the new speed ... I really can't remember the exact measures and how to calculate new directions , but well ... it's at least SOME answer ...
Hope it helps , i'll try to find the exact math tomorrow ...


Title: Re: UQM collisions
Post by: Dragon on March 26, 2009, 10:15:47 am
I don't know how UQM does it but you can try googling "rigid body dynamics" or "rigid body simulation".  You might have to include 2D in the search.  The math'll get a bit hairy though.

I'd suggest approximating the colliding objects as circles and ignore torque completely.  It'll keep it much simpler.


Title: Re: UQM collisions
Post by: Alvarin on March 26, 2009, 11:51:39 am
Exactly what I thought as well .
Here is the article , in quite an easy language and the math is not that difficult .
The  article has the two colliding object as a "point" , meaning no torque will be applied , no deformation of the bodies and no energy loss to heat .

http://www.director-online.com/buildArticle.php?id=460


Title: Re: UQM collisions
Post by: jaychant on March 26, 2009, 09:26:51 pm
Thanks guys! :)


Title: Re: UQM collisions
Post by: Death 999 on March 30, 2009, 11:14:03 pm
In case you're wondering why no torque (spinning due to colliding off-center), I remember trying to solve this problem for Intermelee, an aborted SC1-imitator. Well, I solved the problem. The problem was the data it needed as input.
Doing collisions with torque was really hard on the engine. You need to know the specific point of impact and the orientation of the interface.

If those are acquirable in a reasonable time within your code, then including torque is not that bad, and would make the game much more realistic. I don't know whether that'd make it play better, though.


Title: Re: UQM collisions
Post by: jaychant on March 31, 2009, 01:45:38 am
I don't think I'll use torque... I don't see a point; it's WAY too complicated for my third official game (or fourth, depending on the circumstances), and it would add very little gameplay (actually it could be irritating. An asteroid bumps into you, and it messes up your aiming! Plus, the opponent could make it impossible to turn in their direction, which would be very frustrating).


Title: Re: UQM collisions
Post by: Alvarin on March 31, 2009, 06:59:10 am
Well , if you ARE going to use torque , than you probably should use deformation also and concider crue loss due to deformation and suffocation from environment loss . Oh and if one ship frontally collides and has fromt mounted weapon it will need time to repair it . And remove all in-game sound , it's not possible in vacuum ... And I can think of multitude of such things ...


Title: Re: UQM collisions
Post by: Death 999 on March 31, 2009, 04:35:08 pm
scale of complexity, lower is harder
uniform motion, no accelerations
|
Spin-free motion
|
Torque
|
|
|
|
|
deformation


Title: Re: UQM collisions
Post by: jaychant on March 31, 2009, 09:35:32 pm
Well , if you ARE going to use torque , than you probably should use deformation also and concider crue loss due to deformation and suffocation from environment loss . Oh and if one ship frontally collides and has fromt mounted weapon it will need time to repair it . And remove all in-game sound , it's not possible in vacuum ... And I can think of multitude of such things ...

My goal isn't to make my game realistic, it's to make it fun. It may be true that you don't really hear sounds in space, but that would be rather boring, don't you think? Have you ever tried playing UQM without sound? It's not super-horrible if you have music, but it's not really very fun either.


Title: Re: UQM collisions
Post by: Alvarin on March 31, 2009, 10:46:28 pm
Sorry , forgot to use [sarcasm] tag in previous post .