Skip to content

C++ game engine focusing on modern rendering techniques and performance.

License

Notifications You must be signed in to change notification settings

KSFSeiei/WickedEngine

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wicked Engine

License: MIT Discord chat follow on Twitter
Github Build Status Appveyor Build status Store


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, and share it. This project is hosted on GitHub.

You can download the engine by using Git and cloning the repository, or downloading it as zip. This 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.

Emitter Drone

Platforms:

  • Windows 10 Desktop (x86, x64) [Visual Studio 2019]
  • UWP (x86, x64, ARM, Phone, XBOX One) [Visual Studio 2019]
  • Linux [CMake 3.7]

How to build:

Windows

To build Wicked Engine for Windows 10, use Visual Studio and the provided WickedEngine.sln solution file. 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. For optimal performance, choose Release mode, for the best debugging experience, choose Debug mode.

If you want to develop an application that uses Wicked Engine, you will have to link to WickedEngine_Windows.lib or WickedEngine_UWP.lib.lib and #include "WickedEngine.h" into the source code. For examples, look at the Template, Editor and Tests projects in Visual Studio that do this.

You can also dowload prebuilt and packaged versions of the Editor and Tests here: Github Build Status

If you have questions or stuck, please use the windows communication channel on Discord: Discord chat

Linux

The Linux support is experimental. You can find a sample build script for Ubuntu 20.04 here (in the linux section). You might need to install some dependencies, such as Vulkan SDK 1.2 or greater (to get DirectXShaderCompiler), SDL2, cmake 3.7 and g++ compiler (C++ 17 compliant version). For Ubuntu 20.04, you can use the following commands to install dependencies:

wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.2.162-focal.list https://packages.lunarg.com/vulkan/1.2.162/lunarg-vulkan-1.2.162-focal.list
sudo apt update
sudo apt install vulkan-sdk
sudo apt install libsdl2-dev
sudo apt install build-essential
  • Note: The Vulkan SDK for Ubuntu contains DXC (DirectXShaderCompiler) which is required to build the shaders. If you are using an other Linux distribution, make sure that you have DirectXShaderCompiler. To build the engine, editor and tests, use Cmake and make:
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make

If you want to develop an application that uses Wicked Engine, you will have to link to libWickedEngine.a and #include "WickedEngine.h" into the source code. For examples, look at the Cmake files.

You can also dowload prebuilt and packaged versions of the Editor and Tests here: Github Build Status

If you have questions or stuck, please use the linux communication channel on Discord: Discord chat

Examples:

Initialization (C++):

// Include engine headers:
#include "WickedEngine.h"

// Declare main component once per application:
MainComponent main;

// Set the window to render to like this:
main.SetWindow(hWnd);

// Run the application:
while(true) {
   main.Run(); 
}

Basics (C++):

RenderPath3D myGame; // Declare a game screen component, aka "RenderPath" (you could also override its Update(), Render() etc. functions). 
main.ActivatePath(&myGame); // Register your game to the application. It will call Start(), Update(), Render(), etc. from now on...

wiScene::LoadModel("myModel.wiscene"); // Simply load a model into the current global scene
wiScene::GetScene(); // Get the current global scene
wiRenderer::ClearWorld(); // Delete every model, etc. from the current global scene

wiScene::Scene scene2; // create a separate scene
wiScene::LoadModel(scene2, "myModel2.wiscene"); // Load model into a separate scene
wiScene::GetScene().Merge(scene2); // Combine separate scene with global scene

myGame.setFXAAEnabled(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 (wiInput::Press(wiInput::KEYBOARD_BUTTON_SPACE)) { wiAudio::Stop(&mySoundInstance); } // You can check if a button is pressed or not (this only triggers once)
if (wiInput::Down(wiInput::KEYBOARD_BUTTON_SPACE)) { wiAudio::Play(&mySoundInstance); } // You can check if a button is pushed down or not (this triggers repeatedly)

Scripting (LUA):

-- Set a rendering path for the application main component
path = RenderPath3D;
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(KEYBOARD_BUTTON_LEFT)) then
   audio.Play(soundinstance); -- 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.

Scripting API:

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

Model import/export:

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].)

Graphics API:

The default renderer is DirectX 11 on Windows and Vulkan on Linux. There is also an optional DirectX12 renderer for Windows. You can specify command line arguments (without any prefix) to switch between render devices or other settings. Currently the list of options:

Argument Description
dx12 Use DirectX 12 rendering device*
vulkan Use Vulkan rendering device**
debugdevice Use debug layer for graphics API validation. Performance will be degraded, but graphics warnings and errors will be written to "Output" window

  • *DX12 will try to load shaders from WickedEngine/shaders/hlsl6 directory. HLSL6 shaders can be compiled by Rebuilding the Shaders_HLSL6 project from within Visual Studio (Python 3 required for building).

  • **Vulkan support will be built into the application if the Vulkan SDK is installed on the build machine. Vulkan will try to load shaders from WickedEngine/shaders/spirv directory. SPIRV shaders can be compiled by Rebuilding the Shaders_SPIRV project from within Visual Studio (Python 3 required for building). For Linux builds, spirv shaders will be built by using Cmake system.


Contributions

Contributions can be submitted on Github by following the steps below:

  1. Open an issue and describe the feature or patch in detail
  2. The feature or patch will be discussed in the issue, and determined if it would benefit the project
  3. After the request is accepted, open a pull request and reference the issue with #issue_number
  4. Code review will be conducted and the pull request will be merged when it meets the requirements
  5. When the pull request passes, you will be added to the credits as a contributor and your name shall be remembered by future generations

Other software using Wicked Engine

  • Game Guru MAX: Easy to use game creator software
  • Flytrap: Demoscene production by qop
  • Your project: add your project to this readme and open a pull request

Finally, take a look at some screenshots:

Sponza scene with voxel GI enabled: Sponza

Damaged Helmet sample model imported from GLTF: Sponza

Bokeh Depth of Field (Lain model by woopoodle at Sketchfab): DepthOfField

Motion blur (fighting game sample): MotionBlur

Stochastic Screen Space Reflections: ScreenSpaceReflections

Real time ray traced shadows and ambient occlusion (DXR, VK_KHR_raytracing): RaytracedShadows

Bloom: Bloom

Path tracing in the living room (model from Morgan McGuire's graphics archive): LivingRoom

City scene with a light map (model by Michael Gallie at CgTrader): City

Path tracing in the city: Balcony

Path traced caustics: Caustics

Vegetation particle system and depth of field: Vegetation

Bistro scene from Amazon Lumberyard (model from Morgan McGuire's graphics archive): Bistro_out

Bistro scene from the inside: Bistro_in

Parallax occlusion mapping: ParallxOcclusionMapping

Large scale particle simulation on the GPU: ParticleSimulation

Tiled light culling in the Bistro: TiledLightCulling

GPU-based BVH builder: GPU_BVH

About

C++ game engine focusing on modern rendering techniques and performance.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 80.2%
  • C 14.5%
  • HLSL 4.6%
  • Lua 0.6%
  • CMake 0.1%
  • Python 0.0%