The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
October 05, 2024, 04:32:58 am
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  Starbase Café (Moderator: Death 999)
| | |-+  UQM collisions
« previous next »
Pages: [1] Print
Author Topic: UQM collisions  (Read 2829 times)
jaychant
*Smell* controller
****
Offline Offline

Gender: Male
Posts: 432


Please visit my homepage


View Profile WWW
UQM collisions
« 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.
Logged

Please visit my homepage.
Alvarin
Enlightened
*****
Offline Offline

Gender: Male
Posts: 799



View Profile
Re: UQM collisions
« Reply #1 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 ...
Logged
Dragon
Frungy champion
**
Offline Offline

Posts: 86



View Profile
Re: UQM collisions
« Reply #2 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.
Logged
Alvarin
Enlightened
*****
Offline Offline

Gender: Male
Posts: 799



View Profile
Re: UQM collisions
« Reply #3 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
Logged
jaychant
*Smell* controller
****
Offline Offline

Gender: Male
Posts: 432


Please visit my homepage


View Profile WWW
Re: UQM collisions
« Reply #4 on: March 26, 2009, 09:26:51 pm »

Thanks guys! Smiley
Logged

Please visit my homepage.
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3874


We did. You did. Yes we can. No.


View Profile
Re: UQM collisions
« Reply #5 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.
Logged
jaychant
*Smell* controller
****
Offline Offline

Gender: Male
Posts: 432


Please visit my homepage


View Profile WWW
Re: UQM collisions
« Reply #6 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).
Logged

Please visit my homepage.
Alvarin
Enlightened
*****
Offline Offline

Gender: Male
Posts: 799



View Profile
Re: UQM collisions
« Reply #7 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 ...
Logged
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3874


We did. You did. Yes we can. No.


View Profile
Re: UQM collisions
« Reply #8 on: March 31, 2009, 04:35:08 pm »

scale of complexity, lower is harder
uniform motion, no accelerations
|
Spin-free motion
|
Torque
|
|
|
|
|
deformation
Logged
jaychant
*Smell* controller
****
Offline Offline

Gender: Male
Posts: 432


Please visit my homepage


View Profile WWW
Re: UQM collisions
« Reply #9 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.
Logged

Please visit my homepage.
Alvarin
Enlightened
*****
Offline Offline

Gender: Male
Posts: 799



View Profile
Re: UQM collisions
« Reply #10 on: March 31, 2009, 10:46:28 pm »

Sorry , forgot to use [sarcasm] tag in previous post .
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!