How kokincho/grafight works
Grafight is a browser artillery game where players enter mathematical functions to define projectile paths and try to eliminate opposing soldiers. The main flow runs from game setup and function entry through expression compilation, trajectory simulation, collision resolution, and a rendered result. README-documented branches include four function modes, turn-based and real-time play, a 12-stage campaign, customization, saves, and replay. The excerpts show core game and parser behavior; several feature relationships are documented only in the README, so those edges cite it.
Main entry points: game.js Game control · index.html Game interface · parser.js Expression parser
Components 17
Play and setup
- Game interface
index.html - Game control
game.js - Function input
game.js
Shot simulation
- Expression parser
parser.js - Trajectory simulation
game.js - Terrain and obstacles
game.js - Collision and combat
game.js - Canvas rendering
game.js
Game modes
- Local multiplayer
game.js - Campaign stages
game.js - Shot options
game.js - Soldier state
game.js
Persistence and review
- Save and resume
game.js - Campaign progress
game.js - Replay and logs
game.js
Other components
- Player
- Browser
Connections 19
- Player → Game interface: uses
README.md - Game interface → Game control: starts play
- Game control → Function input: collects input
game.js - Function input → Expression parser: compiles expression
game.js - Game control → Trajectory simulation: creates shots
game.js - Trajectory simulation → Expression parser: evaluates function
game.js - Trajectory simulation → Terrain and obstacles: checks obstacles
game.js - Game control → Collision and combat: resolves shots
game.js - Collision and combat → Soldier state: updates soldiers
game.js - Canvas rendering → Game interface: draws board
- Game control → Local multiplayer: runs mode
README.md - Game control → Campaign stages: loads stages
README.md - Game control → Shot options: applies options
README.md - Campaign stages → Campaign progress: saves progress
README.md - Player → Save and resume: saves or resumes
README.md - Game control → Save and resume: manages session
game.js - Game control → Replay and logs: records match
game.js - Player → Replay and logs: reviews match
README.md - Browser → Campaign progress: stores locally
README.md