HUNTER mobs run a whole-world path search every turn
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp
- Domain
- game-dev, performance
Research direction
The cost is in find_first_step in src/graph.cpp (around line 102), which clears marks on every room and then runs an unlimited breadth-first search. The callers are the standard mob turn in src/mobact.cpp (around line 433) and mob_ranger_new (program 32) in src/spec_pro.cpp. Start by timing one search on a populated world, then choose a lighter approach that both callers share. Done means a measured reduction per mob turn, with the standard turn and program 32 using the same code.
Written by the indexing model from the issue text.
Description
Problem
A HUNTER mob that remembers enemies runs a whole-world path search on
its turn for each remembered enemy who is not in its room.
find_first_step(src/graph.cpp:102) first clears a mark on every
room in the world, then searches breadth-first with no distance limit.- The standard mob turn (
src/mobact.cpp:433) and the ranger program
(mob_ranger_new, program 32,src/spec_pro.cpp) both loop over the
mob's memory. When no path is found, they search again for the next
enemy.
One mob turn can therefore cost about (enemies remembered) x (rooms in
the world), and that is paid on every turn of every HUNTER mob. The cost
grows with the number of HUNTER mobs, the size of their memories and
the size of the world.
To investigate
- How often this runs on live: the number of HUNTER mobs, typical memory
sizes, the time per search. - Ways to make it lighter, for example:
- a distance or zone limit on the search
- remembering the last result for a few turns
- one search toward all remembered enemies instead of one each
- clearing only the rooms the search touched instead of the whole
world
- Whatever changes, the standard turn and program 32 should share it.
Behaviour today is the same in both places. The ranger program bug-fix
work carries it as it is and leaves the fix to this issue.
- Dominant language
- C++
- Stars
- 3
- Forks
- 4
- Avg merge
- 18h 36m
- Merged PRs (30d)
- 87
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from returnoftheshadow/RotS_Live
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
returnoftheshadow/RotS_Live#521 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
returnoftheshadow/RotS_Live#485 ·
Maintainers usually reply within 1 day
-
Remove dead object refresh code (check_inventory_proto and friends)Possibly taken @drelidan7 claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
returnoftheshadow/RotS_Live#414 ·
Maintainers usually reply within 1 day
-
purge <player> idle-saves the immortal instead of the playerPossibly taken @bskalpavrukshab25-sketch claimed this 11 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
returnoftheshadow/RotS_Live#411 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
returnoftheshadow/RotS_Live#410 · 2 comments ·
Maintainers usually reply within 1 day
All issues in returnoftheshadow/RotS_Live
Similar issues
-
launch-client --save-creds creates creds/<account>/ with mode 755, not 700Possibly taken @metis-sprock claimed this today. Openbacklog bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
EchoTools/nevr-runtime#1471 ·
Maintainers usually reply within 1 day
-
.NET ep:WebGPU platform:web
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
microsoft/onnxruntime#33755 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
grumpycoders/pcsx-redux#2530 ·
-
A-tools P-medium S-ready-to-start studio task
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Status: Needs confirmation Status: Needs triage Type: Code Quality
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day