All Projects → EvilPudding → Candle

EvilPudding / Candle

Licence: mit
C Game Engine

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Candle

Exengine
A C99 3D game engine
Stars: ✭ 391 (+21.43%)
Mutual labels:  game, engine, 3d-engine
Isetta Engine
Novice-built game engine from the ground up (with blogs!)
Stars: ✭ 285 (-11.49%)
Mutual labels:  game, engine, 3d-engine
Gamedev Resources
🎮 🎲 A wonderful list of Game Development resources.
Stars: ✭ 2,054 (+537.89%)
Mutual labels:  game, engine, 3d-engine
Ogsr Engine
OGSR Project - Evolution of X-Ray Engine for S.T.A.L.K.E.R.: Shadow of Chernobyl
Stars: ✭ 213 (-33.85%)
Mutual labels:  game, engine
Pydark
PyDark is a 2D and Online Multiplayer video game framework written on-top of Python and PyGame.
Stars: ✭ 201 (-37.58%)
Mutual labels:  game, engine
Nice Lua
基于xlua的MVVM框架,支持Addressables, 统一渲染管线等Unity新特性
Stars: ✭ 207 (-35.71%)
Mutual labels:  game, engine
Creature ue4
Unreal Engine 4 Runtimes for Creature, the 2D Skeletal + Mesh Animation Tool
Stars: ✭ 174 (-45.96%)
Mutual labels:  game, engine
exengine
A C99 3D game engine
Stars: ✭ 487 (+51.24%)
Mutual labels:  engine, 3d-engine
Awesome Haxe Gamedev
Resources for game development on haxe
Stars: ✭ 213 (-33.85%)
Mutual labels:  game, engine
ColumbusEngine
3D cross-platform game engine written in C++
Stars: ✭ 45 (-86.02%)
Mutual labels:  engine, 3d-engine
3D-Engine-OpenGL-4
3D Graphics Engine For Games | C++ OpenGL 4.1
Stars: ✭ 19 (-94.1%)
Mutual labels:  engine, 3d-engine
Renpy
The Ren'Py Visual Novel Engine
Stars: ✭ 2,734 (+749.07%)
Mutual labels:  game, engine
Chunkstories
Somewhat fancy blocky game engine written in Kotlin
Stars: ✭ 199 (-38.2%)
Mutual labels:  game, engine
Engine
A basic cross-platform 3D game engine
Stars: ✭ 208 (-35.4%)
Mutual labels:  game, engine
Vu
Virtual Universe 3D Engine
Stars: ✭ 183 (-43.17%)
Mutual labels:  game, engine
Flingengine
A Vulkan game engine with a focus on data oriented design
Stars: ✭ 239 (-25.78%)
Mutual labels:  game, engine
RendererEngine
2D - 3D Renderer Engine builds with OpenGL, SDL2, C++
Stars: ✭ 17 (-94.72%)
Mutual labels:  engine, 3d-engine
Tinyengine
Tiny OpenGL Wrapper / 3D Engine in C++
Stars: ✭ 251 (-22.05%)
Mutual labels:  engine, 3d-engine
Mundus
A 3D world/level editor built with Java, Kotlin & libGDX.
Stars: ✭ 164 (-49.07%)
Mutual labels:  game, engine
Protogame
This project has been sunset as of 1st Jan 2018 and is no longer supported or maintained
Stars: ✭ 166 (-48.45%)
Mutual labels:  game, engine

banner

Candle

A Game Engine (C89 ANSI, early development stages)

External Dependencies

  • no

Setup

Firstly, clone the sample project:

git clone --recursive https://github.com/EvilPudding/twinpeaks

Note the use of the flag --recursive, this sample scene uses git submodules to include, compile and link candle statically. To update Candle to a newer version, just cd candle; git pull

In twinpeaks/main.c, we can see how entities are created.

Compiling

On linux, run make, additionally, you can run make run to compile and automatically run the result, or make gdb to compile a debug executable and run it through gdb.

On windows, you need Visual C++ build tools, you can compile by running the build.bat in the project directory.

On BSD systems, in order to be able to compile and run Candle, you have to install the GNU version of the Make program, because the BSD version usually doesn't implement many required extensions. Therefore, instead of executing make you should use gmake on BSDs.

Entities and Components

Candle loosely follows Entity Component System paradigm. Entities are a simple handle, which can be extended with the use of components.

entity_t entity = entity_new({ /* component0; component1; ... */ });

For example, to create a cube object, the following code may be used:

mat_t *material = mat_new("cube material");
mesh_t *mesh = mesh_new();
mesh_cube(mesh, 1, 1);
entity_t cube = entity_new({c_model_new(mesh, material, false, true);});
/* this creates a cube that does not cast shadows but is visible */

All components in Candle use c_ prefix, and references to the component types use the ct_ prefix.

As seen above, the entity requires a c_model component to specify which mesh and material to use. The c_model component depends on c_spatial component, which is used to determine an object's position, scale and rotation. If I wish to change the cube's position, I can simply:

c_spatial_t *sc = c_spatial(&cube); /* fetch the spatial component from the cube */
c_spatial_set_pos(sc, vec3(0, 1, 0)); /* move the cube upwards */
c_spatial_rotate_Y(sc, M_PI); /* rotate the cube around the Y axis by ~3.1415 radians */

If I wish to make cube the a light source, I can add to the entity a c_light component by:

entity_add_component(cube, c_light_new(30.0f, vec4(1.0, 0.0, 0.0, 1.0)));
/* this creates a red light component of radius 30 */

This makes the cube emit light.

Custom Components

Documentation on how to create custom components will be added in the repo's wiki, until then, to learn how to create custom components, look at the component directory in candle. Each component has it's own .h and .c file, the header specifies the structure and public methods, the source file implements the methods and registers listeners and signals for that component.

Custom Rendering

Further explanations on how to create custom render passes will be added in the wiki, until then, to learn how to create custom render passes, skim through the function renderer_default_pipeline in candle/utils/renderer.c, when I have the time, I will share example projects to demonstrate this functionality.

Resources

In order to have the engine manage texture, mesh, sound, material resources, they need to be indexed, to do so there are two ways:

  1. index a directory which will be available relative to the executable:
c_sauces_index_dir(c_sauces(&SYS), "name_of_directory");
  1. embed the directory by passing a SAUCES variable when building the the engine:
make -C candle SAUCES=resauces

after this, a texture that is within that directory can be accessed by:

texture_t *texture = sauces("name_of_texture.png");

Plugins

Features that aren't requirements for all projects, are split into plugins, the ones I've developed so far are the following:

Each plugin may require specific external dependencies, and are added to a project through the use of git submodules, for example:

git submodule add https://github.com/EvilPudding/assimp.candle

The Makefile for the project will compile and link the plugin automatically.

Contributing

Anyone is welcome to contribute, there are many features missing:

  • Documentation is lacking.
  • Compilation on windows is a work in progress.
  • I don't use any modern engines, so feature suggestions are welcome.

Screenshots

Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].