Opened 13 years ago

Last modified 5 years ago

#940 new enhancement

Ships should have a turn radius and other movement enhancements

Reported by: michael Owned by:
Priority: Nice to Have Milestone: Backlog
Component: Simulation Keywords: pathfinding
Cc: Patch:

Description (last modified by michael)

1.) Right now, ships can turn on a dime very unnaturally. It would be an enhancement to the movement of ships to implement a turn radius, perhaps similar to the way the P-51 Mustangs have a turn radius(?). And if there is not enough room for the ship to use its turn radius, then it uses a 3-point turn similar to how one would execute a 3-point turn driving a car.

2.) Similarly, a ship should not need to face its target to fire projectiles. When they do this (face their targets), they tend to jerk unnaturally.

3.) This should perhaps be a totally different ticket, but an acceleration feature would be nice. Ships should have positive and negative acceleration. This could also be useful for ramming and perhaps for other units who have a running and charging feature. This could perhaps be done with distance, e.g. distance it takes to accelerate to full speed.

Change History (13)

comment:1 by michael, 13 years ago

Description: modified (diff)

comment:2 by michael, 13 years ago

Description: modified (diff)

comment:3 by thomas, 11 years ago

This looks to be a good article on how this might be implemented: http://www.gamasutra.com/view/feature/131505/toward_more_realistic_pathfinding.php?page=3

I'm going to start digging into the pathfinding code to see if it's something I'd be able to do.

comment:4 by Darth_Malloc, 11 years ago

Owner: set to Darth_Malloc
Status: newassigned

comment:5 by Darth_Malloc, 11 years ago

To add a turn to ships, would it be better to modify script, source files, or both?

comment:6 by sanderd17, 11 years ago

Darth_Malloc, I can forsee this would require changes in the pathfinder (as paths aren't straight anymore, and often, a 3-point turn isn't enough). So you should best ask Philip (most of the time on #0ad-dev on quakenet) if it's worth to do this now, or if you'd best wait for the next pathfinder.

Currently, the planes do have a turn radius, but that was rather easy to implement as they didn't need a complicated pathfinder (there are no obstacles for planes).

But if you change it, I'd certainly start looking into CCmpUnitMotion first.

comment:7 by historic_bruno, 11 years ago

I'd be very wary of making significant changes to the pathfinder to support this, at this point. We know our pathfinders need a full rewrite, so any new features we add to them only complicates the process (by adding yet another feature we have to take into consideration in the design).

For what it's worth, planes don't use the pathfinder at all, only some very simple checking was added recently to improve their behavior. Ships might have different enough pathfinding needs to require both a.) a new unit motion component, and b.) a separate pathfinder. I don't think one pathfinder can be a one-size-fits-all solution (just like if we want roads, we should have a different pathfinder layer for them, because it's a totally different type of problem).

in reply to:  7 comment:8 by Darth_Malloc, 11 years ago

Sorry about my silence. I have had many projects on the go of late, but now I am back. I can see how this might be a problem, but if I succeed in making this particular improvement, I would also be interested in going back to it later to adapt it to the new pathfinding algorithm. Applying the appropriate variation of the formula described in the link above will not be difficult. At this point I am just wondering the exact value of the variable m_PassClass that would signify a naval unit.

Replying to historic_bruno:

I'd be very wary of making significant changes to the pathfinder to support this, at this point. We know our pathfinders need a full rewrite, so any new features we add to them only complicates the process (by adding yet another feature we have to take into consideration in the design).

For what it's worth, planes don't use the pathfinder at all, only some very simple checking was added recently to improve their behavior. Ships might have different enough pathfinding needs to require both a.) a new unit motion component, and b.) a separate pathfinder. I don't think one pathfinder can be a one-size-fits-all solution (just like if we want roads, we should have a different pathfinder layer for them, because it's a totally different type of problem).

comment:9 by thomas, 11 years ago

Darth_Malloc, I believe the passability classes come from pathfinder.xml in a mod's simulation/data directory. Looking in the public mod, there's one called "ship" already. That might be the one to use unless you want to make a separate one for ships with turning radius.

comment:10 by Stan, 9 years ago

Owner: Darth_Malloc removed
Status: assignednew

comment:11 by Stan, 7 years ago

Cc: pathfinding added

comment:12 by Stan, 7 years ago

Cc: pathfinding removed
Keywords: pathfinding added

comment:13 by Imarok, 5 years ago

Component: UI & SimulationSimulation

Move tickets to Simulation as UI & Simulation got some sub components.

Note: See TracTickets for help on using tickets.