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