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