Repository navigation
Codex implementation of map editor initial phase - #1
Open
pegasuspect wants to merge 7 commits into
Open
pegasuspect wants to merge 7 commits into
pegasuspect wants to merge 7 commits into
Conversation
…dling in Game class.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I tested each commit locally. Best part is the player sliding on the walls created by the game editor. So many more objects can be added. Such as water, dirt, booster tiles, or more walls haha 😄
The map data is saved and checked into version control, later on this can be saved on a database and have a collection of maps.
PS: Oh, also updated the readme todo list to make sure we account for our roadmap. This is just a toy project but codex brought up some important security issues if we were to publish this project on a server to see where it goes. There is another readme file created that lists all the bells & whistles.
Full conversation with codex for this branch:
4 previous messages
Implemented Phase‑1.
/editorroute.X.Validation completed:
/editorand/editor.jsboth returned HTTP 200.Files: index.js, editor.html, and editor.js.
4 previous messages
Phase‑2 is implemented.
GET /map-statereads and returns map-state.json.POST /save-mapoverwrites it with the supplied JSON object.400.500with a clear response.Verified saving, reading the persisted state, rejecting invalid input, and restoring the initial
{}state. Changes are in index.js.3 previous messages
Phase‑3 is implemented.
/map-state.(400, 300)and800x600when absent.widthxheightintegers./save-map.Syntax, formatting, and server route checks passed.
/editorand/map-stateboth returned HTTP 200.2 previous messages
Camera movement is now bounded in both editor and Preview modes.
Each map edge can move only halfway across the canvas. For example, an
800x400map on the800x600canvas allows:-400to400-300to100Changing the map-area value immediately recalculates and applies these limits. Syntax and formatting checks passed.
2 previous messages
Implemented.
Syntax and formatting checks passed.
2 previous messages
Updated spawn placement behavior:
Preview-player movement remains constrained at the boundaries. Syntax and formatting checks passed.
2 previous messages
Corrected. Previous functionality is restored:
Only active mouse placement changed: the marker moves and can be placed only while the cursor is within the map boundaries.
4 previous messages
Both issues are fixed.
/map-state./and/editor.Verified movement progresses normally and stops at the expected boundary—for the current
800x400map, the player’s maximum X position is780.4 previous messages
Fixed both issues.
localhost:3001, API requests automatically retry against the game server atlocalhost:3000.Run the backend with:
Saving from the editor on port
3001should then reach the API on port3000. Syntax and movement-boundary tests passed.2 previous messages
Added a solid visible map border behind the players.
It appears in:
The editor itself retains its dashed boundary style. Syntax and formatting checks passed.
4 previous messages
Phase‑4 is implemented.
/save-map.Syntax, formatting, and bidirectional wall-collision tests passed.
2 previous messages
Implemented both changes.
Validated that a player moving toward a vertical wall reaches the exact nearest legal coordinate without getting stuck. Syntax and formatting checks passed.
2 previous messages
Fixed the wall-crossing case.
Validated approaching, touching, moving along, and moving away from a wall without crossing or becoming stuck.
2 previous messages
Fixed the repeated-click case.
When the player is already touching a wall and another click lands behind it:
Validated with consecutive clicks behind a vertical wall: the player first reaches
(180, 200), then glides along it to(180, 300).4 previous messages
Replaced the selected-wall pivot logic with a wall-agnostic contact solver.
Validated the same two-wall corner in both wall orders; both finish at
(180, 280), exactly 20 pixels from each wall. Single-wall sliding still reaches the expected point.2 previous messages
The editor and collision system are a good foundation, but the game needs a server-authoritative multiplayer loop before competitive gameplay. Right now, clients submit their own coordinates, so a modified client could teleport anywhere.
Recommended build order
This is the most important next phase.
Socket.IO is suitable for low-latency communication and can later scale across multiple servers through its adapter architecture. Socket.IO
A minimal competitive version needs:
1v1or2v2initially.Avoid adding items, minions, progression, and many characters until one small match is fun.
Start with:
textContent.WebSocket messages must be treated as untrusted input, with authentication, schema validation, payload limits, rate limiting, origin checks, and production
WSS. OWASP WebSocket SecurityA database should hold:
PostgreSQL would be enough initially. Redis becomes useful later for matchmaking queues, presence, temporary match state, and multi-server Socket.IO coordination.
OWASP specifically recommends message-level authorization, strict payload validation, connection limits, heartbeat handling, and event logging for WebSockets. OWASP WebSocket Security
Immediate code problems to address
The current server specifically needs:
playerslist with per-match state.socket.idor an authenticated player ID.disconnect.My recommended next milestone would be Phase‑5: Server-Authoritative Multiplayer, followed by Phase‑6: Match Rooms and Simple Chat. Chat is relatively easy; trustworthy synchronized gameplay is the part that determines whether the game can actually be competitive.
2 previous messages
Created FUTURE_IMPLEMENTATION.md containing the complete competitive multiplayer roadmap, phases, security guidance, testing requirements, and recommended delivery order.
The second item in README.md now links to it as “Future implementation steps.” Formatting checks passed.