Scene Interface
All scenes implement theGScene interface:
shared/scene.go:5-10
Methods
Setup(): Initialize scene resources (fonts, textures, UI components)Cleanup(): Dispose of scene resources when switching scenesUpdate(): Handle input and update scene state (called every tick)Draw(screen *ebiten.Image): Render the scene to the screen
Scene Manager
TheGSceneManager handles transitions between different scenes:
shared/scene.go:12-23
- Calls
Cleanup()on the current scene (if any) - Calls
Setup()on the new scene - Updates the current scene reference
Login Screen
The login screen is the initial scene shown when the client starts.Structure
game/loginscreen.go:16-29
Rendering
The login screen renders:- Background color (RGB: 17, 33, 43)
- “GRPG” title text (48pt font)
- “Enter Name Below” prompt (24pt font)
- Username textbox
- Login button
- Error message if login fails
game/loginscreen.go:112-124
Playground (Main Game Scene)
The playground scene handles the main gameplay rendering.Structure
game/playground.go:19-37
Rendering Pipeline
The playground uses a multi-layer rendering approach:game/playground.go:145-159
Rendering Order
- World (
drawWorld): Tiles, objects, and NPCs - Other Players (
drawOtherPlayers): Remote players with walking animations - Local Player (
drawPlayer): Local player with walking animations and name tag - Camera Transform: Apply camera offset to world
- Game Frame (
drawGameFrame): UI overlay (inventory, skills, talkbox)
Camera System
The camera follows the player with smooth scrolling:game/playground.go:161-195
- Centers on the player when near the center of a zone
- Snaps instantly when crossing zone boundaries
- Smoothly interpolates at 16 pixels per frame otherwise
World Rendering
The world is rendered tile-by-tile for the current 16x16 zone:game/playground.go:210-256
- Render base tile texture
- If an object exists, render object with appropriate state texture
- If no object but NPC exists, render NPC texture
Player Animation
Players are rendered with 4-frame walking animations:game/playground.go:258-277
Game Frame UI
The game frame includes:- Right panel: Inventory or skills display
- Bottom panel: Current action, talkbox, player coordinates
- Inventory/Skills toggle buttons
game/playground.go:300-349
Screen Layout
- Game world viewport: 768x768 pixels (12x12 tiles visible)
- Right panel: 384 pixels wide (x: 768-1152)
- Bottom panel: 192 pixels tall (y: 768-960)
- Total screen: 1152x960 pixels