Next: , Previous: , Up: Top   [Contents][Index]


1 Introduction

Sly is a 2D/3D game engine written in the GNU Guile dialect of the Scheme programming language. With the help of Guile, Sly provides all of the essential building blocks for making video games, such as: window management, input even handling, rendering, linear algebra, and powerful scripting capabilities. Sly differentiates itself from traditional game engines by providing a dynamic live codinng environment and a functional API.

For those unfamiliar with the term, “live coding” is the practice of improvised interactive programming. Sly provides a suitable environment for live coding by leveraging Guile’s cooperative REPL server. When used with a powerful editing tool such as Emacs (with the fantastic Geiser extension), programmers may evaluate arbitrary code and see the effects of their modifications in real time. This tight feedback loop allows for faster prototyping, greater productivity, and most importantly, more fun.

Functional reactive programming (FRP) is a technique used to model time-varying values with pure functions. A pure function is a function whose return value depends solely upon its arguments. They also produce no side-effects, such as calling ’set!’ on a variable or writing to a file on disk. Sly encapsulates time-varying values in “signals”, a high-level data structure for controlling the flow of events. Unlike imperative event callbacks, signals can easily be composed to form new signals. By modeling game state with pure functions and immutable data, a game can be seen as a function of time. To play the game is to “fold” (accumulate a result) over time. Constructing a game this way allows for deterministic behavior that is easier to reason about and test than the accumulation of side-effects seen in traditional game engines. The signal interface is also declarative, meaning that the programmer describes what the state of the world should be like at any given time, rather than how to get there.


Next: , Previous: , Up: Top   [Contents][Index]