Pages: [1]
|
|
|
Author
|
Topic: A strange bit of combat physics (Read 3694 times)
|
Shiver
Guest
|
Take a look at lines 70-77 of ship.c in UQM 0.6.2:
else if (TravelAngle == CurrentAngle && (StarShipPtr->cur_status_flags & (SHIP_AT_MAX_SPEED | SHIP_BEYOND_MAX_SPEED)) && !(StarShipPtr->cur_status_flags & SHIP_IN_GRAVITY_WELL)) { // already maxed-out acceleration return (StarShipPtr->cur_status_flags & (SHIP_AT_MAX_SPEED | SHIP_BEYOND_MAX_SPEED)); } I've been playing melee competitively for a long time and I wasn't even aware the game did this until I started poking around with the game's ship code myself. It's rare for a ship to perform a gravity whip without being nudged by the gravity well upon exiting it or for a ship to not turn at all before attempting to slow down. When this code does kick in, it will prevent a ship from slowing itself back down to default speed and screw over the unsuspecting player. Not knowing about this code until yesterday, I get the feeling I have had ships destroyed by it without understanding what went wrong.
Fossil was the one that pointed me to this code in the first place. He also gave me this fix:
else if (TravelAngle == CurrentAngle && (StarShipPtr->cur_status_flags & (SHIP_AT_MAX_SPEED | SHIP_BEYOND_MAX_SPEED)) && !(StarShipPtr->cur_status_flags & SHIP_IN_GRAVITY_WELL)) { // already maxed-out acceleration SIZE delta_x, delta_y; SIZE cur_delta_x, cur_delta_y; DWORD current_speed; thrust_increment = WORLD_TO_VELOCITY (thrust_increment); GetCurrentVelocityComponents (VelocityPtr, &cur_delta_x, &cur_delta_y); current_speed = VelocitySquared (cur_delta_x, cur_delta_y); delta_x = cur_delta_x - COSINE (CurrentAngle, thrust_increment); delta_y = cur_delta_y - SINE (CurrentAngle, thrust_increment); SetVelocityComponents (VelocityPtr, delta_x, delta_y); return (StarShipPtr->cur_status_flags & (SHIP_BEYOND_MAX_SPEED)); } Although the offending code is not a bug and usually does not have much effect on gameplay, I propose this fix be implemented into UQM's next release to make combat physics more consistent.
|
|
|
Logged
|
|
|
|
|
|
Shiver
Guest
|
The last proposal looks about right, except you should not test for SHIP_IN_GRAVITY_WELL. That is handled by an else if just above. And this should still invoke when SHIP_AT_MAX_SPEED, so else if (TravelAngle == CurrentAngle && !(StarShipPtr->cur_status_flags & SHIP_BEYOND_MAX_SPEED))
This did not work when I tried it. The Thraddash would not brake at all while traveling above max speed in a straight line. Holding off on using Bugzilla for the moment.
|
|
|
Logged
|
|
|
|
|
Shiver
Guest
|
Did you remove the else if at line 70 as Elvish specified?
Do not hold off on Bugzilla just because all the details have not been worked out. Such details are better dealt with in Bugzilla anyway. Otherwise, it's your choice, of course.
Oh, his replacement code worked. But if the details don't need to be set in stone, I suppose I can get on that now.
|
|
|
Logged
|
|
|
|
fossil
Core Team
Frungy champion
Offline
Gender:
Posts: 94
|
Please direct further technical details and proposed patches to Bug #1043
|
|
|
Logged
|
|
|
|
Pages: [1]
|
|
|
|
|