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