]> git.lizzy.rs Git - nothing.git/blob - README.md
More details on how to compile levels using Makefile
[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 - [libsdl2-mixer-dev]
15 - [inotify-tools]
16
17 ### Ubuntu
18
19 ```console
20 $ sudo apt-get install gcc cmake libsdl2-dev libsdl2-mixer-dev inotify-tools libxml2-dev
21 ```
22
23 ### MacOS
24
25 ```console
26 $ brew install gcc cmake sdl2 sdl2_mixer
27 ```
28
29 ### NixOS
30
31 For [NixOS] we have a development environment defined in [default.nix]
32 with all of the required dependencies. You can enter the environment
33 with `nix-shell` command:
34
35 ```console
36 $ nix-shell
37 ```
38
39 ### Arch Linux
40
41 ```console
42 $ sudo pacman -S gcc cmake sdl2 sdl2_mixer inotify-tools libxml2
43 ```
44
45 ### Windows
46
47 See [Build on Windows][build-on-windows] section.
48
49 ## Quick Start
50
51 ```console
52 $ mkdir build
53 $ cd build/
54 $ cmake ..
55 $ make
56 $ ./nothing ../levels/
57 $ ./nothing_test
58 ```
59
60 ## Controls
61
62 ### Game
63
64 #### Keyboard
65
66 | Key     | Action                                                      |
67 |---------|-------------------------------------------------------------|
68 | `d`     | Move to the right                                           |
69 | `a`     | Move to the left                                            |
70 | `SPACE` | Jump                                                        |
71 | `c`     | Open debug console                                          |
72 | `r`     | Reload the current level including the Player's position    |
73 | `q`     | Reload the current level preserving the Player's position   |
74 | `p`     | Toggle game pause                                           |
75 | `l`     | Toggle transparency on objects. Useful for debugging levels |
76
77 #### Gamepad
78
79 | Button       | Action                 |
80 |--------------|------------------------|
81 | `Left Stick` | Movement of the Player |
82 | `1`          | Jump                   |
83
84 ### ConsolĂ©
85
86 | Key       | Action                   |
87 |-----------|--------------------------|
88 | `ESC`     | Exit console             |
89 | `Enter`   | Evaluate the expression  |
90 | `Up/Down` | Traverse console history |
91
92 ## Editing Levels
93
94 Generally creating a level looks like:
95
96 ```
97 SVG File -> Custom Level File -> Game
98 ```
99
100 To convert SVG to the level file and run svg2level program:
101
102 ```console
103 $ ./build/svg2level compile <svg-file> <level-file>
104 ```
105
106 All of the levels reside in the [./levels/] folder. Use
107 [./levels/Makefile] to automatically rebuild all levels:
108
109 ```console
110 $ cd levels/     # you must be inside of the `levels/` folder
111 $ make
112 ```
113
114 ### Level Editing Workflow
115
116 1. `$ inkscape ./levels/level.svg &`
117 2. `$ ./build/nothing ./levels/level.txt &`
118 3. `$ cd ./levels/`
119 4. `$ make watch`
120 5. Edit Level in Inkscape and Save
121 6. Switch to the Game and reload level by pressing Q
122 7. Go to 5
123
124 ### Objects Reference
125
126 #### SVG rect node
127
128 | Regex of id  | Description                                                                                                       |
129 |--------------|-------------------------------------------------------------------------------------------------------------------|
130 | `player`     | Defines the **position** of the Player. **Size is ignored**.                                                      |
131 | `rect.*`     | Defines the **size** and **position** of an impenetrable platform block                                           |
132 | `box.*`      | Defines the **size** and **position** of a rigid box that obeys the physics of the game                           |
133 | `region(.*)` | Defines the **size** and **position** of a region that hides the Goals. `\1` defines the id of the Goal to hide.  |
134 | `goal(.*)`   | Defines the **position** of the goal. **Size is ignored**. `\1` defines the id of the region that hides the goal. |
135 | `lava.*`     | Defines the **position** and **size** of a lava block.                                                            |
136 | `background` | Defines the **color** of the background. **Position and size are ignored**.                                       |
137 | `backrect.*` | Defines the **size** and **position** of a solid block in the background.                                         |
138
139 #### SVG text node
140
141 | Regex of id | Description                                                                |
142 |-------------|----------------------------------------------------------------------------|
143 | `label.*`   | Defines **position** and **text** of a in-game label. **Size is ignored**. |
144
145 ## Build on Windows
146
147 You need to install [conan][] and [Visual Studio 2017][visual-studio].
148
149 ### Dependencies
150
151 Current version of [SDL2/2.0.5@lasote/stable][conan-sdl2] in the conan-transit
152 repository is not compatible with the latest conan, so you'll need to install
153 it locally from the git repository:
154
155 ```console
156 $ git clone https://github.com/lasote/conan-sdl2.git # temporary, I hope hope hope
157 $ cd conan-sdl2
158 $ conan export SDL2/2.0.5@lasote/stable
159 ```
160
161 ### Building
162
163 Execute the following commands inside of the `nothing` directory:
164
165 ```console
166 $ conan install --build missing --install-folder build
167 $ cd build
168 $ cmake .. -G "Visual Studio 15 2017 Win64"
169 ```
170
171 After that, build the `build/nothing.sln` file with Visual Studio.
172
173 ## Support
174
175 You can support my work via
176
177 - Twitch channel: https://www.twitch.tv/subs/tsoding
178 - Patreon: https://www.patreon.com/tsoding
179
180 [conan]: https://www.conan.io/
181 [conan-sdl2]: https://bintray.com/conan/conan-transit/SDL2%3Alasote/2.0.5%3Astable
182 [visual-studio]: https://www.visualstudio.com/
183 [svg2rects.py]: ./devtools/svg2rects.py
184 [./levels/]: ./levels/
185 [./levels/Makefile]: ./levels/Makefile
186 [gcc]: https://gcc.gnu.org/
187 [cmake]: https://cmake.org/
188 [libsdl2-dev]: https://www.libsdl.org/
189 [libsdl2-mixer-dev]: https://www.libsdl.org/projects/SDL_mixer/
190 [NixOS]: https://nixos.org/
191 [default.nix]: ./default.nix
192 [build-on-windows]: #build-on-windows
193 [inotify-tools]: https://github.com/rvoicilas/inotify-tools