I’ve been prototyping browser games recently. Here’s my approach:
- Sketch out every screen in the game on paper. Map out the flow between screens.
- Create rudimentary versions of every screen using basic HTML. I limit the resolution of each screen to 1280×720 and disable scrolling. Resist the urge to do any sort of styling or complex layout design at this stage.
- Turn each screen into a static React component.
- Move any variable data into props on each React component.
- “Lift state up” as discussed in the React documentation. At this point I have a function which can render a single “frame” of my game.
- Implement state transitions in functions outside of React.
- Wire the React components up to those state transition functions.
- Implement screen transitions in React.
At this point I have a functional prototype. I can iterate on the gameplay until it’s fun (or until I give up). The code is very simple: usually one HTML file and two JavaScript files. This approach allows me to avoid art and design (my weak points) and focus on gameplay and programming (my strong points).