Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

HUNTER mobs run a whole-world path search every turn

Open
#394 0 comments 0 reactions 0 assignees View on GitHub

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

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

  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.

More from returnoftheshadow/RotS_Live

All issues in returnoftheshadow/RotS_Live

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.