View Issue Details

IDProjectCategoryView StatusLast Update
0000841FSSCPgameplaypublic2006-03-20 05:29
ReporterGoober5000 Assigned Totaylor  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Summary0000841: Ships follow their waypoints too fast
DescriptionI just discovered this while playing through the Port - SM1-08 is a good example. The freighters cover the distance between the installation and the node so quickly that the mission is made much easier.
Additional InformationI haven't narrowed it down yet, but I'm guessing this is somehow related to the docking code (groan) since I've only noticed it with docked ships.
TagsNo tags attached.

Activities

thesource2

2006-03-02 15:48

reporter   ~0005024

Maybe you forgot to take in account mass of all docked objects not just mover?

By the way I never understood why mass of the object affects its velocity in FreeSpace. It must affect acceleration and therefore there must be no such thing like maximum speed (except of light of cource). Just what thing makes ships to slow down when engines don't work?

Muriac

2006-03-02 16:17

reporter   ~0005027

That's just a movie/gameplay mechanic to save a lot of headaches. If there were no top speed, you'd have to spend half your journey somewhere slowing down if you wanted to stop when you got there. Not to mention the fact that you'd be able to turn in any direction while moving in any other, which would make movement in a dogfight scenario difficult to present and for the pilot to visualize.

This is an issue that the BSG mod people have looked at, because in the BSG show, Newtonian physics are properly represented. Freespace has limited capability in this regard, and, more importantly, games which implement Newtonian physics tend to be very difficult to play.

Goober5000

2006-03-04 02:13

administrator   ~0005042

Oh, *crap*.

This isn't a bug in FSO, it's a change in behavior from FS1 to FS2. In FS1, the maximum speed of the freighters is 23, while in FS2 (and FSO) it's 42.

Goober5000

2006-03-04 02:14

administrator   ~0005043

Reminder sent to taylor

Taylor, how does the icculus port deal with this? I'm assuming the FS1 code modifies the speed of a docked object somehow, but I can't find any code, even commented out, in FS2. :(

taylor

2006-03-04 05:12

administrator   ~0005044

It doesn't, I never noticed this before. :)

I did see this in the commit logs for aicode.cpp though:

 * 75 7/26/99 12:14p Andsager
 * Apply cap to how much slower a transport flies with cargo. ...

But I haven't found any code relating to that yet, with only a quick look. There is something in the current code which applies a speed cap when docked though so it should just be a matter of finding that and coming up with a suitable change.

I don't know if you want this one or not but it's on my list now. I'll try and take a look at it next week if you don't get to it first.

The Trivial Psychic

2006-03-04 05:23

reporter   ~0005045

How about an addition to the waypoints or waypoints-once, such as:

ai-waypoints-once
-waypoint path 1
-89
-50

The 3rd and optional line is the maximum speed that the ship, or any ship in the wing, will travel (will be ignored if the figure is faster than the top speed of ships). This would unfortunately, render cap-waypoint-speed mostly redundant. However, this sexp would be useful for instances when you have a freighter wing at normal speed, but suddenly something happens and you want them to accellerate to "top" speed to avoid the threat. There would obviously need to be a default speed, since not all campaigns have this, and there's no way to dictate the top speed field if waypoints are selected as part of a ship's initial orders.

Goober5000

2006-03-04 06:22

administrator   ~0005046

Last edited: 2006-03-04 06:23

TP: We already have cap-waypoint-speed for that, and it's prohibitively hard (last I looked) to "reverse-cap" (i.e. increase) an object's speed anyway.

Taylor: I spent a fair amount of time (maybe an hour or more) looking through the code and didn't see anything. Of course, I didn't really know where to look. :) Based on your comment just now I searched for "MWA" and "cargo" in the retail version of AiCode.cpp but didn't see anything. If you know for certain there's a docking speed cap then you're further along than I am. :)

It's possible that they just used the same algorithm as for acceleration: scaled by ship mass over total mass. It would seem to make sense anyway, since I can't think of any alternatives that fit.

I made up a quick spreadsheet with the FS1 speeds, so I'll attach that in case it helps.

edited on: 03-04-06 01:23

2006-03-04 06:23

 

dock speeds.xls (13,824 bytes)

taylor

2006-03-20 02:11

administrator   ~0005190

Last edited: 2006-03-20 02:13

Found it. There is a cap on the minimum that the speed can be decreased. It is still based entirely on mass but the ratio of speed drop is capped to a min value. This min value is roughly twice what the accel ratio for docked ships in that FS1 mission computes to (0.8 as min, 0.43 as actual). Removing the min cap makes the ships have a speed of 23. Putting the min cap back, but at 0.45, makes the ships speed be 24.

So now we just have to test whether FS1 actually had a cap or not (whether the 23:24 thing would just be a floating-point issue). This is obviously done by just double checking the ratio of all of docked craft from your xls. I'll try and do all of that tonight.

The second issue is whether to actually make this change as global or not. Do we leave it as is to avoid possibly breaking FS2 campaigns and just use the sexp to cap the speed? Or do we add some type of a flag for it?

(Oh, the problem function is adjust_accel_for_docking() in aicode.cpp, which should have been obvious but I still skipped over it as not a problem originally.)

edited on: 03-19-06 21:13

Goober5000

2006-03-20 02:22

administrator   ~0005191

Cool. :) Yeah, I skipped over adjust_accel_for_docking too. The 23:24 thing is probably a round-off error, as occasionally I would get speeds that differed by 1 from the table.

Considering how it broke FS1 missions to cap it, it would probably break FS2 missions to leave it uncapped. I recommend tying it to an ai_profiles flag.

taylor

2006-03-20 03:20

administrator   ~0005192

Yeah, I think the 23:24 is just a round off error too. I checked most of the other ships and their speeds were pretty much spot on (except for one which I think may have been an error in the xls). It would seem that there was no cap for FS1 though, or if there was one it was about 0.2 or something real low like that.

I added the flag ("$don't use min speed cap for docked ships", defaulting to "NO" per other flags) and also set an additional min cap check of 0.1 so that there should always be at least some momentum. The 0.1 check will Int3() if it gets hit, just so we'll know. The extra check happens regardless of the ai_profiles flag setting and shouldn't get hit unless some goes really wrong. I'll test everything once more and then commit.


(Oh and AIPF_NAVIGATION_SUBSYS_GOVERNS_WARP isn't set in the default table. Should it be set to NO as well?)

Goober5000

2006-03-20 03:54

administrator   ~0005194

That flag name sounds a bit convoluted - maybe it would be better as "$use FS1 dock speed slowdown" or something less wordy (I know, I'm guilty of that on some of the other flags). It's just that "minimum speed cap" isn't something that's intuitively obvious.

And yeah, AIPF_NAVIGATION_SUBSYS_GOVERNS_WARP should be in the table too. :) Nothing changes if it isn't (same with the rest of the flags) but since the Wiki is updated from the source, the table should include everything.

taylor

2006-03-20 04:32

administrator   ~0005195

I would prefer to stay away from any sort of mod/game specific verbage if at all possible. I also wanted to stay away from something that seemed to indicate that it was a dock/undock speed thing rather than the max speed of a ship that has something docked to it. What I ended up with is a bit wordy I agree, but in context it makes more sense (to me at least). I couldn't come up with something that was as/more meaningful and was less wordy. :)

How about "$don't cap min speed of docked ship"? Not much better, but none of the alternatives really are either. I just don't want to make people rely on the comment to figure out what the hell it does. To clarify what it does maybe but that's about it.

Goober5000

2006-03-20 04:41

administrator   ~0005196

Well the weird part of it is the concept of "capping the minimum". When most people thing about capping something, they thing of capping a maximum. Your second wording sounds better, but there's still that intuitive hurdle.

Maybe you could use "lower bound" instead of "cap".

taylor

2006-03-20 05:01

administrator   ~0005197

Hmm, "cap" does sound a bit strange there now that you mention it. How about "$don't limit min speed of docked ship"?

Goober5000

2006-03-20 05:21

administrator   ~0005198

Maybe a bit more verbose: "$ignore lower bound for minimum speed of docked ship"? :)

taylor

2006-03-20 05:29

administrator   ~0005199

Whatever. :P ;)

I just did the commit, but I'll go ahead and quickly change it to what you said. Though I do find it curious that "less wordy" and "more verbose" appear to mean the same thing to you. :D

taylor

2006-03-20 05:29

administrator   ~0005200

Fixered.

Issue History

Date Modified Username Field Change
2006-03-01 01:01 Goober5000 New Issue
2006-03-02 15:48 thesource2 Note Added: 0005024
2006-03-02 16:17 Muriac Note Added: 0005027
2006-03-04 02:13 Goober5000 Note Added: 0005042
2006-03-04 02:14 Goober5000 Note Added: 0005043
2006-03-04 05:12 taylor Note Added: 0005044
2006-03-04 05:23 The Trivial Psychic Note Added: 0005045
2006-03-04 06:22 Goober5000 Note Added: 0005046
2006-03-04 06:23 Goober5000 Note Edited: 0005046
2006-03-04 06:23 Goober5000 File Added: dock speeds.xls
2006-03-20 02:11 taylor Note Added: 0005190
2006-03-20 02:13 taylor Note Edited: 0005190
2006-03-20 02:22 Goober5000 Note Added: 0005191
2006-03-20 03:20 taylor Note Added: 0005192
2006-03-20 03:20 taylor Status new => assigned
2006-03-20 03:20 taylor Assigned To => taylor
2006-03-20 03:54 Goober5000 Note Added: 0005194
2006-03-20 04:32 taylor Note Added: 0005195
2006-03-20 04:41 Goober5000 Note Added: 0005196
2006-03-20 05:01 taylor Note Added: 0005197
2006-03-20 05:21 Goober5000 Note Added: 0005198
2006-03-20 05:29 taylor Note Added: 0005199
2006-03-20 05:29 taylor Status assigned => resolved
2006-03-20 05:29 taylor Resolution open => fixed
2006-03-20 05:29 taylor Note Added: 0005200