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