Space Boss Battles is 2D arcade space shooter game. This version of the game is complete rewrite in Rust programming language. Originally game was written in CoolBasic programming language.
This project is also my first proper project written in Rust and will also serve as coursework for programming project course.
For more background information about the project and it's current architecture, see documentation/project-self-evaluation.md.
Downloadable builds are not currently available so compiling source code is required to play the game or you can test the experimental web browser build.
Game:
- 3 difficulty settings
- 4 game levels
Graphical User Interface, GUI:
- Main menu
- Settings
- Pause menu
- Display game status
- FPS counter
- GUI scaling for different display sizes
Input:
- Keyboard
- Mouse (only GUIButton support)
- Game controllers
- Touch screen
- Configurable controls
Renderer:
- OpenGL 3.3 and OpenGL ES 2.0 support
- Full screen mode
- Option to disable vertical synchronization
Audio:
- Sound effects
- Music (not included, but supported)
Platforms:
- Linux
- Windows
- Mac
- Android
- Web (experimental support)
- Raspberry Pi
General features:
- Settings file
Key | Action |
---|---|
WASD or UpDownLeftRight | Move |
Space or LeftCtrl or RightCtrl | Shoot |
Esc | Pause game |
Enter | Select |
Button/Stick | Action |
---|---|
Left and right stick, DPad | Move |
A | Select/Shoot |
Trigger and shoulder buttons | Shoot |
Back | Pause game |
Settings file name is space_boss_battles_settings.txt
and it will be created or
overwritten to the current working directory every time the game exits.
You shouldn't have to change the file manually, unless you want to change game controller mapping for a game controller which SDL2 library doesn't provide a default game controller mapping. Only those game controllers which doesn't have a default game controller mapping will appear to the file with default mapping defined in game's source code.
When modifying game controller mapping, you might want to start the game with option to print joystick events to the command line to identify correct button or axis numbers.
Game supports playing music, but currently there aren't any music included with the game.
By default game tries to play music.ogg
named file in current working directory. You can
override this with file path specified with command line option.
Supported music file formats are the ones which SDL2_mixer library supports.
Option | Description |
---|---|
--help or -h | Prints help text about command line options. |
--fps | Print fps number to command line. |
--joystick-events | Print joystick events to command line. |
--music FILE_PATH | Set path to music file which game tries to play. |
If running the game with Cargo, you can set command line options like this:
cargo run --release -- --joystick-events --music /path/to/music/file
If the game crashes, doesn't start or there is no sound effects, start the game from the command line and check the error messages.
Typical reasons for game to crash:
- Window or OpenGL initialization fails.
- All textures are not found.
- All sound effects are not found.
-
Install Rust, https://www.rust-lang.org/en-US/index.html
-
Install SDL2 and SDL2_mixer libraries and developer packages from package repositories. On Ubuntu 16.04 that happens with this command.
sudo apt-get install libsdl2-2.0-0 libsdl2-dev libsdl2-mixer-2.0-0 libsdl2-mixer-dev
- Clone (or download) the repository
git clone https://github.com/jutuon/space-boss-battles.git
- Change working directory to repository directory
cd space-boss-battles
- Build and run the game with Cargo
cargo run --release
To run the game with OpenGL ES 2.0, build and run with this command
cargo run --release --features "gles"
Note that you may need to set GPU RAM size to at least 128 MB to run the game with frame rate of 60 fps at 1080p resolution.
-
Enable experimental OpenGL driver from
raspi-config
. -
Follow Linux instructions.
-
Build the game with OpenGL ES support.
See this page for more information: SDL2 Library and Raspberry Pi - Raspberry Pi 1 and Zero
Note that you should only use game controllers with SDL2 rpi video driver, see the link above for more details.
If you use the build script from link above, run the script like this:
./build_sdl2.py --build-sdl2 --build-mixer --add-profile-variables
Before building and running the game with Cargo, set LIBRARY_PATH
and LD_LIBRARY_PATH
environment variables, and
then build and run the game with this command:
SDL_VIDEODRIVER=rpi cargo run --release --features "gles"
You can generate documentation and open it by running this command in root directory of the repository.
cargo doc --open
Note that cargo doc
will only create documentation for public items in the code.
See also the documentation in repository's documentation directory.
This project's code is licensed under
- Apache License, Version 2.0, LICENSE-APACHE
or
- MIT License, LICENSE-MIT
You can choose either one from licenses above when you do something with this code.
Image and audio files are licensed under Creative Commons Attribution 4.0 International License.
Contributions will be licensed as stated in License section of this file.