# panel-league
Panel de Pon / Tetris Attack / Puzzle Legue clone in browser

# panel-league
Panel de Pon / Tetris Attack / Puzzle Legue clone in browser

# Project structure

## lib/panel-league
The core logic of the Panel League engine resides here. The steppers in *stepper.js* handle game state evolution by combining individual transformations from *basic.js* and *garbage.js*. A stepper takes the current game state and the associated events (user input) as parameters and produces the next game state as an output. A stepper must always produce the same output for the same input so they cannot call stateful functions like `Math.random`. Random effects are achieved through a serialized pseudo random generator passed as a part of the input. The steppers modify the input state in place for efficiency. The steppers also output so called *effects* that can be used for triggering e.g. sound effects.

## lib/engine.js
The steppers themselves only handle potential game state changes and are not fit for direct use. The engine is responsible for holding what is considered the current game state and making sense of the game evolution for a user interface. The main entry point of the engine is the `.step` method that produces the next game state for the user interface to consume. The second enty point is the `.addEvent` method for sending user input. The engine transparently handles input lag and automatically rewinds the internal state if necessary. The next call to `.step` will fast-forward the internal state to what should be considered the next state with the lagged input incorporated. Sounds effects and other accessory triggers are registered through the `.on` interface. The engine makes sure that stepper effects are emitted only once even when the internal state has been partially rewound.

## lib/server.js, lib/game.js, lib/player.js
The server code is responsible for adding network support to the engine.

## ui/*
The different user interfaces handle displaying the current game state to the user and feeding the user input to the engine. A user interface may evolve freely in a main loop or be driven by a server clock.

Add an overview documentation for the project
Add an overview documentation for the project

refs https://github.com/frostburn/panel-league/issues/73
