forked from andyhd/asteroids
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.old
84 lines (58 loc) · 2.49 KB
/
README.old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
ASTeroids
=========
A simple Asteroids clone, inspired by [Square Shooter by No Time To Play][1],
but written in Common Lisp with Lispbuilder-SDL.
Why?
----
I'm learning Common Lisp this year, and it seemed like a fun project. It was.
**UPDATE**
Wow, I made the front page of Hacker News!
I read a few questions there and on /r/programming about why I did this, and it
really was just a fun learning project, partly in response to an article I read
about refactoring the original Python version.
Thanks to everyone for the generally positive feedback!
I wasn't trying to fit it into 600 LOC or trying to make a very clean or fast
implementation.
The code is quite un-Lispy because I'm only about 4 months into learning Lisp
and this is a translation from a Python codebase, rather than starting from
scratch. I also wanted to learn a bit of CLOS. I haven't really tried any
macro programming yet.
I did write it using Vim, because that's what I'm used to, and I haven't got
into Emacs and Slime yet. It's difficult to switch, but I will give it a try.
There aren't many inline comments, I'm not a fan of them. I prefer my code to
be self documenting as far as possible.
Why are the first three letters of ASTeroids capitalized?
---------------------------------------------------------
It's a pun on Abstract Syntax Tree - which Lisp essentially is. Sorry.
How do I play it?
-----------------
You'll need to install [Steel Bank Common Lisp][2] and [the
Quicklisp package tool][3], which is pretty easy.
I've also tested with Clozure CL.
I used [Homebrew][4] to install SDL and SDL_gfx on my Mac.
Start SBCL and type the following at the REPL prompt:
```lisp
(sb-ext::set-floating-point-modes :traps nil)
(load "asteroids.lisp")
```
Quicklisp will then install some dependencies. When Quicklisp tries to install Lispbuilder-SDL, it may fail
and complain about CocoaBuilder. You have to manually compile it:
```sh
cd ~/quicklisp/dists/quicklisp/software/lispbuilder-20130312-svn/lispbuilder-sdl/cocoahelper
make
```
Then retry loading asteroids.lisp
Once that is done, you can start the game from the REPL with:
```lisp
(asteroids:main)
```
The game is mouse controlled.
What does it look like?
-----------------------
A bit rubbish, really. Next steps are learning some OpenGL to make it a bit
prettier.
![ASTeroids screenshot](https://dl.dropbox.com/u/1986317/ASTeroids.png)
[1]: http://notimetoplay.org/our-games/square-shooter/
[2]: http://www.sbcl.org/
[3]: http://www.quicklisp.org/
[4]: http://mxcl.github.com/homebrew/