summaryrefslogtreecommitdiff
path: root/README.org
diff options
context:
space:
mode:
Diffstat (limited to 'README.org')
-rw-r--r--README.org101
1 files changed, 57 insertions, 44 deletions
diff --git a/README.org b/README.org
index fdc45e4..0994efb 100644
--- a/README.org
+++ b/README.org
@@ -1,37 +1,44 @@
-* guile-2d
+* Sly
- Guile-2d is a free software 2D game engine written in GNU Guile
- Scheme. It provides an abstraction layer above SDL and OpenGL for
- common 2D game programming requirements such as:
+ Sly is a free software game engine written in GNU Guile Scheme. It
+ provides an abstraction layer above SDL and OpenGL for common game
+ programming requirements such as:
+ - Meshes
+ - Shaders
- Sprites
- Animation
- Tilesets
- - Tile maps
- Scene graph
- - Input handling
+ - Keyboard/mouse input
- Scripting
+ Sly differentiates itself from other game engines by providing an
+ interactive development environment via Guile's read-eval-print-loop
+ (REPL), exposing a functional API instead of an object-oriented one,
+ and encouraging reactive programming.
+
** Inspiration
- Every programming language should have a fun, easy to use 2D game
- library. Guile-2d draws its inspiration from great
- libraries/engines such as [[http://love2d.org/][LÖVE]], [[http://pygame.org/][Pygame]], and [[http://pyglet.org/][Pyglet]].
+
+ Every programming language should have a fun, easy to use game
+ library. Sly draws its inspiration from great libraries/engines
+ such as [[http://love2d.org/][LÖVE]], [[http://pygame.org/][Pygame]], and [[http://pyglet.org/][Pyglet]]. Sly's functional reactive nature
+ is heavily inspired by the [[http://elm-lang.org/][Elm]] programming language.
** Example
- Here is the simplest guile-2d application (so far).
+
+ Here is the simplest Sly application (so far).
#+BEGIN_SRC scheme
- (use-modules (2d game)
- (2d sprite)
- (2d window))
+ (use-modules (sly game)
+ (sly sprite)
+ (sly window))
(define sprite
(load-sprite "images/p1_front.png"
#:position #(320 240)))
- (add-hook! draw-hook
- (lambda (dt alpha)
- (draw-sprite sprite)))
+ (add-hook! draw-hook (lambda (dt alpha) (draw-sprite sprite)))
(with-window (make-window #:title "Simple Sprite Demo")
(run-game-loop))
@@ -40,7 +47,8 @@
** Features
*** The Game Loop
- Guile-2d's game loop doesn't tie drawing and updating
+
+ Sly's game loop doesn't tie drawing and updating
together. Instead, updates happen on a fixed timestep (60 ticks
per second by default) while drawing happens as many times as
possible. A framerate indepedent loop mitigates slow down that the
@@ -61,6 +69,7 @@
#+END_SRC
*** Sprites
+
Sprites encapsulate the presentation of an image or a region of an
image.
@@ -68,12 +77,12 @@
=load-sprite= procedure. All arguments except the filename are
optional keyword arguments.
- Guile-2d uses the FreeImage library and can load many different
- image formats. See the FreeImage [[http://freeimage.sourceforge.net/features.html][features page]] for a full list of
+ Sly uses the FreeImage library and can load many different image
+ formats. See the FreeImage [[http://freeimage.sourceforge.net/features.html][features page]] for a full list of
supported formats.
#+BEGIN_SRC scheme
- (use-modules (2d sprite))
+ (use-modules (sly sprite))
(define sprite
(load-sprite "cirno.png"
@@ -104,12 +113,13 @@
#+END_SRC
*** Keyboard and Mouse Input
- There are hooks within the =(2d keyboard)= and =(2d mouse)=
+
+ There are hooks within the =(sly keyboard)= and =(sly mouse)=
modules that can be used to respond to user input.
#+BEGIN_SRC scheme
- (use-modules (2d keyboard)
- (2d mouse))
+ (use-modules (sly keyboard)
+ (sly mouse))
;; Quit when ESC is pressed.
(add-hook! key-press-hook
@@ -126,7 +136,8 @@
In the future, there will be more convenient ways to respond to
user input similar to how keymaps work in Emacs.
-*** Coroutines and Agendas
+*** Coroutines and the Agenda
+
The ability to write scripts is very important for most games. A
script for an RPG NPC could look like this:
@@ -155,8 +166,8 @@
such that it does not halt further program execution.
#+BEGIN_SRC scheme
- (use-modules (2d agenda)
- (2d coroutine))
+ (use-modules (sly agenda)
+ (sly coroutine))
(coroutine
(while #t
@@ -164,15 +175,14 @@
(wait 60)
(walk 'down)
(wait 60)))
-
#+END_SRC
=coroutine= is a useful macro that evaluates a block of code as a
coroutine. =wait= aborts the procedure and schedules the
continuation inside of the agenda. In this example, the script is
- paused for 1 second after each step. Since guile-2d enforces a
- fixed timestep and updates 60 times per second by default, 60
- ticks is equivalent to 1 second.
+ paused for 1 second after each step. Since Sly enforces a fixed
+ timestep and updates 60 times per second by default, 60 ticks is
+ equivalent to 1 second.
You can also use the agenda to schedule the evaluation of any
thunk even if it isn't a coroutine.
@@ -193,6 +203,7 @@
tick.
*** Functional Reactive Programming
+
Games are composed of values that evolve as time passes. The
player's score, the current stage, an enemy's hit points, etc. all
change in response to events that happen at discrete points in
@@ -201,8 +212,8 @@
and/or assign to variables. However, this approach, while simple
and effective, comes at the price of readability and
comprehension. Instead of explicitly mutating data and entering
- "callback hell", guile-2d abstracts and formalizes the process
- using a functional reactive programming style.
+ "callback hell", Sly abstracts and formalizes the process using a
+ functional reactive programming style.
Time-varying values are called "signals", and they are created in
a declarative and functional manner. Rather than describing the
@@ -244,10 +255,10 @@
what your changes do to the game without having to restart the
program every time.
- Guile-2d integrates Guile's cooperative REPL server with the game
- loop. To activate this feature, import the =(2d repl)= module. To
- connect to the REPL server, use the [[http://www.nongnu.org/geiser/][Geiser]] extension for GNU Emacs
- or telnet.
+ Sly integrates Guile's cooperative REPL server with the game loop.
+ To activate this feature, import the =(sly repl)= module and call
+ =(start-sly-repl)=. To connect to the REPL server, use the [[http://www.nongnu.org/geiser/][Geiser]]
+ extension for GNU Emacs or telnet.
*Geiser*
@@ -264,8 +275,9 @@
#+END_SRC
** Building
- Guile-2d uses the typical GNU build system. First run =autogen.sh=
- and then do the usual incantations.
+
+ Sly uses the typical GNU build system. First run =autogen.sh= and
+ then do the usual incantations.
#+BEGIN_SRC sh
./autogen.sh
@@ -277,15 +289,15 @@
See =INSTALL.org= for more detailed installation instructions.
** Running Examples
- To run an example when guile-2d has been installed:
+
+ To run an example when Sly has been installed:
#+BEGIN_SRC sh
cd examples
guile simple.scm
#+END_SRC
- To run an example without installing guile-2d (useful when
- developing):
+ To run an example without installing Sly (useful when developing):
#+BEGIN_SRC sh
cd examples
@@ -297,15 +309,16 @@
- Press the =ESCAPE= key
** Using the Sandbox
- If you want to quickly create a guile-2d environment and start
+
+ If you want to quickly create a Sly environment and start
experimenting, run =./pre-inst-env sandbox=. It will import many
useful modules, start a REPL server, open a window, and start the
game loop. Simply connect to the REPL server and start hacking!
** Platforms
- Guile-2d supports GNU/Linux currently. OS X support is in the
- works, but there are problems with guile-sdl. See
+ Sly supports GNU/Linux currently. OS X support is in the works, but
+ there are problems with guile-sdl. See
https://github.com/davexunit/guile-2d/issues/2 for more details.
** Dependencies