Framed glasslike: Fix z-fighting, improve codestyle (#7826)
[oweals/minetest.git] / README.md
1 Minetest
2 ========
3
4 [![Build Status](https://travis-ci.org/minetest/minetest.svg?branch=master)](https://travis-ci.org/minetest/minetest)
5 [![Translation status](https://hosted.weblate.org/widgets/minetest/-/svg-badge.svg)](https://hosted.weblate.org/engage/minetest/?utm_source=widget)
6 [![License](https://img.shields.io/badge/license-LGPLv2.1%2B-blue.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
7
8 An InfiniMiner/Minecraft inspired game.
9
10 Copyright (C) 2010-2018 Perttu Ahola <celeron55@gmail.com>
11 and contributors (see source file comments and the version control log)
12
13 In case you downloaded the source code:
14 ---------------------------------------
15 If you downloaded the Minetest Engine source code in which this file is
16 contained, you probably want to download the [Minetest Game](https://github.com/minetest/minetest_game/)
17 project too. See its README.txt for more information.
18
19 Further documentation
20 ----------------------
21 - Website: http://minetest.net/
22 - Wiki: http://wiki.minetest.net/
23 - Developer wiki: http://dev.minetest.net/
24 - Forum: http://forum.minetest.net/
25 - GitHub: https://github.com/minetest/minetest/
26 - [doc/](doc/) directory of source distribution
27
28 Default controls
29 ----------------
30 All controls are re-bindable using settings.
31 Some can be changed in the key config dialog in the settings tab.
32
33 | Button                        | Action                                                         |
34 |-------------------------------|----------------------------------------------------------------|
35 | Move mouse                    | Look around                                                    |
36 | W, A, S, D                    | Move                                                           |
37 | Space                         | Jump/move up                                                   |
38 | Shift                         | Sneak/move down                                                |
39 | Q                             | Drop itemstack                                                 |
40 | Shift + Q                     | Drop single item                                               |
41 | Left mouse button             | Dig/punch/take item                                            |
42 | Right mouse button            | Place/use                                                      |
43 | Shift + right mouse button    | Build (without using)                                          |
44 | I                             | Inventory menu                                                 |
45 | Mouse wheel                   | Select item                                                    |
46 | 0-9                           | Select item                                                    |
47 | Z                             | Zoom (needs zoom privilege)                                    |
48 | T                             | Chat                                                           |
49 | /                             | Command                                                        |
50 | Esc                           | Pause menu/abort/exit (pauses only singleplayer game)          |
51 | R                             | Enable/disable full range view                                 |
52 | +                             | Increase view range                                            |
53 | -                             | Decrease view range                                            |
54 | K                             | Enable/disable fly mode (needs fly privilege)                  |
55 | J                             | Enable/disable fast mode (needs fast privilege)                |
56 | H                             | Enable/disable noclip mode (needs noclip privilege)            |
57 | E                             | Move fast in fast mode                                         |
58 | F1                            | Hide/show HUD                                                  |
59 | F2                            | Hide/show chat                                                 |
60 | F3                            | Disable/enable fog                                             |
61 | F4                            | Disable/enable camera update (Mapblocks are not updated anymore when disabled, disabled in release builds)  |
62 | F5                            | Cycle through debug information screens                        |
63 | F6                            | Cycle through profiler info screens                            |
64 | F7                            | Cycle through camera modes                                     |
65 | F9                            | Cycle through minimap modes                                    |
66 | Shift + F9                    | Change minimap orientation                                     |
67 | F10                           | Show/hide console                                              |
68 | F12                           | Take screenshot                                                |
69
70 Paths
71 -----
72 Locations:
73
74 * `bin`   - Compiled binaries
75 * `share` - Distributed read-only data
76 * `user`  - User-created modifiable data
77
78 Where each location is on each platform:
79
80 * Windows .zip / RUN_IN_PLACE source:
81     * bin   = `bin`
82     * share = `.`
83     * user  = `.`
84 * Windows installed:
85     * $bin   = `C:\Program Files\Minetest\bin (Depends on the install location)`
86     * $share = `C:\Program Files\Minetest (Depends on the install location)`
87     * $user  = `%Appdata%\Minetest`
88 * Linux installed:
89     * `bin`   = `/usr/bin`
90     * `share` = `/usr/share/minetest`
91     * `user`  = `~/.minetest`
92 * macOS:
93     * `bin`   = `Contents/MacOS`
94     * `share` = `Contents/Resources`
95     * `user`  = `Contents/User OR ~/Library/Application Support/minetest`
96
97 Worlds can be found as separate folders in: `user/worlds/`
98
99 Configuration file:
100 -------------------
101 - Default location:
102     `user/minetest.conf`
103 - It is created by Minetest when it is ran the first time.
104 - A specific file can be specified on the command line:
105     `--config <path-to-file>`
106 - A run-in-place build will look for the configuration file in
107     `location_of_exe/../minetest.conf` and also `location_of_exe/../../minetest.conf`
108
109 Command-line options:
110 ---------------------
111 - Use `--help`
112
113 Compiling
114 ---------
115 ### Compiling on GNU/Linux
116
117 #### Dependencies
118
119 | Dependency | Version | Commentary |
120 |------------|---------|------------|
121 | GCC        | 4.9+    | Can be replaced with Clang 3.4+ |
122 | CMake      | 2.6+    |            |
123 | Irrlicht   | 1.7.3+  |            |
124 | SQLite3    | 3.0+    |            |
125 | LuaJIT     | 2.0+    | Bundled Lua 5.1 is used if not present |
126 | GMP        | 5.0.0+  | Bundled mini-GMP is used if not present |
127 | JsonCPP    | 1.0.0+  | Bundled JsonCPP is used if not present |
128
129 For Debian/Ubuntu:
130
131     sudo apt install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev
132
133 For Fedora users:
134
135     sudo dnf install make automake gcc gcc-c++ kernel-devel cmake libcurl-devel openal-soft-devel libvorbis-devel libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel irrlicht-devel bzip2-libs gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel doxygen spatialindex-devel bzip2-devel
136
137 #### Download
138
139 You can install Git for easily keeping your copy up to date.
140 If you don’t want Git, read below on how to get the source without Git.  
141 This is an example for installing Git on Debian/Ubuntu:
142
143     sudo apt install git
144
145 For Fedora users:
146
147     sudo dnf install git
148
149 Download source (this is the URL to the latest of source repository, which might not work at all times) using Git:
150
151     git clone --depth 1 https://github.com/minetest/minetest.git
152     cd minetest
153
154 Download minetest_game (otherwise only the "Minimal development test" game is available) using Git:
155
156     git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game
157
158 Download source, without using Git:
159
160     wget https://github.com/minetest/minetest/archive/master.tar.gz
161     tar xf master.tar.gz
162     cd minetest-master
163
164 Download minetest_game, without using Git:
165
166     cd games/
167     wget https://github.com/minetest/minetest_game/archive/master.tar.gz
168     tar xf master.tar.gz
169     mv minetest_game-master minetest_game
170     cd ..
171
172 #### Build
173
174 Build a version that runs directly from the source directory:
175
176     cmake . -DRUN_IN_PLACE=TRUE
177     make -j <number of processors>
178
179 Run it:
180
181     ./bin/minetest
182
183 - Use `cmake . -LH` to see all CMake options and their current state
184 - If you want to install it system-wide (or are making a distribution package),
185   you will want to use `-DRUN_IN_PLACE=FALSE`
186 - You can build a bare server by specifying `-DBUILD_SERVER=TRUE`
187 - You can disable the client build by specifying `-DBUILD_CLIENT=FALSE`
188 - You can select between Release and Debug build by `-DCMAKE_BUILD_TYPE=<Debug or Release>`
189   - Debug build is slower, but gives much more useful output in a debugger
190 - If you build a bare server, you don't need to have Irrlicht installed.
191   - In that case use `-DIRRLICHT_SOURCE_DIR=/the/irrlicht/source`
192
193 ### CMake options
194
195 General options and their default values:
196
197     BUILD_CLIENT=TRUE          - Build Minetest client
198     BUILD_SERVER=FALSE         - Build Minetest server
199     CMAKE_BUILD_TYPE=Release   - Type of build (Release vs. Debug)
200         Release                - Release build
201         Debug                  - Debug build
202         SemiDebug              - Partially optimized debug build
203         RelWithDebInfo         - Release build with debug information
204         MinSizeRel             - Release build with -Os passed to compiler to make executable as small as possible
205     ENABLE_CURL=ON             - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http
206     ENABLE_CURSES=ON           - Build with (n)curses; Enables a server side terminal (command line option: --terminal)
207     ENABLE_FREETYPE=ON         - Build with FreeType2; Allows using TTF fonts
208     ENABLE_GETTEXT=ON          - Build with Gettext; Allows using translations
209     ENABLE_GLES=OFF            - Search for Open GLES headers & libraries and use them
210     ENABLE_LEVELDB=ON          - Build with LevelDB; Enables use of LevelDB map backend
211     ENABLE_POSTGRESQL=ON       - Build with libpq; Enables use of PostgreSQL map backend (PostgreSQL 9.5 or greater recommended)
212     ENABLE_REDIS=ON            - Build with libhiredis; Enables use of Redis map backend
213     ENABLE_SPATIAL=ON          - Build with LibSpatial; Speeds up AreaStores
214     ENABLE_SOUND=ON            - Build with OpenAL, libogg & libvorbis; in-game sounds
215     ENABLE_LUAJIT=ON           - Build with LuaJIT (much faster than non-JIT Lua)
216     ENABLE_SYSTEM_GMP=ON       - Use GMP from system (much faster than bundled mini-gmp)
217     ENABLE_SYSTEM_JSONCPP=OFF  - Use JsonCPP from system
218     OPENGL_GL_PREFERENCE=LEGACY - Linux client build only; See CMake Policy CMP0072 for reference
219     RUN_IN_PLACE=FALSE         - Create a portable install (worlds, settings etc. in current directory)
220     USE_GPROF=FALSE            - Enable profiling using GProf
221     VERSION_EXTRA=             - Text to append to version (e.g. VERSION_EXTRA=foobar -> Minetest 0.4.9-foobar)
222
223 Library specific options:
224     
225     BZIP2_INCLUDE_DIR               - Linux only; directory where bzlib.h is located
226     BZIP2_LIBRARY                   - Linux only; path to libbz2.a/libbz2.so
227     CURL_DLL                        - Only if building with cURL on Windows; path to libcurl.dll
228     CURL_INCLUDE_DIR                - Only if building with cURL; directory where curl.h is located
229     CURL_LIBRARY                    - Only if building with cURL; path to libcurl.a/libcurl.so/libcurl.lib
230     EGL_INCLUDE_DIR                 - Only if building with GLES; directory that contains egl.h
231     EGL_LIBRARY                     - Only if building with GLES; path to libEGL.a/libEGL.so
232     FREETYPE_INCLUDE_DIR_freetype2  - Only if building with FreeType 2; directory that contains an freetype directory with files such as ftimage.h in it
233     FREETYPE_INCLUDE_DIR_ft2build   - Only if building with FreeType 2; directory that contains ft2build.h
234     FREETYPE_LIBRARY                - Only if building with FreeType 2; path to libfreetype.a/libfreetype.so/freetype.lib
235     FREETYPE_DLL                    - Only if building with FreeType 2 on Windows; path to libfreetype.dll
236     GETTEXT_DLL                     - Only when building with gettext on Windows; path to libintl3.dll
237     GETTEXT_ICONV_DLL               - Only when building with gettext on Windows; path to libiconv2.dll
238     GETTEXT_INCLUDE_DIR             - Only when building with gettext; directory that contains iconv.h
239     GETTEXT_LIBRARY                 - Only when building with gettext on Windows; path to libintl.dll.a
240     GETTEXT_MSGFMT                  - Only when building with gettext; path to msgfmt/msgfmt.exe
241     IRRLICHT_DLL                    - Only on Windows; path to Irrlicht.dll
242     IRRLICHT_INCLUDE_DIR            - Directory that contains IrrCompileConfig.h
243     IRRLICHT_LIBRARY                - Path to libIrrlicht.a/libIrrlicht.so/libIrrlicht.dll.a/Irrlicht.lib
244     LEVELDB_INCLUDE_DIR             - Only when building with LevelDB; directory that contains db.h
245     LEVELDB_LIBRARY                 - Only when building with LevelDB; path to libleveldb.a/libleveldb.so/libleveldb.dll.a
246     LEVELDB_DLL                     - Only when building with LevelDB on Windows; path to libleveldb.dll
247     PostgreSQL_INCLUDE_DIR          - Only when building with PostgreSQL; directory that contains libpq-fe.h
248     POSTGRESQL_LIBRARY              - Only when building with PostgreSQL; path to libpq.a/libpq.so
249     REDIS_INCLUDE_DIR               - Only when building with Redis; directory that contains hiredis.h
250     REDIS_LIBRARY                   - Only when building with Redis; path to libhiredis.a/libhiredis.so
251     SPATIAL_INCLUDE_DIR             - Only when building with LibSpatial; directory that contains spatialindex/SpatialIndex.h
252     SPATIAL_LIBRARY                 - Only when building with LibSpatial; path to libspatialindex_c.so/spatialindex-32.lib
253     LUA_INCLUDE_DIR                 - Only if you want to use LuaJIT; directory where luajit.h is located
254     LUA_LIBRARY                     - Only if you want to use LuaJIT; path to libluajit.a/libluajit.so
255     MINGWM10_DLL                    - Only if compiling with MinGW; path to mingwm10.dll
256     OGG_DLL                         - Only if building with sound on Windows; path to libogg.dll
257     OGG_INCLUDE_DIR                 - Only if building with sound; directory that contains an ogg directory which contains ogg.h
258     OGG_LIBRARY                     - Only if building with sound; path to libogg.a/libogg.so/libogg.dll.a
259     OPENAL_DLL                      - Only if building with sound on Windows; path to OpenAL32.dll
260     OPENAL_INCLUDE_DIR              - Only if building with sound; directory where al.h is located
261     OPENAL_LIBRARY                  - Only if building with sound; path to libopenal.a/libopenal.so/OpenAL32.lib
262     OPENGLES2_INCLUDE_DIR           - Only if building with GLES; directory that contains gl2.h
263     OPENGLES2_LIBRARY               - Only if building with GLES; path to libGLESv2.a/libGLESv2.so
264     SQLITE3_INCLUDE_DIR             - Directory that contains sqlite3.h
265     SQLITE3_LIBRARY                 - Path to libsqlite3.a/libsqlite3.so/sqlite3.lib
266     VORBISFILE_DLL                  - Only if building with sound on Windows; path to libvorbisfile-3.dll
267     VORBISFILE_LIBRARY              - Only if building with sound; path to libvorbisfile.a/libvorbisfile.so/libvorbisfile.dll.a
268     VORBIS_DLL                      - Only if building with sound on Windows; path to libvorbis-0.dll
269     VORBIS_INCLUDE_DIR              - Only if building with sound; directory that contains a directory vorbis with vorbisenc.h inside
270     VORBIS_LIBRARY                  - Only if building with sound; path to libvorbis.a/libvorbis.so/libvorbis.dll.a
271     XXF86VM_LIBRARY                 - Only on Linux; path to libXXf86vm.a/libXXf86vm.so
272     ZLIB_DLL                        - Only on Windows; path to zlib1.dll
273     ZLIBWAPI_DLL                    - Only on Windows; path to zlibwapi.dll
274     ZLIB_INCLUDE_DIR                - Directory that contains zlib.h
275     ZLIB_LIBRARY                    - Path to libz.a/libz.so/zlibwapi.lib
276
277 ### Compiling on Windows
278
279 * This section is outdated. In addition to what is described here:
280   * In addition to minetest, you need to download [minetest_game](https://github.com/minetest/minetest_game).
281   * If you wish to have sound support, you need libogg, libvorbis and libopenal
282   
283 * You need:
284         * CMake:
285                 http://www.cmake.org/cmake/resources/software.html
286         * A compiler
287                 * MinGW: http://www.mingw.org/
288                 * or Visual Studio: http://msdn.microsoft.com/en-us/vstudio/default
289         * Irrlicht SDK 1.7:
290                 http://irrlicht.sourceforge.net/downloads.html
291         * Zlib headers (zlib125.zip)
292                 http://www.winimage.com/zLibDll/index.html
293         * Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip):
294                 http://www.winimage.com/zLibDll/index.html
295         * SQLite3 headers and library
296                 https://www.sqlite.org/download.html
297         * Optional: gettext library and tools:
298                 http://gnuwin32.sourceforge.net/downlinks/gettext.php
299                 * This is used for other UI languages. Feel free to leave it out.
300         * And, of course, Minetest:
301                 http://minetest.net/download
302 * Steps:
303         * Select a directory called DIR hereafter in which you will operate.
304         * Make sure you have CMake and a compiler installed.
305         * Download all the other stuff to DIR and extract them into there.
306           ("extract here", not "extract to packagename/")
307             * NOTE: zlib125dll.zip needs to be extracted into zlib125dll
308             * NOTE: You need to extract sqlite3.h & sqlite3ext.h from the SQLite 3
309               source and sqlite3.dll & sqlite3.def from the SQLite 3 precompiled
310               binaries into "sqlite3" directory, and generate sqlite3.lib using
311               command "LIB /DEF:sqlite3.def /OUT:sqlite3.lib"
312         * All those packages contain a nice base directory in them, which
313           should end up being the direct subdirectories of DIR.
314         * You will end up with a directory structure like this (+=dir, -=file):
315         -----------------
316         + DIR
317                 * zlib-1.2.5.tar.gz
318                 * zlib125dll.zip
319                 * irrlicht-1.8.3.zip
320                 * sqlite-amalgamation-3130000.zip (SQLite3 headers)
321                 * sqlite-dll-win32-x86-3130000.zip (SQLite3 library for 32bit system)
322                 * 110214175330.zip (or whatever, this is the minetest source)
323                 + zlib-1.2.5
324                         * zlib.h
325                         + win32
326                         ...
327                 + zlib125dll
328                         * readme.txt
329                         + dll32
330                         ...
331                 + irrlicht-1.8.3
332                         + lib
333                         + include
334                         ...
335                 + sqlite3
336                         sqlite3.h
337                         sqlite3ext.h
338                         sqlite3.lib
339                         sqlite3.dll
340                 + gettext (optional)
341                         +bin
342                         +include
343                         +lib
344                 + minetest
345                         + src
346                         + doc
347                         * CMakeLists.txt
348                         ...
349         -----------------
350         * Start up the CMake GUI
351         * Select "Browse Source..." and select DIR/minetest
352         * Now, if using MSVC:
353                 * Select "Browse Build..." and select DIR/minetest-build
354         * Else if using MinGW:
355                 * Select "Browse Build..." and select DIR/minetest
356         * Select "Configure"
357         * Select your compiler
358         * It will warn about missing stuff, ignore that at this point. (later don't)
359         * Make sure the configuration is as follows
360           (note that the versions may differ for you):
361           
362                 BUILD_CLIENT             [X]
363                 BUILD_SERVER             [ ]
364                 CMAKE_BUILD_TYPE         Release
365                 CMAKE_INSTALL_PREFIX     DIR/minetest-install
366                 IRRLICHT_SOURCE_DIR      DIR/irrlicht-1.8.3
367                 RUN_IN_PLACE             [X]
368                 WARN_ALL                 [ ]
369                 ZLIB_DLL                 DIR/zlib125dll/dll32/zlibwapi.dll
370                 ZLIB_INCLUDE_DIR         DIR/zlib-1.2.5
371                 ZLIB_LIBRARIES           DIR/zlib125dll/dll32/zlibwapi.lib
372                 GETTEXT_BIN_DIR          DIR/gettext/bin
373                 GETTEXT_INCLUDE_DIR      DIR/gettext/include
374                 GETTEXT_LIBRARIES        DIR/gettext/lib/intl.lib
375                 GETTEXT_MSGFMT           DIR/gettext/bin/msgfmt
376         
377         * If CMake complains it couldn't find SQLITE3, choose "Advanced" box on the
378           right top corner, then specify the location of SQLITE3_INCLUDE_DIR and
379           SQLITE3_LIBRARY manually.
380         * If you want to build 64-bit minetest, you will need to build 64-bit version
381           of irrlicht engine manually, as only 32-bit pre-built library is provided.
382         * Hit "Configure"
383         * Hit "Configure" once again 8)
384         * If something is still coloured red, you have a problem.
385         * Hit "Generate"
386         If using MSVC:
387                 * Open the generated minetest.sln
388                 * The project defaults to the "Debug" configuration. Make very sure to
389                   select "Release", unless you want to debug some stuff (it's slower
390                   and might not even work at all)
391                 * Build the ALL_BUILD project
392                 * Build the INSTALL project
393                 * You should now have a working game with the executable in
394                         DIR/minetest-install/bin/minetest.exe
395                 * Additionally you may create a zip package by building the PACKAGE
396                   project.
397         If using MinGW:
398                 * Using the command line, browse to the build directory and run 'make'
399                   (or mingw32-make or whatever it happens to be)
400                 * You may need to copy some of the downloaded DLLs into bin/, see what
401                   running the produced executable tells you it doesn't have.
402                 * You should now have a working game with the executable in
403                         DIR/minetest/bin/minetest.exe
404
405 ### Bat script to build Windows releases of Minetest
406
407 This is how we build Windows releases.
408
409     set sourcedir=%CD%
410     set installpath="C:\tmp\minetest_install"
411     set irrlichtpath="C:\tmp\irrlicht-1.7.2"
412     
413     set builddir=%sourcedir%\bvc10
414     mkdir %builddir%
415     pushd %builddir%
416     cmake %sourcedir% -G "Visual Studio 10" -DIRRLICHT_SOURCE_DIR=%irrlichtpath% -DRUN_IN_PLACE=TRUE -DCMAKE_INSTALL_PREFIX=%installpath%
417     if %errorlevel% neq 0 goto fail
418     "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration=Release
419     if %errorlevel% neq 0 goto fail
420     "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" INSTALL.vcxproj /p:Configuration=Release
421     if %errorlevel% neq 0 goto fail
422     "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" PACKAGE.vcxproj /p:Configuration=Release
423     if %errorlevel% neq 0 goto fail
424     popd
425     echo Finished.
426     exit /b 0
427     
428     :fail
429     popd
430     echo Failed.
431     exit /b 1
432
433 ### Windows Installer using WIX Toolset
434
435 Requirements:
436 * Visual Studio 2017
437 * Wix Toolset
438
439 In Visual Studio 2017 Installer select "Optional Features" -> "Wix Toolset"
440
441 Build the binaries like described above, but make sure you unselect "RUN_IN_PLACE".
442
443 Open the generated Project file with VS. Right click "PACKAGE" and choose "Generate".
444 It may take some minutes to generate the installer.
445
446 Version scheme
447 --------------
448 We use `major.minor.patch` since 5.0.0-dev. Prior to that we used `0.major.minor`.
449
450 - Major is incremented when the release contains breaking changes, all other
451 numbers are set to 0.
452 - Minor is incremented when the release contains new non-breaking features,
453 patch is set to 0.
454 - Patch is incremented when the release only contains bugfixes and very
455 minor/trivial features considered necessary.
456
457 Since 5.0.0-dev and 0.4.17-dev, the dev notation refers to the next release, 
458 i.e.: 5.0.0-dev is the development version leading to 5.0.0. 
459 Prior to that we used `previous_version-dev`.