This repo implements a simple browser based game loosely based on the classic game Spacewar!, which was developed at MIT for the PDP-1 in 1962. I worked on this project in September of 2021, while I was at the Recurse Center, in order to learn more about front-end programming in Elm.
I wrote an accompanying blog post that contains a bit more exposition about this project.
Disclaimer: The code in this repo is not especially polished. Pull requests, issues, and feedback are all welcome, but I'm sure there are many refactor opportunities, and I'm not holding this repo up as model code. In particular, you probably shouldn't reference this project to learn "idiomatic" Elm programming or game programming.
Instructions for installing Elm can be found
here. I'm using version
0.19.1
of the Elm compiler. Once Elm is installed, you'll need to
compile the project, like this:
elm make src/Main.elm --output elm.js
This should generate a new file called elm.js
that is referenced from index.html
. If the build is successful, you should see:
Success! Compiled 1 module.
Main ───> elm.js
Open index.html
in your browser (e.g. firefox index.html
at the
command line), and you should see a screen like this:
- You can play the original (two player) version of Spacewar! here.
- I found this general Elm tutorial useful while working on this project.
- I also referenced the docs for joakin/elm-canvas frequently for this project.