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