2020-05-30 11:05 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000607Spring engineGeneralpublic2007-08-31 09:22
Assigned Toimbaczek 
Product Version 
Target VersionFixed in Version 
Summary0000607: Hovercraft forget MAX_SPEED
DescriptionHovercrafts forget a set MAX_SPEED after a second or so, probably through slow update. This behaviour was seen on non-hover ground units before but has been fixed, IIRC. Gunship aircraft also exhibit this issue, possibly other units as well.
Additional InformationI've attached a special version of CvC. The ctitan (gunship) and cdrolas (hovercraft) units have been altered to get a gigantic speed boost if they use their weapons. There is no code to return them to normal speed without making the ctitan build something or spawning/building the cupg_cruiseengines. However, shortly after they stop shooting or when a move order is issued they return to their normal speed.

The ctitan uses AimWeapon for the speedboost, the cdrolas FireWeapon. FPSing the cdrolas gives the speed boost from the first shot until FPS mode is left.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files




KDR_11k (reporter)

This happens in both 75b2 and the latest SVN (tested 4234 and 4241). Also I'm under the impression that it worked in an earlier SVN so it might possibly be a regression.


imbaczek (reporter)

I'll look into it.


imbaczek (reporter)

I think that it looks like this: when a attack order is issued, the engine appends a CMD_SET_WANTED_MAX_SPEED right after that, with requested max speed == max speed at the time of issuing the order. Script changes the max speed, but it is immediately overridden by that command. Workaround would be to use LuaCOB to change that command in the command queue.

I don't know how to fix the issue in the engine; CMD_SET_WANTED_MAX_SPEED appears to have other important uses. Theoretically, it is possible to override a param in the first CMD_SET_WANTED_MAX_SPEED found in the command queue when COB invokes SetMaxSpeed. Is that enough?


KDR_11k (reporter)

I've had it triggered by other conditions too, e.g. SetSFXoccupy, it will change for a moment but then revert, even if no further command is given.

Besides, shouldn't the wanted max speed be matched to the actual max speed at least later on?

Regular ground units don't have this problem, BTW. Gundam has units that move faster underwater and they don't slow down immediately.


Argh (reporter)

Last edited: 2007-08-25 14:31

KDR, this is not a bug, I think.

You must set the maxvelocity of your Units >= to MAX_SPEED settings in BOS, or it will return to maxvelocity, if maxvelocity < SET MAX_SPEED. You can SET MAX_SPEED for a ground units to silly values, and they only obey until they get a stop command while pathfinding (which you can't exactly plan around) or a SlowUpdate.

Here... try this... give your Units a maxvelocity of 20. Then use the script, at Create(), to drop to whatever it used to be. Then try playing around with speeds again. It should work then, IIRC. It's been quite awhile since I messed with this.


KDR_11k (reporter)

It is a bug. Just because there are ways to work around it doesn't mean it shouldn't be fixed. There's no reason to limit set MAX_VELOCITY to the FBI value.


imbaczek (reporter)

printf debugging FTW:

setting newMaxSpeed...
CMoveType: set max speed 50.000000 on CTITAN
move, before givecommand, speed 50.000000
Executing in StopBuilding (from StopBuilding)
Executing in StopBuilding (from StopBuilding)
cob setmaxspeed: 1.500000
CMoveType: set max speed 1.500000 on CTITAN
move, after givecommand, speed 1.500000
adding CMD_SET_WANTED_MAX_SPEED with speed 1.500000

So, the engine calls StopBuilding upon every (not sure actually, seems so) command finish, and your script does set MAX_SPEED there. Solving this looks like disarming a bomb - one mistake and you're dead. take a peek into Builder.cpp and BuilderCAI.cpp. Guess this will have to stay open for a while. Someone could add this to the spring COB gotchya list.

I've got a fix for cdrolas in my local tree. I think. I forgot what I changed and where, all I know is that it's seriously fast after it shoots.


KDR_11k (reporter)

Ah, okay. Should've rigged the Trireme up for the gunship demo then, it has similar issues with keeping an increased speed.


imbaczek (reporter)

Committed a fix for cdrolas in r4264, please test. (Also, the titan also keeps it's speed boost if you queue a move order after an attack order.) Marking this as resolved, but do not hesitate to reopen.

-Issue History
Date Modified Username Field Change
2007-08-23 09:40 KDR_11k New Issue
2007-08-23 09:40 KDR_11k File Added: CvC Bug demo.sd7
2007-08-23 09:42 KDR_11k Note Added: 0001151
2007-08-24 00:49 imbaczek Note Added: 0001153
2007-08-24 00:49 imbaczek Status new => confirmed
2007-08-24 11:59 imbaczek Note Added: 0001154
2007-08-24 17:21 KDR_11k Note Added: 0001157
2007-08-25 14:27 Argh Note Added: 0001158
2007-08-25 14:31 Argh Note Edited: 0001158
2007-08-25 18:06 KDR_11k Note Added: 0001161
2007-08-30 00:36 imbaczek Note Added: 0001190
2007-08-30 10:47 KDR_11k Note Added: 0001191
2007-08-31 09:22 imbaczek Status confirmed => resolved
2007-08-31 09:22 imbaczek Resolution open => fixed
2007-08-31 09:22 imbaczek Assigned To => imbaczek
2007-08-31 09:22 imbaczek Note Added: 0001196
+Issue History