1
1
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.6 KiB

4 years ago
# A computer game
2 years ago
[Developement Blog](https://alistairmichael.com/projects/game/)
4 years ago
4 years ago
![image](https://alistairmichael.com/media/game3.png)
2 years ago
This is a simple game where you play as a bouncy square rock that has a grappling hook. It can use the grappling hook to swing to the end of the cave. There is no reward for doing so, but there is a timer.
### Description and Features
- Entirely written in C using only the SDL2 graphics and audio libraries.
- Procedurally generated cave environment using a random walk and procedurally
generated colour palettes.
- Cute synthesized sound effects using integer overflow a la [bytebeat](https://arxiv.org/pdf/1112.1368.pdf).
- 2D Graphics using the SDL2 API, no assets are used aside from the font.
- Point mass elastic physics with elastic collisions.
- Separating Axis Theorem collision test for convex polygons.
- Framerate independent physics uses a fixed timestep and completes as many
steps as neccessary to catch up to each frame.
- Physics runs in a separate thread and state is managed using shared memory and
locks.
- Player physics interactions use forces applied to physics bodies which are
integrated into impulses and positions.
- Grappling hook.
# Installation
## Prebuilt Binary
See the releases tab.
4 years ago
On Linux and other Unix-Like operating systems you will need to install the SDL2
package from your package maintainer.
4 years ago
```sh
2 years ago
# on Fedora
sudo dnf install SDL2
```
# Build Instructions
4 years ago
4 years ago
## On Linux / Unix
Install the [libSDL2](http://libsdl.org/download-2.0.php) runtime and SDL2
development packages from your package distributor. On Fedora, this
is the `SDL2` and `SDL2-devel` packages.
4 years ago
```sh
4 years ago
git clone --recurse-submodules https://git.topost.net/alistair/space_game.git
```
4 years ago
(if you forget `--recurse-submodules` you can use, `git submodule init`, `git submodule update`.)
### For Linux
4 years ago
```sh
make clean
make target=linux
```
### For Windows
You have to have mingw and the mingw libsdl library (I think).
4 years ago
```sh
sudo dnf install mingw64-SDL2 mingw64-SDL2_image mingw64-SDL2_ttf mingw64-winpthreads mingw64-winpthreads-static
4 years ago
```
Run setup.sh to download the SDL2 static libraries and `SDL2.dll`.
4 years ago
```
./setup.sh
make clean
make target=windows
```
4 years ago
## FreeBSD
You need to download the header files and put them in the source folder, with
the folder name SDL2. You also need the `sdl2` and `gmake` packages.
Something like this:
```sh
cd /tmp && wget https://www.libsdl.org/release/SDL2-2.0.12.zip && unzip SDL2-2.0.12.zip
mv /tmp/SDL2-2.0.12/include $source_dir/SDL2
pkg install sdl2 gmake
cd $source_dir
gmake
```
### With debug flags
4 years ago
Append `debug=true` to the make command.