Skip to content

[LivingWorld]Add grid occupancy diagnostic commands#362

Merged
billy1arm merged 6 commits into
mangoszero:masterfrom
MadMaxMangos:livingworld/grid-cell-occupancy-diagnostic
Jun 10, 2026
Merged

[LivingWorld]Add grid occupancy diagnostic commands#362
billy1arm merged 6 commits into
mangoszero:masterfrom
MadMaxMangos:livingworld/grid-cell-occupancy-diagnostic

Conversation

@MadMaxMangos

@MadMaxMangos MadMaxMangos commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

This is work for the upcoming living world work that is being performed, we are releasing commands ahead of the actual world changes, so people can get familiar with the commands. These are diagnostic commands to check grids/cells within an active server.

Adds GM-only grid occupancy diagnostics:

  • .grid info [gridX gridY]
  • .grid anchors

These commands report static DB spawn-definition occupancy by grid/cell without loading grids or changing world state.

Details

  • Adds a read-only grid occupancy command implementation.
  • Adds a const/find-based ObjectMgr cell GUID accessor.
  • Adds a read-only Map grid-loaded helper.
  • Registers the new .grid command group.
  • Reports whether the target grid is currently loaded.
  • Reports occupied cells out of 256 and top occupied cells.
  • Reports enabled startup anchor grid occupancy for the current map.

Safety

  • GM-only.
  • Read-only.
  • No DB writes.
  • No grid loading.
  • No spawning.
  • No live object iteration.
  • No gameplay behavior changes.

Testing

Verified in-game:

  • .grid info
  • .grid info 22 26
  • .grid info on unloaded/far grid reports loaded=no without loading it.
  • .grid anchors
  • Thelsamar grid diagnostic checks pass.

This change is Reviewable

MadMaxMangos and others added 3 commits June 10, 2026 00:29
GM-only, in-game-only diagnostic commands that measure how many of a grid's
256 cells contain DB-backed spawns, to quantify whether future cell-cluster
object loading is worthwhile (LivingWorld Phase 1.5). No behavior change.

- .grid info [gridX gridY]: per-grid static spawn-definition occupancy
  (occupied/256 cells, creature/gameobject/corpse GUID totals, top cells);
  no args = current grid, two args = grid index on the current map.
- .grid anchors: occupancy of the enabled startup anchor grids on the current
  map (CREATURE_FLAG_EXTRA_ACTIVE + enabled LivingWorld anchors) plus a
  min/median/max sparsity aggregate.

All counts are static DB spawn-definition counts, not live object counts. The
commands never load/create grids, spawn objects, query the DB, or mutate state:
- ObjectMgr::GetCellObjectGuidsReadOnly(): find-based, non-inserting per-cell
  lookup (the existing GetCellObjectGuids() would operator[]-insert empties).
- Map::IsGridLoaded(gx,gy): read-only grid-load check; never loads.
- anchors read via the existing GetActiveCreatureGuids() accessor.

No DB/schema/config changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GM-only, in-game-only diagnostic commands that measure how many of a grid's
256 cells contain DB-backed spawns, to quantify whether future cell-cluster
object loading is worthwhile (LivingWorld Phase 1.5). No behavior change.

- .grid info [gridX gridY]: per-grid static spawn-definition occupancy
  (occupied/256 cells, creature/gameobject/corpse GUID totals, top cells);
  no args = current grid, two args = grid index on the current map.
- .grid anchors: occupancy of the enabled startup anchor grids on the current
  map (CREATURE_FLAG_EXTRA_ACTIVE + enabled LivingWorld anchors) plus a
  min/median/max sparsity aggregate.

All counts are static DB spawn-definition counts, not live object counts. The
commands never load/create grids, spawn objects, query the DB, or mutate state:
- ObjectMgr::GetCellObjectGuidsReadOnly(): find-based, non-inserting per-cell
  lookup (the existing GetCellObjectGuids() would operator[]-insert empties).
- Map::IsGridLoaded(gx,gy): read-only grid-load check; never loads.
- anchors read via the existing GetActiveCreatureGuids() accessor.

No DB/schema/config changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@AppVeyorBot

Copy link
Copy Markdown

- Fix line length violations (>80 chars) in GridCommands.cpp
- Split long PSendSysMessage and SendSysMessage calls with proper continuation indentation
- Split comments in ObjectMgr.h and Map.h to stay under 80 chars
@codacy-production

codacy-production Bot commented Jun 10, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 28 complexity · 0 duplication

Metric Results
Complexity 28
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Comment thread src/game/ChatCommands/GridCommands.cpp
Comment thread src/game/ChatCommands/GridCommands.cpp
Comment thread src/game/ChatCommands/GridCommands.cpp
Comment thread src/game/Object/ObjectMgr.h
Comment thread src/game/Object/ObjectMgr.h
- Add brackets around continue statements in GridCommands.cpp
- Add brackets around return statements in ObjectMgr.h
- Per MaNGOS coding standards: use brackets for non-obvious constructs
- Align string continuation lines with opening quote per coding standard
- Re-wrap comments in ObjectMgr.h and Map.h to stay under 80 chars
- Remove 3 extra spaces from string continuation indentation
@billy1arm billy1arm merged commit 05605e0 into mangoszero:master Jun 10, 2026
7 of 8 checks passed
@MadMaxMangos MadMaxMangos deleted the livingworld/grid-cell-occupancy-diagnostic branch June 11, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants