]> git.lizzy.rs Git - nothing.git/blob - README.md
(#874) Update README
[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 - [inotify-tools]
15
16 ### Ubuntu
17
18 ```console
19 $ sudo apt-get install gcc cmake libsdl2-dev inotify-tools libxml2-dev
20 ```
21
22 ### MacOS
23
24 ```console
25 $ brew install gcc cmake sdl2
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 inotify-tools libxml2
42 ```
43
44 ### Windows
45
46 - [Visual Studio 2015+](https://visualstudio.microsoft.com/)
47 - [SDL2 VC Development Libraries](https://www.libsdl.org/release/SDL2-devel-2.0.9-VC.zip)
48
49 ## Quick Start
50
51 ### Linux
52
53 ```console
54 $ mkdir build
55 $ cd build/
56 $ cmake ..
57 $ make
58 $ cd ../data/
59 $ ../build/nothing
60 ```
61
62 ### Windows
63
64 - Enter the Visual Studio Command Line Development Environment https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line
65   - Basically just find `vcvarsall.bat` and run `vcvarsall.bat x64` inside of cmd
66 - Download [SDL2 VC Development Libraries](https://www.libsdl.org/release/SDL2-devel-2.0.9-VC.zip) and copy it to `path\to\nothing`
67
68 ```console
69 > cd path\to\nothing
70 > 7z x SDL2-devel-2.0.9-VC.zip
71 > move SDL2-2.0.9 SDL2
72 > mkdir build
73 > cmake ..
74 > cmake --build .
75 > cd ../data/
76 > ..\build\nothing
77 ```
78
79 ## Controls
80
81 ### Game
82
83 #### Keyboard
84
85 | Key     | Action                                                      |
86 |---------|-------------------------------------------------------------|
87 | `d`     | Move to the right                                           |
88 | `a`     | Move to the left                                            |
89 | `SPACE` | Jump                                                        |
90 | `c`     | Open debug console                                          |
91 | `r`     | Reload the current level including the Player's position    |
92 | `q`     | Reload the current level preserving the Player's position   |
93 | `p`     | Toggle game pause                                           |
94 | `l`     | Toggle transparency on objects. Useful for debugging levels |
95
96 #### Gamepad
97
98 | Button       | Action                 |
99 |--------------|------------------------|
100 | `Left Stick` | Movement of the Player |
101 | `1`          | Jump                   |
102
103 ### ConsolĂ©
104
105 | Key       | Action                   |
106 |-----------|--------------------------|
107 | `ESC`     | Exit console             |
108 | `Enter`   | Evaluate the expression  |
109 | `Up/Down` | Traverse console history |
110
111 ## Editing Levels
112
113 Generally creating a level looks like:
114
115 ```
116 SVG File -> Custom Level File -> Game
117 ```
118
119 To convert SVG to the level file and run svg2level program:
120
121 ```console
122 $ ./build/svg2level compile <svg-file> <level-file>
123 ```
124
125 All of the levels reside in the [./levels/] folder. Use
126 [./levels/Makefile] to automatically rebuild all levels:
127
128 ```console
129 $ cd levels/     # you must be inside of the `levels/` folder
130 $ make
131 ```
132
133 ### Level Editing Workflow
134
135 1. `$ inkscape ./levels/level.svg &`
136 2. `$ ./build/nothing ./levels/level.txt &`
137 3. `$ cd ./levels/`
138 4. `$ make watch`
139 5. Edit Level in Inkscape and Save
140 6. Switch to the Game and reload level by pressing Q
141 7. Go to 5
142
143 ### Objects Reference
144
145 #### SVG rect node
146
147 | Regex of id  | Description                                                                                                       |
148 |--------------|-------------------------------------------------------------------------------------------------------------------|
149 | `player`     | Defines the **position** of the Player. **Size is ignored**.                                                      |
150 | `rect.*`     | Defines the **size** and **position** of an impenetrable platform block                                           |
151 | `box.*`      | Defines the **size** and **position** of a rigid box that obeys the physics of the game                           |
152 | `region(.*)` | Defines the **size** and **position** of a region that hides the Goals. `\1` defines the id of the Goal to hide.  |
153 | `goal(.*)`   | Defines the **position** of the goal. **Size is ignored**. `\1` defines the id of the region that hides the goal. |
154 | `lava.*`     | Defines the **position** and **size** of a lava block.                                                            |
155 | `background` | Defines the **color** of the background. **Position and size are ignored**.                                       |
156 | `backrect.*` | Defines the **size** and **position** of a solid block in the background.                                         |
157
158 #### SVG text node
159
160 | Regex of id | Description                                                                |
161 |-------------|----------------------------------------------------------------------------|
162 | `label.*`   | Defines **position** and **text** of a in-game label. **Size is ignored**. |
163
164 ## Support
165
166 You can support my work via
167
168 - Twitch channel: https://www.twitch.tv/subs/tsoding
169 - Patreon: https://www.patreon.com/tsoding
170
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 [NixOS]: https://nixos.org/
179 [default.nix]: ./default.nix
180 [inotify-tools]: https://github.com/rvoicilas/inotify-tools