SFTtech / SFTtech/openage

Cost stamps (pathfinder)

Open
#1,676 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: simulation good first issue just do it lang: c++ nice new thing ☺
Dominant language
Python
Stars
14.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Required Skills: C++

Difficulty: Medium

Our current model of the flow field pathfinder doesn't account for temporary changes of the cost grid, e.g. a building being placed on terrain. In this example, the building would change the movement cost of the grid (making affected tiles impassable) only as long as it exists. Once it is removed, the cells should return to their original cost value (e.g. that of the underlying terrain).

For flow fields there already exists a suggested solution for this in the form of cost stamps (check out the related article). Essentially, cost stamps record the original value of the cells when they change its value. Removing a stamp restores the original value.

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 cost stamps storage for cells to the CostField implementation. For performance reasons, the stamps should be stored separately from the current cost values (so not in the cells vector). Stamps should record
    • Time of "stamping"
    • Original cell value
  • Add new methods for cost stamps to CostField. You should at least implement these functions:
    • CostField::stamp(..): Place a stamp down for a specific cell
    • CostField::unstamp(..): Restore the original value for a specific cell

Further Reading

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read libopenage/pathfinding/cost_field.h and the pathfinding documentation first, then run ./run test -d pathfinding.tests.path_demo 1 to inspect the current behavior. Implement separate cost-stamp storage recording each stamp's time and original cell value, with stamp and unstamp operations. Done means temporary cell costs can be restored after a stamp is removed without storing stamps in the cells vector.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.