The Game Map
After selecting your Mokepon, you’ll enter a 2D map rendered using the HTML5 Canvas API. The map is where you navigate to find and engage opponents - both CPU-controlled and human players.The map uses a percentage-based coordinate system that adapts to different screen sizes, ensuring consistent gameplay across desktop and mobile devices.
Movement Controls
Control your Mokepon’s movement across the map using different input methods depending on your device.- Desktop
- Mobile
Keyboard Controls
Use the arrow keys on your keyboard to move your Mokepon:- ↑ Up Arrow: Move up
- ↓ Down Arrow: Move down
- ← Left Arrow: Move left
- → Right Arrow: Move right
Map Mechanics
Canvas Rendering
The map is rendered at 30 FPS (frames per second) using a continuous render loop:Movement Speed
Each Mokepon has a base movement speed that scales with the canvas size:Movement speed automatically adjusts when you resize the browser window to maintain consistent gameplay feel.
Responsive Map System
The map adapts to different screen sizes while maintaining the same gameplay experience.Percentage-Based Positioning
All Mokepon positions are stored as percentages (0-100%) of the map dimensions, not absolute pixels:- Your position remains consistent across screen resizes
- Other players see you at the correct location regardless of their screen size
- The game works seamlessly on both mobile and desktop
Canvas Sizing
The canvas dynamically sizes based on your viewport:Finding Opponents
Spawn System
When you join the map, the server calculates a safe spawn position that isn’t too close to existing players:Request Safe Position
Your client requests a spawn location from
GET /mokepon/:playerId/safePositionServer Calculates Safety
Server tries up to 20 times to find a position at least 20% away from other players
Identifying Opponents
As you navigate the map, you’ll encounter different types of opponents:CPU Opponents
Labeled with “CPU” text above their Mokepon. These are computer-controlled enemies that spawn automatically.
Human Players
No label - these are real players navigating the map just like you. They move in real-time.
Real-Time Updates
Your position is broadcast to other players in real-time:Position Update
Every frame, your client sends your current position to the server via
POST /mokepon/:playerId/positionEnemy Positions Received
Server responds with the positions of all other players currently on the map
Collision Detection
When you move close enough to another Mokepon, the game detects a collision and initiates combat.How Collisions Work
The game checks for overlapping bounding boxes between your Mokepon and enemies:Navigation Tips
Explore Thoroughly
The map has multiple areas - don’t stay in one spot. CPU opponents are distributed across different zones.
Watch Movement Patterns
Human players move unpredictably, while CPU opponents remain stationary. Plan your approach accordingly.
Corner Strategy
Avoid getting trapped in corners where escape is difficult if you need to evade opponents.
Type Advantage Scouting
Try to identify opponent types before engaging. Each Mokepon’s appearance indicates its element.
Map Boundaries
Your Mokepon is constrained within the canvas boundaries:Performance Considerations
The map rendering system is optimized for smooth gameplay:- Canvas clearing: Each frame clears and redraws to prevent visual artifacts
- Sprite scaling: Mokepon sizes scale with canvas for consistent appearance
- Update throttling: Position updates are sent on movement, not every frame
- Responsive design: Canvas resizes trigger recalculations for all positions
Next Steps
Combat System
Learn what happens when you collide with an opponent
Choose Your Mokepon
Review the 6 available Mokepons and their types