]> git.lizzy.rs Git - nothing.git/blob - README.md
44a87dfafafac68fe274df7af284b224ae3ba215
[nothing.git] / README.md
1 [![Build Status](https://travis-ci.org/tsoding/nothing.svg?branch=master)](https://travis-ci.org/tsoding/nothing)
2 [![Build status](https://ci.appveyor.com/api/projects/status/gxfgojq4ko98e0g0/branch/master?svg=true)](https://ci.appveyor.com/project/rexim/nothing/branch/master)
3
4 # Nothing
5
6 ![](https://i.imgur.com/7mECYKU.gif)
7 ![](https://i.imgur.com/ABcJqB5.gif)
8
9 ## Dependencies
10
11 - [gcc]
12 - [cmake]
13 - [libsdl2-dev]
14 - [inotify-tools]
15
16 ### Ubuntu
17
18 ```console
19 $ sudo apt-get install gcc cmake libsdl2-dev inotify-tools libxml2-dev
20 ```
21
22 ### MacOS
23
24 ```console
25 $ brew install gcc cmake sdl2
26 ```
27
28 ### NixOS
29
30 For [NixOS] we have a development environment defined in [default.nix]
31 with all of the required dependencies. You can enter the environment
32 with `nix-shell` command:
33
34 ```console
35 $ nix-shell
36 ```
37
38 ### Arch Linux
39
40 ```console
41 $ sudo pacman -S gcc cmake sdl2 inotify-tools libxml2
42 ```
43
44 ### Windows
45
46 - [Visual Studio 2015+](https://visualstudio.microsoft.com/)
47 - [SDL2 VC Development Libraries](https://www.libsdl.org/release/SDL2-devel-2.0.9-VC.zip)
48
49 ## Quick Start
50
51 ### Linux
52
53 ```console
54 $ mkdir build
55 $ cd build/
56 $ cmake ..
57 $ make
58 $ ./nothing ../levels/
59 $ ./nothing_test
60 ```
61
62 ### Windows
63
64 - Enter the Visual Studio Command Line Development Environment https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line
65 - Download [SDL2 VC Development Libraries](https://www.libsdl.org/release/SDL2-devel-2.0.9-VC.zip) and copy it to `path\to\nothing`
66
67 ```console
68 > cd path\to\nothing
69 > 7z x SDL2-devel-2.0.9-VC.zip
70 > move SDL2-2.0.9 SDL2
71 > mkdir build
72 > cmake ..
73 > cmake --build .
74 > nothing ..\levels
75 ```
76
77 ## Controls
78
79 ### Game
80
81 #### Keyboard
82
83 | Key     | Action                                                      |
84 |---------|-------------------------------------------------------------|
85 | `d`     | Move to the right                                           |
86 | `a`     | Move to the left                                            |
87 | `SPACE` | Jump                                                        |
88 | `c`     | Open debug console                                          |
89 | `r`     | Reload the current level including the Player's position    |
90 | `q`     | Reload the current level preserving the Player's position   |
91 | `p`     | Toggle game pause                                           |
92 | `l`     | Toggle transparency on objects. Useful for debugging levels |
93
94 #### Gamepad
95
96 | Button       | Action                 |
97 |--------------|------------------------|
98 | `Left Stick` | Movement of the Player |
99 | `1`          | Jump                   |
100
101 ### ConsolĂ©
102
103 | Key       | Action                   |
104 |-----------|--------------------------|
105 | `ESC`     | Exit console             |
106 | `Enter`   | Evaluate the expression  |
107 | `Up/Down` | Traverse console history |
108
109 ## Editing Levels
110
111 Generally creating a level looks like:
112
113 ```
114 SVG File -> Custom Level File -> Game
115 ```
116
117 To convert SVG to the level file and run svg2level program:
118
119 ```console
120 $ ./build/svg2level compile <svg-file> <level-file>
121 ```
122
123 All of the levels reside in the [./levels/] folder. Use
124 [./levels/Makefile] to automatically rebuild all levels:
125
126 ```console
127 $ cd levels/     # you must be inside of the `levels/` folder
128 $ make
129 ```
130
131 ### Level Editing Workflow
132
133 1. `$ inkscape ./levels/level.svg &`
134 2. `$ ./build/nothing ./levels/level.txt &`
135 3. `$ cd ./levels/`
136 4. `$ make watch`
137 5. Edit Level in Inkscape and Save
138 6. Switch to the Game and reload level by pressing Q
139 7. Go to 5
140
141 ### Objects Reference
142
143 #### SVG rect node
144
145 | Regex of id  | Description                                                                                                       |
146 |--------------|-------------------------------------------------------------------------------------------------------------------|
147 | `player`     | Defines the **position** of the Player. **Size is ignored**.                                                      |
148 | `rect.*`     | Defines the **size** and **position** of an impenetrable platform block                                           |
149 | `box.*`      | Defines the **size** and **position** of a rigid box that obeys the physics of the game                           |
150 | `region(.*)` | Defines the **size** and **position** of a region that hides the Goals. `\1` defines the id of the Goal to hide.  |
151 | `goal(.*)`   | Defines the **position** of the goal. **Size is ignored**. `\1` defines the id of the region that hides the goal. |
152 | `lava.*`     | Defines the **position** and **size** of a lava block.                                                            |
153 | `background` | Defines the **color** of the background. **Position and size are ignored**.                                       |
154 | `backrect.*` | Defines the **size** and **position** of a solid block in the background.                                         |
155
156 #### SVG text node
157
158 | Regex of id | Description                                                                |
159 |-------------|----------------------------------------------------------------------------|
160 | `label.*`   | Defines **position** and **text** of a in-game label. **Size is ignored**. |
161
162 ## Support
163
164 You can support my work via
165
166 - Twitch channel: https://www.twitch.tv/subs/tsoding
167 - Patreon: https://www.patreon.com/tsoding
168
169 [visual-studio]: https://www.visualstudio.com/
170 [svg2rects.py]: ./devtools/svg2rects.py
171 [./levels/]: ./levels/
172 [./levels/Makefile]: ./levels/Makefile
173 [gcc]: https://gcc.gnu.org/
174 [cmake]: https://cmake.org/
175 [libsdl2-dev]: https://www.libsdl.org/
176 [NixOS]: https://nixos.org/
177 [default.nix]: ./default.nix
178 [inotify-tools]: https://github.com/rvoicilas/inotify-tools