Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cost stamps (pathfinder) #1676

Open
4 tasks
heinezen opened this issue Aug 25, 2024 · 2 comments
Open
4 tasks

Cost stamps (pathfinder) #1676

heinezen opened this issue Aug 25, 2024 · 2 comments
Labels
area: simulation Involved in the game mechanics and simulation good first issue Suitable for newcomers hacktoberfest For newcomers from Hacktoberfest event just do it You can start working on this, there should be nothing left to discuss lang: c++ Done in C++ code nice new thing ☺ A new feature that was not there before

Comments

@heinezen
Copy link
Member

heinezen commented Aug 25, 2024

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

@heinezen heinezen added nice new thing ☺ A new feature that was not there before lang: c++ Done in C++ code area: simulation Involved in the game mechanics and simulation good first issue Suitable for newcomers just do it You can start working on this, there should be nothing left to discuss labels Aug 25, 2024
@heinezen heinezen added the hacktoberfest For newcomers from Hacktoberfest event label Sep 20, 2024
@anupriyakkumari
Copy link

Hi, I'd like to take this up.

@heinezen
Copy link
Member Author

@anupriyakkumari Hey, no problem go ahead :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: simulation Involved in the game mechanics and simulation good first issue Suitable for newcomers hacktoberfest For newcomers from Hacktoberfest event just do it You can start working on this, there should be nothing left to discuss lang: c++ Done in C++ code nice new thing ☺ A new feature that was not there before
Projects
Status: pathfinder
Status: 📋 Backlog
Development

No branches or pull requests

2 participants