X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=README.md;h=65f43b557f118bc2df6247f387d14743d03937aa;hb=7fae19fa22e5cf1bbc8ff6d7438d9bb7dae19181;hp=e8319f66d9c1999c24991cf4b85a5b6bd3d81a3d;hpb=f974b33a6320a3a611afd276c3cb0419bf8d8441;p=nothing.git diff --git a/README.md b/README.md index e8319f66..65f43b55 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,135 @@ # Nothing -![](https://i.imgur.com/lyBoqpl.gif) -![](https://i.imgur.com/8Y21GRF.gif) +![](https://i.imgur.com/7mECYKU.gif) +![](https://i.imgur.com/ABcJqB5.gif) + +## Dependencies + +- [gcc] +- [cmake] +- [python3] +- [libsdl2-dev] +- [libsdl2-mixer-dev] +- [inotify-tools] + +### Ubuntu + +```console +$ sudo apt-get install gcc cmake libsdl2-dev libsdl2-mixer-dev python3 inotify-tools +``` + +### NixOS + +For [NixOS] we have a development environment defined in [default.nix] +with all of the required dependencies. You can enter the environment +with `nix-shell` command: + +```console +$ nix-shell +``` + +### Arch Linux + +```console +$ sudo pacman -S gcc cmake sdl2 sdl2_mixer python inotify-tools +``` + +### Windows + +See [Build on Windows][build-on-windows] section. ## Quick Start ```console -$ nix-shell # Only on NixOS $ mkdir build $ cd build/ $ cmake .. $ make -$ ./nothing +$ ./nothing ../levels/level-01.txt +$ ./nothing_test +``` + +## Controls + +### Game + +#### Keyboard + +| Key | Action | +|---------|-------------------------------------------------------------| +| `d` | Move to the right | +| `a` | Move to the left | +| `SPACE` | Jump | +| `c` | Open debug console | +| `r` | Reload the current level including the Player's position | +| `q` | Reload the current level preserving the Player's position | +| `p` | Toggle game pause | +| `l` | Toggle transparency on objects. Useful for debugging levels | + +#### Gamepad + +| Button | Action | +|--------------|------------------------| +| `Left Stick` | Movement of the Player | +| `1` | Jump | + +### Consolé + +| Key | Action | +|-----------|--------------------------| +| `ESC` | Exit console | +| `Enter` | Evaluate the expression | +| `Up/Down` | Traverse console history | + +## Editing Levels + +Generally creating a level looks like: + +``` +SVG File -> Custom Level File -> Game ``` +To convert SVG to the level file and run [svg2rects.py] script: + +```console +$ python3 ./devtools/svg2rects.py -i -o +``` + +All of the levels reside in the [./levels/] folder. Use +[./levels/Makefile] to automatically rebuild all levels. + +### Level Editing Workflow + +1. `$ inkscape ./levels/level.svg &` +2. `$ ./build/nothing ./levels/level.txt &` +3. `$ cd ./levels/` +4. `$ make watch` +5. Edit Level in Inkscape and Save +6. Switch to the Game and reload level by pressing Q +7. Go to 5 + +### Objects Reference + +#### SVG rect node + +| Regex of id | Description | +|--------------|-------------------------------------------------------------------------------------------------------------------| +| `player` | Defines the **position** of the Player. **Size is ignored**. | +| `rect.*` | Defines the **size** and **position** of an impenetrable platform block | +| `box.*` | Defines the **size** and **position** of a rigid box that obeys the physics of the game | +| `region(.*)` | Defines the **size** and **position** of a region that hides the Goals. `\1` defines the id of the Goal to hide. | +| `goal(.*)` | Defines the **position** of the goal. **Size is ignored**. `\1` defines the id of the region that hides the goal. | +| `lava.*` | Defines the **position** and **size** of a lava block. | +| `background` | Defines the **color** of the background. **Position and size are ignored**. | +| `backrect.*` | Defines the **size** and **position** of a solid block in the background. | + +#### SVG text node + +| Regex of id | Description | +|-------------|----------------------------------------------------------------------------| +| `label.*` | Defines **position** and **text** of a in-game label. **Size is ignored**. | + ## Build on Windows You need to install [conan][] and [Visual Studio 2017][visual-studio]. @@ -54,3 +169,15 @@ You can support my work via [conan]: https://www.conan.io/ [conan-sdl2]: https://bintray.com/conan/conan-transit/SDL2%3Alasote/2.0.5%3Astable [visual-studio]: https://www.visualstudio.com/ +[svg2rects.py]: ./devtools/svg2rects.py +[./levels/]: ./levels/ +[./levels/Makefile]: ./levels/Makefile +[gcc]: https://gcc.gnu.org/ +[cmake]: https://cmake.org/ +[libsdl2-dev]: https://www.libsdl.org/ +[libsdl2-mixer-dev]: https://www.libsdl.org/projects/SDL_mixer/ +[python3]: https://www.python.org/ +[NixOS]: https://nixos.org/ +[default.nix]: ./default.nix +[build-on-windows]: #build-on-windows +[inotify-tools]: https://github.com/rvoicilas/inotify-tools