Skip to content

Commit

Permalink
enable ground units to move in reverse (requires defining a non-zero …
Browse files Browse the repository at this point in the history
…maxReverseVelocity in a unit's definition file)
  • Loading branch information
Kloot committed Jul 22, 2009
1 parent 57759eb commit a5adf2f
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 230 deletions.

8 comments on commit a5adf2f

@imbaczek
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm very afraid... i'd like to see what i've posted on the forums - that is, a CMD_MOVE_REVERSE. i see that it wouldn't be hard to do - just tell the movetype that next path should be taken entirely in reverse by forcing wantReverse appropriately. this also needs a toggle so that autoreversing can be disabled (as i said, i've been playing some dow2 and sometimes vehicle decisions are horrifying. your implementation compares ETAs so it's not going to be as bad by default... will test it.)

@imbaczek
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i must admit that after a 30 min testing session my worries are mostly gone, it works much better than in dow2, probably because it doesn't try to make j-turns. the current ETAs don't work well in low acceleration, high turnrate scenarios, where you're better off just doing a 180 rather than braking and reversing at full speed, but this can be fixed, i guess - compare the 180 time with braking and accelerating to full speed and all will be fine.

i also noticed something odd with spawning track marks/decals when reversing, they spawn a bit in front of the unit (was testing BA flash), this might need some adjusting.

@tvo
Copy link
Member

@tvo tvo commented on a5adf2f Jul 23, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it on a tank in Spring: 1944 and it works epically good, very good job :-)

@tvo
Copy link
Member

@tvo tvo commented on a5adf2f Jul 23, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, one thing I noticed in the code, but shouldn't it use the wanted max speed, instead of the UnitDef max speed, for the case where for example a fast unit with slow reverse and a slow unit are moved backwards in formation?

In this case possibly the fast unit can remain in reverse for much longer distance because it has to keep pace with the slow unit anyway.
(ie. the ctrl+click formation move/fight thing, which uses CMD_SET_WANTED_MAX_SPEED)

@tvo
Copy link
Member

@tvo tvo commented on a5adf2f Jul 24, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe like this?

        const float waypointFETA   = waypointDist / std::min(wantedSpeed, owner->unitDef->speed);
        const float waypointRETA   = waypointDist / std::min(wantedSpeed, owner->unitDef->rSpeed);

@tvo
Copy link
Member

@tvo tvo commented on a5adf2f Jul 24, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May need to watch out for 0 wantedSpeed though.

@imbaczek
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed something that i feel works better for me. it may be a bit overcomplicated, but only a little ^_^

@imbaczek
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch.

btw a related idea: there's a need for a CMD_TURN_TOWARDS command now, since games like s44 with directional damage will need it. (charging a sherman backwards at a tiger? hell yeah!)

Please sign in to comment.