Wicked Engine is an open-source game engine written in C++. It is easy to use, high performance and feature rich. There are no external dependencies, but some free libraries are included as part of the source code. The MIT license means that anyone is free to download, modify, share or do anything with it.
This project is hosted on GitHub. For any questions, please open an issue at: https://github.com/turanszkij/WickedEngine
Because everything is changing rapidly, the documentation is sparse at the moment.
Documentation
Scripting API Documentation
Features
Devblog
Videos
You can download the engine by using Git and cloning the repository, or downloading it as zip, which will give you the full C++ source code that you must build for yourself. Building is simply pressing F5 in Visual Studio. You can also choose to download a pre-built version of the Editor or Tests applications, which will allow you to load content and write LUA scripts out of the box.
- Windows PC Desktop (x86, x64)
- Universal Windows (x86, x64, ARM, Phone, XBOX One)
- Windows 10
- Visual Studio 2019
There are a couple of projects that you can run up front: Editor, Tests and Template. You just have to set either as startup project and press F5 in Visual Studio to build and run.
If you wish to integrate Wicked Engine into your own project, you can use it as a static library and link it to your application. For this, you must first compile the engine library project for the desired platform. For Windows Desktop, this is the WickedEngine_Windows project. After that, set the following dependencies to this library in Visual Studio this way in the implementing project (paths are as if your project is inside the engine root folder):
- Open Project Properties -> Configuration Properties
- C/C++ -> General -> Additional Include Directories:
- ./WickedEngine
- Linker -> General -> Additional Library Directories:
- Directory of your built .lib file (For example ./x64/Release)
- Also be sure to compile with a non-DLL runtime library for Release builds:
- Project settings -> C/C++ -> Code Generation -> Runtime Library -> Multi threaded
- If you want to create an UWP application, #define WINSTORE_SUPPORT preprocessor for the whole implementing project and link against the WickedEngine_UWP library.
When your project settings are set up, put #include "WickedEngine.h" in your source. This will enable the use of all the engine features and link the necessary binaries. After this, you should already be able to build your project.
If you have trouble, you can always look at or copy the project settings for Editor, Tests and Template projects to get an idea how to link with Wicked Engine.
Initialization example (C++):
// Include engine headers:
#include "WickedEngine.h"
// Declare main component once per application:
MainComponent main;
// If you want to render, interface with Windows API like this:
main.SetWindow(hWnd, hInst);
// Run the application:
while(true) {
main.Run();
}
Some basic usage examples (C++):
RenderPath3D_Deferred myGame; // Declare a game screen component, aka "RenderPath" (you could also override its Update(), Render() etc. functions). This is a 3D, Deferred path for example, but there are others
main.ActivatePath(&myGame); // Register your game to the application. It will call Start(), Update(), Render(), etc. from now on...
wiSceneSystem::LoadModel("myModel.wiscene"); // Simply load a model into the current global scene
wiSceneSystem::GetScene(); // Get the current global scene
wiRenderer::ClearWorld(); // Delete every model, etc. from the current global scene
wiSceneSystem::Scene scene2; // create a separate scene
wiSceneSystem::LoadModel(scene2, "myModel2.wiscene"); // Load model into a separate scene
wiSceneSystem::GetScene().Merge(scene2); // Combine separate scene with global scene
myGame.setSSAOEnabled(true); // You can enable post process effects this way...
RenderPath2D myMenuScreen; // This is an other render path, but now a simple 2D one. It can only render 2D graphics by default (like a menu for example)
main.ActivatePath(&myMenuScreen); // activate the menu, the previous path (myGame) will be stopped
wiSprite mySprite("image.png"); // There are many utilities, such as a "sprite" helper class
myMenuScreen.addSprite(&mySprite); // The 2D render path is ready to handle sprite and font rendering for you
wiAudio::Sound mySound;
wiAudio::CreateSound("explosion.wav", &mySound); // Loads a sound file
wiAudio::SoundInstance mySoundInstance;
wiAudio::CreateSoundInstance(&mySound, &mySoundInstance); // Instances the sound file, it can be played now
wiAudio::Play(&mySoundInstance); // Play the sound instance
wiAudio::SetVolume(0.6, &mySoundInstance); // Set the volume of this soundinstance
wiAudio::SetVolume(0.2); // Set the master volume
if (wiInputManager::press(VK_SPACE)) { soundEffect.Stop(); } // You can check if a button is pressed or not (this only triggers once)
if (wiInputManager::down(VK_SPACE)) { soundEffect.Play(); } // You can check if a button is pushed down or not (this triggers repeatedly)
Some scripting examples (LUA):
-- Set a rendering path for the application main component
path = RenderPath3D_Deferred;
main.SetActivePath(path); -- "main" is created automatically
-- Load a model entity into the global scene:
entity = LoadModel("myModel.wiscene");
-- Load a model entity into a separate scene:
scene2 = Scene()
entity2 = LoadModel(scene2, "myModel2.wiscene");
-- Combine the separate scene with the global scene:
scene.Merge(scene2);
-- Get the current global scene:
scene = GetScene();
-- Move model to the right using the entity-component system:
transform = scene.Component_GetTransform(entity);
transform.Translate(Vector(2, 0, 0));
-- Clear every model from the current global scene:
ClearWorld();
-- Print any WickedEngine class information to the backlog:
getprops(main); -- prints the main component methods
getprops(scene); -- prints the Scene class methods
getprops(path); -- prints the deferred render path methods
-- Play a sound:
sound = Sound()
audio.CreateSound("explosion.wav", sound)
soundinstance = SoundInstance()
audio.CreateSoundInstance(sound, soundinstance) -- several instances can be created from one file
audio.Play(soundinstance)
audio.SetVolume(0.6, soundinstance) -- sets the volume of this soundinstance
audio.SetVolume(0.2) -- sets the master volume
-- Check for input:
if(input.press(VK_LEFT)) then
sound.Play(); -- this will play the sound if you press the left arrow on the keyboard
end
(You can enter lua scripts into the backlog (HOME button), or the startup.lua script which is always executed on application startup if it is found near the app, or load a script via dofile("script.lua") command)
For more code samples and advanced use cases, please see the example projects, like the Template_Windows, Tests, or Editor project. There are also sample models and scripts included with Wicked Engine in the models and scripts folders. Check them out to learn about more features.
You can use a great number of engine features through the Lua scripting api, which can even be used real time while the program is running. The included applications, like the Editor, contain a scripting input method toggled by the "Home" key. A blue screen will be presented where the user can type in LUA commands. It is very minimal in regards to input methods. For further details, please check the scripting API documentation: Wicked Engine Scripting API
The native model format is the WISCENE format. Any application using Wicked Engine can open this format efficiently.
In addition, the Editor supports the importing of some common model formats (the list will potentially grow):
- OBJ
- GLTF 2.0
The preferred workflow is to import models into the Editor, and save them as WISCENE, then any Wicked Engine application can open them.
(The old Blender exporter script is now not supported! (from version 0.21.0), because the engine was redesigned with Entity-Component System at its core. The old object oriented version can be found here.)
The default renderer is DirectX 11. There is also a DirectX12 renderer (experimental) and Vulkan renderer (experimental). You can specify command line arguments to switch between render devices or other settings. Currently the list of options:
Argument | Description |
---|---|
dx12 | Create DirectX 12 rendering device (Windows 10 required) |
vulkan | Create Vulkan rendering device*. (Only if engine was built with Vulkan SDK installed) |
debugdevice | Create rendering device with debug layer enabled for validation. Performance will be degraded. |
hlsl6 | Reroute shader loading path to use shader model 6 shaders** (DirectX 12 only) |
-
*Before enabling the Vulkan API, you must first also compile SPIR-V shaders. This step is not yet included in the standard build process. First, run the "generate_shader_buildtask_spirv.py" Python script which will generate the SPIR-V shader building program "build_SPIRV.bat". Run "build_SPIRV.bat" to build all HLSL shaders as SPIR-V bytecode format for Vulkan. Shader loading after this is automatic if you start the application with Vulkan support. This feature is experimental, not tested thoroughly yet.
-
**To load HLSL 6 shaders, replicate the exact steps as with SPIR-V above(*), but the python script you should run is called "generate_shader_buildtask_hlsl6.py" which will generate "build_HLSL6.bat". This feature is experimental, not tested thoroughly yet.
Contributions can be submitted on Github by following the steps below:
- Open an issue and describe the feature or patch in detail
- The feature or patch will be discussed in the issue, and determined if it would benefit the project
- After the request is accepted, open a pull request and reference the issue with #issue_number
- Code review will be conducted and the pull request will be merged when it meets the requirements
- When the pull request passes, you will be added to the credits as a contributor and your name shall be remembered by future generations
Sponza scene with voxel GI enabled:
Damaged Helmet GLTF sample model:
Path tracing in the living room:
City scene with a light map, model from Michael Gallie:
Lots of instanced boxes with a light map:
Lots of boxes path traced in the editor:
Bistro scene from Amazon Lumberyard (from Morgan McGuire's graphics archive):
Large scale particle simulation on the GPU:
Tiled light culling in the Bistro: