Skip to content

Feat: Alphanumeric Coordinate Grid on Alternate View#2938

Open
bijx wants to merge 30 commits intomainfrom
bijx/alphanumeric-coordinate-grid
Open

Feat: Alphanumeric Coordinate Grid on Alternate View#2938
bijx wants to merge 30 commits intomainfrom
bijx/alphanumeric-coordinate-grid

Conversation

@bijx
Copy link
Contributor

@bijx bijx commented Jan 17, 2026

Description:

Adds a coordinate grid to the Alternate View (holding spacebar) using numbers on the X-axis, and letters on the Y-axis. No more "he's attacking you in that—well, the little peninsula thing... next to the island! which island? uhh..." moments when playing with friends. Optimally maps have letters A-J (just like in the Battleships board game) but special maps like Amazon River dynamically resize to only have 2 letters so as to not have too many number columns. This feature overall can be toggled via the settings menu.

Also saw it requested on the official discord a couple times, thought it was a neat idea.

World Map

image

Scales correctly when zoomed in

image

Amazon River

image

Enable/Disable via settings

Screen.Recording.2026-01-17.034212.mp4

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Please put your Discord username so you can be contacted if a bug or regression is found:

bijx

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Added a coordinate grid overlay feature: new translations, a user setting and toggle method, a KeyM keybind that emits a toggle event, and a new CoordinateGridLayer integrated into the renderer to draw alphanumeric grid lines and labels.

Changes

Cohort / File(s) Summary
Translations
resources/lang/en.json
Added three keys: action_coordinate_grid, coordinate_grid_label, coordinate_grid_desc.
Input & Events
src/client/InputHandler.ts
Added ToggleCoordinateGridEvent class and coordinateGrid keybind (KeyM). Key handling toggles the setting and emits the event.
User Settings
src/core/game/UserSettings.ts
Added coordinateGridEnabled() getter and toggleCoordinateGrid() method to read and flip the stored grid state.
UI: Settings & Help
src/client/UserSettingModal.ts, src/client/HelpModal.ts
Added a keybind setting entry for coordinateGrid (default KeyM) in the settings modal and a help-row showing the action and its key in the help modal.
Rendering
src/client/graphics/GameRenderer.ts, src/client/graphics/layers/CoordinateGridLayer.ts
Imported and added CoordinateGridLayer to the renderer stack. New layer renders adaptive alphanumeric grid lines and labels, subscribes to toggle events, and respects the user setting for visibility.

Sequence Diagram

sequenceDiagram
    participant User
    participant InputHandler
    participant UserSettings
    participant EventBus
    participant CoordinateGridLayer
    participant GameRenderer

    User->>InputHandler: press KeyM
    InputHandler->>UserSettings: toggleCoordinateGrid()
    UserSettings-->>InputHandler: return new enabled state
    InputHandler->>EventBus: emit ToggleCoordinateGridEvent(enabled)
    EventBus->>CoordinateGridLayer: notify toggle
    CoordinateGridLayer->>CoordinateGridLayer: update visibility state
    GameRenderer->>CoordinateGridLayer: renderLayer(context)
    CoordinateGridLayer->>CoordinateGridLayer: computeGrid() and draw lines & labels
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

A grid wakes gently at KeyM's call,
Letters and numbers march across the wall,
Toggle and watch the canvas sing,
Lines and labels in tidy ring,
Quiet guides for every map and hall ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main feature: adding an alphanumeric coordinate grid overlay to the Alternate View, which is the primary focus of this changeset.
Description check ✅ Passed The description thoroughly explains the feature, its implementation, visual examples, and community context. It directly relates to all changes in the changeset.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 17, 2026
@ryanbarlow97
Copy link
Contributor

Already mentioned in the discord (and I know you reacted to it already) but going to repeat it here for anyone else:

It would be great to get the letters on the exact edge of the map (worried about ultrawide) and just being too far away from the map

@ryanbarlow97 ryanbarlow97 added the UI/UX UI/UX changes including assets, menus, QoL, etc. label Jan 18, 2026
@ryanbarlow97 ryanbarlow97 added this to the v30 milestone Jan 18, 2026
@bijx
Copy link
Contributor Author

bijx commented Jan 18, 2026

Already mentioned in the discord (and I know you reacted to it already) but going to repeat it here for anyone else:

It would be great to get the letters on the exact edge of the map (worried about ultrawide) and just being too far away from the map

@ryanbarlow97 awesome suggestion, just added that in!

Screen.Recording.2026-01-18.172805.mp4

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 18, 2026
@ryanbarlow97
Copy link
Contributor

do the lines need to go past the map?

image

can you do something like this instead

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 18, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 18, 2026
@bijx bijx marked this pull request as draft January 18, 2026 23:50
@bijx
Copy link
Contributor Author

bijx commented Jan 18, 2026

Put back into draft until #2946 is merged so we can make the grid view a hotkey instead of being part of Alternate View

@ryanbarlow97
Copy link
Contributor

(update)
image

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 1, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/client/graphics/GameRenderer.ts`:
- Line 280: The build fails because RailroadLayer is being instantiated with
three args but its constructor requires four; in GameRenderer replace the
instantiation new RailroadLayer(game, eventBus, transformHandler) with a call
that passes the missing uiState as the fourth parameter (use the appropriate
uiState value available in scope), ensuring the RailroadLayer constructor
signature (game, eventBus, transformHandler, uiState) is satisfied.

@bijx bijx marked this pull request as ready for review February 14, 2026 21:50
@bijx bijx requested a review from a team as a code owner February 14, 2026 21:50
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 14, 2026
@bijx
Copy link
Contributor Author

bijx commented Feb 14, 2026

@ryanbarlow97 I finally got around to fixing this up, it's got keybinds to M now instead of using UserSettings to toggle, and was tested with latest changes
image

Copy link
Collaborator

@evanpelle evanpelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

when it's active it seems to use about 5% cpu. maybe it's recalculating too frequently?

@evanpelle
Copy link
Collaborator

instead of a seperate key, what about always showing it in the alternate view?

@ryanbarlow97
Copy link
Contributor

instead of a seperate key, what about always showing it in the alternate view?

There was a bit of discussion on being able to have this on permanently, as I would want this on during team games to make callouts e.g. “someone has a pixel in you in F12” for example

@scamiv
Copy link
Contributor

scamiv commented Feb 15, 2026

i would argue that this mainly improves gameplay for people in voice, making the communication gap to casual players even bigger.

@ryanbarlow97
Copy link
Contributor

i would argue that this mainly improves gameplay for people in voice, making the communication gap to casual players even bigger.

We need to promote voice chat gameplay too

…dling for AlternateViewEvent and updated render logic to account for alternate view visibility.
@bijx bijx requested a review from evanpelle February 16, 2026 07:44
@bijx
Copy link
Contributor Author

bijx commented Feb 17, 2026

@evanpelle

Image when it's active it seems to use about 5% cpu. maybe it's recalculating too frequently?

I refactored a bit to use an Offscreen Canvas so it only re-renders when a change is made to the view (camera pan, zoom, etc.). Should be more efficient now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

UI/UX UI/UX changes including assets, menus, QoL, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments