openage icon indicating copy to clipboard operation
openage copied to clipboard

Record history of cost changes in pathfinder

Open heinezen opened this issue 1 year ago • 2 comments

Required Skills: C++

Difficulty: Hard

At the moment, changes to the movement cost of cells in the openage pathfinder always overwrite the old values. The old values are not saved anywhere, so going back to a previous state of the grid is currently not possible. Ideally, the grid should support going back in time, so we can roll back changes e.g. for multiplayer matches.

openage already provides the curve data types for storing values over time, so changes could be recorded using the same methods. An array curve (see https://github.com/SFTtech/openage/issues/1678) would probably be the best option for storing values for a grid.

To try out the current pathfinder, check out pathfinding demo 1 by running the following command:

./run test -d pathfinding.tests.path_demo 1

Tasks:

  • [ ] Add a cost record storage for cells to the CostField implementation. The cost record should use curve. For performance reasons, the recorded values should be stored separately from the current cost values (so not in the cells vector).
  • [ ] Record the changed cost whenever a modifying operation occurs for CostField, e.g. setting a cell value.

Further Reading

heinezen avatar Aug 25 '24 04:08 heinezen

I would love to work on this issue, can you assign it to me?

HmbleCreator avatar Oct 14 '24 17:10 HmbleCreator

@HmbleCreator Sure. go ahead :)

heinezen avatar Oct 15 '24 01:10 heinezen

We would need to know the size of cost field at compile time right if we want to give it a curve::Array ? template it?

jere8184 avatar Dec 11 '24 18:12 jere8184

The size of the fields will be fixed at compile time later on by enforcing a fixee terrain chunk size. Currently it's 10x10

heinezen avatar Dec 12 '24 18:12 heinezen