Coder Social home page Coder Social logo

skylicht-lab / skylicht-engine Goto Github PK

View Code? Open in Web Editor NEW
600.0 32.0 51.0 564.1 MB

Skylicht Engine is C++ Game Engine based on Irrlicht 3D. And my goal is to create a high-performance and lightweight Game Framework that can seamlessly function on both web and mobile platforms. This framework will be available to everyone for free.

License: MIT License

Batchfile 0.01% CMake 0.62% C++ 68.66% C 27.73% Python 0.10% GLSL 0.93% HLSL 1.10% HTML 0.46% Shell 0.01% Objective-C++ 0.14% Objective-C 0.07% JavaScript 0.06% Java 0.10% Lua 0.01%
skylicht-engine irrlicht-engine google-angle opengles3 directx11 lightmapper game-development game-engine particle

skylicht-engine's Introduction

Skylicht Engine

Skylicht Engine, which is an evolution of the Irrlicht Project. We have upgraded more features: Sound Engine, Physics Engine, Particle Engine...

  • Core functionality: Direct3D11, OpenGL 4+, OpenGLES 3+, Google Angle GLES video driver backends.

  • Cross-Platform Framework: Android, IOS, Win32/Win64, UWP, Linux, MacOS, HTML5.

  • Render pipeline: Forwarder & Deferred.

Skylicht Engine is a super lightweight Game Engine that targets mobile platforms (Android, IOS). And, it's completely free.

How to build the project

Platform Build Status
Cygwin64 Build status
Windows Build status
MacOS, IOS Build status
Linux Build status
Emscripten Build status
Android Build status

Prerequisites

Build source code

  • Clone this repo

  • Build assets bundle

C:\skylicht-engine>cd Assets
C:\skylicht-engine\Assets>python BuildAssetBundles.py
C:\skylicht-engine\Assets>cd ..
  • Run CMake from the current directory to generate visual studio project or xcode project
# Visual Studio 2017
C:\skylicht-engine>cmake -S . -B ./PrjVisualStudio -G "Visual Studio 15 2017" -A x64

# Visual Studio 2019
C:\skylicht-engine>cmake -S . -B ./PrjVisualStudio -G "Visual Studio 16 2019" -A x64

# Xcode
/User/Skylicht/Documents/skylicht-engine$cmake -S . -B ./PrjMac -G Xcode 

# Linux
$ skylicht-engine$ cmake -S . -B ./PrjLinux -G "Unix Makefiles"
  • Open the generated solution PrjVisualStudio/SKYLICHT_ENGINE.sln

  • Once the solution opens, right click the SampleXXX project, click "Set as StartUp Project" and click the play button at the top to run the Demo App.

  • More details: please preview command in BuildCommand folder.

Build data assets

Compress Texture

  • Optional, You can skip this step if you don't modify any resource texture.
  • This python tool will convert texture .TGA to compressed texture (.DDS, .ETC2, .PVRTC) to optimize gpu memory on runtime.
# Install Tinydb
# https://pypi.org/project/tinydb
C:\skylicht-engine>C:\Python37\Scripts\pip install tinydb

# Install Pillow (Image processing)
# https://pillow.readthedocs.io/en/4.1.x/index.html
C:\skylicht-engine>C:\Python37\Scripts\pip install Pillow

# Compress TGA to DDS, ETC2, PVR texture
C:\skylicht-engine>cd Assets    
C:\skylicht-engine\Assets>python BuildTextureCompressDDS.py
C:\skylicht-engine\Assets>python BuildTextureCompressETC.py
C:\skylicht-engine\Assets>python BuildTextureCompressPVR.py
C:\skylicht-engine\Assets>cd ..

Build Shader

  • Optional, You can skip this step if you don't modify any shader.
  • This python tool use C Preprocessor to inline shader script (HLSL, HLSL)
# Install pcpp (C Preprocessor tool)
# https://pypi.org/project/pcpp
C:\skylicht-engine>C:\Python37\Scripts\pip install pcpp

# Build shader script
C:\skylicht-engine>cd Assets
C:\skylicht-engine\Assets>python BuildShader.py
C:\skylicht-engine\Assets>cd ..

Add your code to Project

Add source code

  • Add new source files or subfolders on Projects/{ProjectName}/Source and regenerate project
C:\skylicht-engine>cmake -S . -B ./PrjVisualStudio -G "Visual Studio 15 2017" -A x64

Create application project

  • Run Scripts/create_project.py. Example: Create application NewApplication at folder Samples\NewApplication
    C:\skylicht-engine>python Scripts\create_project.py NewApplication Samples\NewApplication
  • Edit CMakeProjects.cmake, add new line:"subdirs (Samples/NewApplication)" and regenerate projects
  • Open Visual Studio Solution and click NewApplication - "Set as StartUp Project".

Android

Prerequisites

How to build

Step 1: Build native library

  • Edit the file BuildCommand/BuildAndroidNDK.cmd by text editor and update your path MINGW and NDK
# BuildAndroidNDK.cmd
# Set your pc folder, example
set MINGW=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
set NDK=C:\SDK\android-ndk-r21e
...
  • Run BuildCommand/BuildAndroidNDK.cmd to build android native library

Step 2: Copy native library to Gradle Project

# Make folder jniLibs on Android Project
C:\skylicht-engine>mkdir Projects\Android\app\src\main\jniLibs
C:\skylicht-engine>mkdir Projects\Android\app\src\main\jniLibs\armeabi-v7a
C:\skylicht-engine>mkdir Projects\Android\app\src\main\jniLibs\arm64-v8a

# Copy result native ndk (from step 1) to jniLibs
# Project SampleSkinnedMesh
C:\skylicht-engine>copy Bin\Android\Libs\arm64-v8a\libSampleSkinnedMesh.so Projects\Android\app\src\main\jniLibs\arm64-v8a
C:\skylicht-engine>copy Bin\Android\Libs\armeabi-v7a\libSampleSkinnedMesh.so Projects\Android\app\src\main\jniLibs\armeabi-v7a

Step 3: Copy asset resource to Gradle Project

C:\skylicht-engine\Assets>python BuildTextureCompressETC.py
C:\skylicht-engine\Assets>python BuildAssetBundles.py
C:\skylicht-engine\Assets>cd..

# Create assets folder in Gradle Project
C:\skylicht-engine>mkdir Projects\Android\app\src\main\assets

# Copy built-in asset
C:\skylicht-engine>copy Bin\BuiltIn.zip Projects\Android\app\src\main\assets

# Copy project asset
# Project SampleSkinnedMesh
C:\skylicht-engine>copy Bin\Common.zip Projects\Android\app\src\main\assets
C:\skylicht-engine>copy Bin\SampleModelsResource.zip Projects\Android\app\src\main\assets

# Dont forget copy ETC texture
C:\skylicht-engine>copy Bin\SampleModelsETC.zip Projects\Android\app\src\main\assets

Step 4: Build APK by Android Studio or Gradle

Open Android Studio and import project Projects\Android

Run command build from Android Studio:

Android development

  • You can rename your package name at build.gradle (Projects\Android\app)
  • You can rename your application name at string.xml (Projects\Android\app\src\main\res\values)

iOS

Prerequisites

  • Apple arm64 device
  • Install XCode

How to build

Step 1: Build compress texture ETC and Build Asset Bundles

# Grant permission executive for PVRTexTool
skylicht-engine/Tools/PVRTexTool/darwin$ chmod +x PVRTexToolCLI

# Build compress texture ETC
skylicht-engine/Assets$ python3 BuildTextureCompressETC.py

# Build asset bundles
skylicht-engine/Assets$ python3 BuildAssetBundles.py

Step 2: Generate iOS xCode Project

If you want build samples for iOS device, you should replace the bundleIdentifier in Samples/{ProjectName}/CMakeLists.txt.

elseif (BUILD_IOS)
    # replace your application name
    set(MACOSX_BUNDLE_EXECUTABLE_NAME SampleHelloWorld)
    set(APP_NAME "SampleHelloWorld")
    
    # replace your bundleIdentifier
    set(APP_BUNDLE_IDENTIFIER "com.skylicht.helloword")
    set(CODE_SIGN_IDENTITY "iPhone Developer")
    
else()

And generate iOS xCode Project by this script.

# generate project for iOS device
skylicht-engine/BuildCommand$ ./GenerateXCodeIOS.sh

# or generate for iOS simulator
skylicht-engine/BuildCommand$ ./GenerateXCodeIOSSimulator.sh

Open iOS XCode Project on folder skylicht-engine/PrjIOS/SKYLICHT_ENGINE.xcodeproj

Note: iOS Simulator is not yet support compressed texture and hardware skinning.

Build static or shared library

Skylicht Engine can be compiled into a standalone library to simplify integration into other projects.

Shared library

C:\skylicht-engine>cmake -S . -B ./PrjVisualStudio -G "Visual Studio 17 2022" -A x64 -DINSTALL_LIBS=ON -DBUILD_SHARED_LIBS=ON
C:\skylicht-engine>cmake --build ./PrjVisualStudio --target install --config Debug

Note: Use the parameters "-DINSTALL_LIBS=ON -DBUILD_SHARED_LIBS=ON" with cmake command

Static library

C:\skylicht-engine>cmake -S . -B ./PrjVisualStudio -G "Visual Studio 17 2022" -A x64 -DINSTALL_LIBS=ON
C:\skylicht-engine>cmake --build ./PrjVisualStudio --target install --config Debug

How to integrate

And then copy the resulting InstallLibs folder to another project. See the project example: https://github.com/skylicht-lab/hello-skylicht

Roadmap

Code example

// INIT SCENE FUNCTION
// init scene/zone
CScene* scene = new CScene();
CZone* zone = scene->createZone();

// camera
CGameObject *camObj = zone->createEmptyObject();
CCamera* camera = camObj->addComponent<CCamera>();
camera->setPosition(core::vector3df(0.0f, 1.5f, 4.0f));
camera->lookAt(
   core::vector3df(0.0f, 0.0f, 0.0f),  // look at target position
   core::vector3df(0.0f, 1.0f, 0.0f)   // head up vector
);

// load model
CMeshManager* meshManager = CMeshManager::getInstance();
CEntityPrefab* meshPrefab = meshManager->loadModel("SampleModels/BlendShape/Cat.fbx", NULL, true);

// load material
CMaterialManager* materialMgr = CMaterialManager::getInstance();

// search textures folder
std::vector<std::string> textureFolders;

// use Skylicht Editor to edit .mat file
ArrayMaterial& catMaterials = materialMgr->loadMaterial("SampleModels/BlendShape/Cat.mat", true, textureFolders);

// create 3d object
CGameObject* cat = zone->createEmptyObject();
cat->setName("Cat");
cat->getTransformEuler()->setPosition(core::vector3df(0.0f, 1.0f, 0.0f));

// add render mesh component & init material
CRenderMesh* meshRenderer = cat->addComponent<CRenderMesh>();
meshRenderer->initFromPrefab(meshPrefab);
meshRenderer->initMaterial(catMaterials);

// render scene to screen
CForwardRP* renderPipeline = new CForwardRP();

CBaseApp* app = getApplication();
u32 w = app->getWidth();
u32 h = app->getHeight();
renderPipeline->initRender(w, h);

// RENDER TO SCREEN FUNCTION
renderPipeline->render(
    NULL, // render target is screen
    camera, // the camera
    scene->getEntityManager(), // all entities in scene
    core::recti() // the viewport is fullscreen
);

Sample Projects

Samples\HelloWorld

Engine Components are used:

  • FreeType Font
  • Glyph Font
  • Canvas Component
  • Graphics2D
  • GUI Text

Samples\DrawPrimitives

This demo is to draw Cube 3D, set up, transform and use components.

Samples\Materials

This demo code, that renders Sphere 3D, loads textures (Diffuse, Normal, Specular), and binds SpecGloss shader to Material.

Samples\SampleShader

This demo code, How to binds shader to Material.

Samples\LuckyDraw

Engine Components are used:

  • FreeType Font
  • Glyph Font
  • Graphics2D
  • GUI Text
  • GUI Image
  • GUI Mask
  • EventManager

Samples\SkinnedMesh

This is example code. How to render character model with animation, models are downloaded from mixamo

  • DAE Collada loader model/animation
  • Forwarder rendering
  • Skydome
  • AnimationController

Live demo: Emscripten

Blendshape live demo: Emscripten

Samples\LightmapUV

This is a demo how to use UnwrapUV tool to create Lightmap UV. Library xatlas is integrated to Skylicht Engine.

Samples\Lightmapping

This is a demo code to use lightmapper to bake indirect lighting color on lightmap texture. Project references: Lightmapper

Gazebo

Result lightmap

Sponza lightmap

Sponza indirect lighting baked by Skylicht Lightmapper

Samples\Sponza

This example is how to set up a simple lighting & lightmap. This scene uses basic diffuse bump specular shader.

Run on Ubuntu 20.04

Live demo: (Web PC Only) Emscripten

Samples\LightmappingVertex

This is a demo to use lightmapper to set indirect lighting color on vertex color.

Engine Components are used:

  • OBJ Wavefront loader
  • Deferred and Forwarder rendering
  • Dynamic Direction Lighting
  • Shadow Mapping
  • Lightmapper
  • Skydome

Baked Global Illumination (3 bounces)

Irradiance baked on Vertex Color:

Indirect + Direction light - No post processing (3 bounces light)

Samples\Collision

This is a demo to use CollisionManager to get collision point from the ray.

And how to query all triangles inside a Box

And how to use the decal projector feature

Live demo: (Web PC Only) Emscripten

Samples\Instancing

This is demo setup render many mesh instancing to optimize draw call and render performance.

Live demo: Emscripten

Samples\SkinnedMeshInstancing

This is a demo of drawing many characters and animations, that use GPU Instancing technique.

Samples\BoidSystem

Samples\Particles

Skylicht Particle Component is a cleanup version of SPARK. We have optimized by GPU Billboard Instancing.

This is demo code how to create particle system and use imgui

Basic particle

Explosion demo

Magic particle

This is a demo code on how to use a simple projectile, impact, trail particle, sub emitter system.

Samples\Noise2D, Noise3D

This is demo code how to use noise library shader to make vfx effect, particle turbulence.

Contributing

Welcome if you want to contribute your code to Skylicht Engine (Ex: add feature or fix bug). Wellcome to join the group. Open an issue and submit a pull request to this repository. Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.

Thanks

  • Julien Fryer (SPARK) about references and source code demo of particle system.
  • Inigo Quilez about perlin noise reference.
  • Irrlicht Community, who have shared some demo

License

Skylicht Engine is licensed under MIT License

Skylicht Engine is based in part on the work of:

This means that if you've used the Skylicht Engine in your product, you must acknowledge somewhere in your documentation that you've used. It would also be nice to mention that you use the 3rd parties library... Please see the README files from 3rd parties for further information.

Thanks, Project Maintainer: Pham Hong Duc

skylicht-engine's People

Contributors

ducphamhong avatar joilnen avatar niansa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skylicht-engine's Issues

Skylicht Editor

DONE

  • UI Interface
  • Asset Management UI
  • Scene Editor (add an object, scale, rotate, move)
  • Import/Export 3d model
  • Material editor
  • Tools features: Undo, Copy, Paste, Duplicate...

IN PROGRESS

  • Animation
  • 2D GUI editor
  • Object Instancing
  • Primitive Object (Cube, Plane, Sphere...)

PLANNED

  • Terrain Paint
  • Animation Editor
  • Texture Atlas, Lightmap...

Improve Lightmapper baker

Optimize bake time 2 ways:

  • OpenMP (CPU multi thread) (done!)
  • Compute SH by GPU Shader (planned)
  • OpenCL (GPU multi thread for crossplatform) (pending)

ref #54

Mesh Exporter

Export dae, obj... to binary mesh (optimize load model)

Collision

Add raycast to detect collision with Object (Mesh)
Ref #5

Skylicht Engine Core

CORE FEATURES:

DONE:

  • GameObject (Camera, Lighting, Transform)
  • Component
  • Basic Engine Shader
  • Render pipe line: Forwarder/Deferred
  • Collada DAE loader
  • OBJ loader
  • Mesh Render
  • Material
  • Texture Manager
  • Entity Component System (ECS)
  • Skeletal Mesh
  • Animation/Animation Blending
  • Utils
  • Lightmapper
  • Particle system (billboard, trail)
  • Audio/Sound 3D engine
  • Android Studio APK build
  • Blend-Shapes
  • Mesh Instancing
  • Collision

IN PROGRESS:

  • Compute Shader
    • Done in DX11
  • GPU Lightmap baker
    • Done in DX11
  • Post processing
    • Done: Tonemapping, Camera Exposure, Bloom/Glow, FXAA
    • In progress: SSAO, ColorGrading
  • Particle system
    • In progress: Mesh particle instancing

PLANNED

  • Irrlicht Metal Driver
  • Terrain (Wait Editor)
  • Scene (Import, export) (Wait Editor)
  • Bullet Physics (Wait Editor)
  • Occlusion Culling (Wait Editor)
  • Animation IK (Wait Editor)

Physics

Add physics (Bullet3 engine), collision detection with CharacterController
Ref #5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.