]> git.lizzy.rs Git - nothing.git/blob - README.md
Fix Windows instructions
[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 > cd build
74 > cmake ..
75 > cmake --build .
76 > cd ../data/
77 > ..\build\nothing
78 ```
79
80 ## Controls
81
82 ### Game
83
84 #### Keyboard
85
86 | Key     | Action                                                      |
87 |---------|-------------------------------------------------------------|
88 | `d`     | Move to the right                                           |
89 | `a`     | Move to the left                                            |
90 | `SPACE` | Jump                                                        |
91 | `c`     | Open debug console                                          |
92 | `r`     | Reload the current level including the Player's position    |
93 | `q`     | Reload the current level preserving the Player's position   |
94 | `p`     | Toggle game pause                                           |
95 | `l`     | Toggle transparency on objects. Useful for debugging levels |
96
97 #### Gamepad
98
99 | Button       | Action                 |
100 |--------------|------------------------|
101 | `Left Stick` | Movement of the Player |
102 | `1`          | Jump                   |
103
104 ### ConsolĂ©
105
106 | Key       | Action                   |
107 |-----------|--------------------------|
108 | `ESC`     | Exit console             |
109 | `Enter`   | Evaluate the expression  |
110 | `Up/Down` | Traverse console history |
111
112 ## Editing Levels
113
114 Generally creating a level looks like:
115
116 ```
117 SVG File -> Custom Level File -> Game
118 ```
119
120 To convert SVG to the level file and run svg2level program:
121
122 ```console
123 $ ./build/svg2level compile <svg-file> <level-file>
124 ```
125
126 All of the levels reside in the [./levels/] folder. Use
127 [./levels/Makefile] to automatically rebuild all levels:
128
129 ```console
130 $ cd levels/     # you must be inside of the `levels/` folder
131 $ make
132 ```
133
134 ### Level Editing Workflow
135
136 1. `$ inkscape ./levels/level.svg &`
137 2. `$ ./build/nothing ./levels/level.txt &`
138 3. `$ cd ./levels/`
139 4. `$ make watch`
140 5. Edit Level in Inkscape and Save
141 6. Switch to the Game and reload level by pressing Q
142 7. Go to 5
143
144 ### Objects Reference
145
146 #### SVG rect node
147
148 | Regex of id  | Description                                                                                                       |
149 |--------------|-------------------------------------------------------------------------------------------------------------------|
150 | `player`     | Defines the **position** of the Player. **Size is ignored**.                                                      |
151 | `rect.*`     | Defines the **size** and **position** of an impenetrable platform block                                           |
152 | `box.*`      | Defines the **size** and **position** of a rigid box that obeys the physics of the game                           |
153 | `region(.*)` | Defines the **size** and **position** of a region that hides the Goals. `\1` defines the id of the Goal to hide.  |
154 | `goal(.*)`   | Defines the **position** of the goal. **Size is ignored**. `\1` defines the id of the region that hides the goal. |
155 | `lava.*`     | Defines the **position** and **size** of a lava block.                                                            |
156 | `background` | Defines the **color** of the background. **Position and size are ignored**.                                       |
157 | `backrect.*` | Defines the **size** and **position** of a solid block in the background.                                         |
158
159 #### SVG text node
160
161 | Regex of id | Description                                                                |
162 |-------------|----------------------------------------------------------------------------|
163 | `label.*`   | Defines **position** and **text** of a in-game label. **Size is ignored**. |
164
165 ## Support
166
167 You can support my work via
168
169 - Twitch channel: https://www.twitch.tv/subs/tsoding
170 - Patreon: https://www.patreon.com/tsoding
171
172 [visual-studio]: https://www.visualstudio.com/
173 [svg2rects.py]: ./devtools/svg2rects.py
174 [./levels/]: ./levels/
175 [./levels/Makefile]: ./levels/Makefile
176 [gcc]: https://gcc.gnu.org/
177 [cmake]: https://cmake.org/
178 [libsdl2-dev]: https://www.libsdl.org/
179 [NixOS]: https://nixos.org/
180 [default.nix]: ./default.nix
181 [inotify-tools]: https://github.com/rvoicilas/inotify-tools