A 2D game engine and editor for Linux, Windows and HTML5. Designed for simple single player games such as puzzle games,
platformers and side scrollers. Eventually support is planned for tile based games too for real time strategy/tactics.
This readme and other readme files, are for developers and cover information related to developing and building the engine itself.
For end user guide see help instead.
Other readmes:
Currently supported major features:
- Qt5 based editor
- Text rendering
- Various primitive shapes, custom polygon shapes
- Material system
- Particle system
- Entity system with animation tracks
- Audio engine
- Lua based scripting for entities, scenes and game logic
- Scene builder
- Styleable UI system
- Box2D based physics
- Demo content
- Game content packaging
- Window integration (https://github.com/ensisoft/wdk)
Planned major features not yet fully implemented:
- HTML5/WASM build target support
Planned major features not yet implemented:
- tile maps and tile engine
- partial 3D support for specific objects (think objects such as coins, diamonds, player ship etc.)
- OpenGL ES3 backend, WebGL2
Planned minor features not yet implemented:
- Acceleration structures / scene queries / ray casting
- Several other functional and performance improvements
- See issues for more details
Create your animated game play characters in the entity editor. Each entity can contain an arbitrary render tree
of nodes with various attachments for physics, rendering and text display. Animation tracks allow changing the properties
of the nodes and transforming the tree itself over time. Each entity type can then be associated with a Lua script where
you can write your entity specific game play code.
Create materials using the material editor by setting some properties for the provided default material shaders.
Currently supports sprite animations, textures (including text and noise), gradient and color fills out of box.
Custom shaders can be used too.
Create the game play scenes using the scene editor. The entities you create in the entity editor are available here
for placing in the scene. Viewport visualization will quickly show you how much of the game world will be seen when
the game plays.
Create the game’s UI in the UI editor. The UI and the widgets can be styled using a JSON based style file and then individual widgets
can have their style properties fine tuned in the editor. The style system integrates with the editor’s material system too!
Create audio graphs using the audio editor. Each audio graph can have a number of elements added to it. The graph then
specifies the flow of audio PCM data from source elements to processing elements to finally to the graph output. Currently
supported audio backends are Waveout on Windows and Pulseaudio on Linux. Supported formats are wav, mp3, ogg and flac.
Use the built-in code editor to write the Lua scripts for the entities, scenes or for the game. The editor has a built-in
help system for accessing the engine side Lua API documentation.
During the development the game is available for play in the editor. It’s possible to do live edits to the
game content in the editor and see the changes take place in the play window.
WASM
Building to WASM currently supported only for the engine but not the editor.
The build is separated from the main engine build and is in emscripten/ folder.
- Install emscripten (https://emscripten.org/docs/getting_started/downloads.html) Note that the
location of emsdk is arbitrary, but I’ve dumped it into gamestudio/ so that my IDE (Clion) can
easily find the emscripten headers for C++ tooling (the CMakeLists then has a matching include for this). - Currently, the target Emscripten version is 3.0.0. Using other version will likely break things.
- If using Windows Install Ninja from https://github.com/ninja-build/ninja/releases. Drop the ninja.exe for example
into the emsdk folder or anywhere on your PATH.
On Linux
- Install Emscripten
$ cd gamestudio
$ git clone https://github.com/emscripten-core/emsdk.git
$ cd emsdk
$ git pull
$ ./emsdk install latest
$ ./emsdk activate 3.0.0
$ source ./emsdk_env.sh
— Check your Emscripten installation
$ which emcc
$ /home/user/emsdk/upstream/emscripten/emcc
$ emcc --version
$ emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.0.0 (3fd52e107187b8a169bb04a02b9f982c8a075205)
- Build the Gamestudio engine into a WASM blob. Make sure that you have the emscripten tools in your path,
i.e. you have sourced emsdk_env.sh in your current shell.
$ git clone https://github.com/ensisoft/gamestudio
$ cd gamestudio
$ git submodule update --init --recursive
$ cd emscripten
$ mkdir build
$ cd build
$ emcmake cmake .. -DCMAKE_BUILD_TYPE=Release
$ make -j16 install
On Windows
- Install Emscripten
$ cd gamestudio
$ git clone https://github.com/emscripten-core/emsdk.git
$ cd emsdk
$ git pull
$ emsdk.bat install latest
$ emsdk.bat activate 3.0.0
$ emsdk_env.bat
— Check your Emscripten and Ninja installation
$ where emcc
$ C:codinggamestudioemsdkupstreamemscriptenemcc
$ C:codinggamestudioemsdkupstreamemscriptenemcc.bat
$ emcc --version
$ emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.0.0 (3fd52e107187b8a169bb04a02b9f982c8a075205)
$ where ninja
$ C:codinggamestudioemsdkninja.exe
$ ninja --version
$ 1.10.2
- Build the Gamestudio engine into a WASM blob. Make sure you have emcc and ninja in your path i.e. you have
ran emsdk_env.bat in your current shell.
$ git clone https://github.com/ensisoft/gamestudio
$ cd gamestudio
$ git submodule update --init --recursive
$ cd emscripten
$ mkdir build
$ cd build
$ emcmake cmake ..
$ ninja -j8
$ ninja -j8 install
If everything went well there should now be GameEngine.js and GameEngine.wasm files in the editor’s dist folder.
The .js file contains the JavaScript glue code needed to manhandle the WASM code into the browser’s WASM engine
when the web page loads. When a game is packaged for web these files will then be deployed (copied) into the
game’s output directory.
Penguin Juice (Linux)
- Install the dev packages.
(for Ubuntu based systems)
$ sudo apt-get install libboost-dev
$ sudo apt-get install qtbase5-dev
$ sudo apt-get install libpulse-dev
-
Install Conan build system.
https://docs.conan.io/en/latest/installation.html -
Build the project in RELEASE mode
$ git clone https://github.com/ensisoft/gamestudio
$ cd gamestudio
$ git submodule update --init --recursive
$ mkdir build
$ cd build
$ conan install .. --build missing
$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
$ make -j16 install
$ ctest -j16
- Build the project in DEBUG mode
$ git clone https://github.com/ensisoft/gamestudio
$ cd gamestudio
$ git submodule update --init --recursive
$ mkdir build_d
$ cd build_d
$ conan install .. --build missing
$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
$ make -j16 install
$ ctest -j16
- Build the project for profiling using valgrind / kcachegrind
$ git clone https://github.com/ensisoft/gamestudio
$ cd gamestudio
$ git submodule update --init --recursive
$ mkdir build_profile
$ cd build_profile
$ conan install .. --build missing
$ cmake -G "Unix Makefiles" --DCMAKE_BUILD_TYPE=RelWithDebInfo
$ make -j16 install
Then in order to profile and analyze the output use the combination of valgrind and kcachegrind.
For example:
$ cd gamestudio/audio/test/
$ valgrind --tool=cachegrind ./audio_test --graph
$ kcaghegrind cachegrind.out.XXXXX
Boring But Stable (Windows)
These build instructions are for MSVS 2019 Community Edition and for 64bit build.
-
Install Microsoft Visual Studio 2019 Community
https://www.visualstudio.com/downloads/ -
Install prebuilt Qt 5.15.2
http://download.qt.io/official_releases/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.zip -
Install prebuilt Boost 1.72
https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0_b1/ -
Install conan package manager
https://docs.conan.io/en/latest/installation.html -
Open “Developer Command Prompt for VS 2019”
Build the project in RELEASE mode.
$ git clone https://github.com/ensisoft/gamestudio
$ cd gamestudio
$ git submodule update --init --recursive
$ mkdir build
$ cd build
$ conan install .. --build missing
$ cmake -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release ..
$ cmake --build . --config Release
$ cmake --install . --config Release
Build the project in DEBUG mode.
- Note that on MSVS the library interfaces change between debug/release build configs. (e.g. iterator debug levels).
This means that in order to link to 3rd party libraries the debug versions of those libraries must be used.
$ git clone https://github.com/ensisoft/gamestudio
$ cd gamestudio
$ git submodule update --init --recursive
$ mkdir build_d
$ cd build_d
$ conan install .. --build missing -s build_type=Debug
$ cmake -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Debug ..
$ cmake --build . --confi