ECS Lua Game Engine

As some of my previous attempts at game engines had failed at the serialization aspect of things, I decided to create a new engine with serialization as the focus.

I started by finding an ECS library, and eventually settled on https://github.com/friflo/Friflo.Engine.ECS!

I chose this library because it has fast benchmarks, and is C# only so it is platform independent with no external dependencies! And for serialization, I chose XML as it’s easy to read, verbose and more readable than JSON.

But what even is ECS? ECS stands for Entity Component System, this is a simple game engine architecture, as you only have 3 possible types. An entity exists in a world, and has no apparent properties apart from an ID, a component is linked to an entity and stores data, and a system runs over all the components and does stuff!

There are some components and systems that are premade (think of a mesh renderer & camera datatype) and their corresponding systems. However for user components there is a simple way of serializing them! For example:

<Component name="GunManager">
<GunValues name="Laser pistol" firerate="200" range="50"/>
</Component>

Would create a new component which can be used in Lua as follows:

local component = Globals.GetComponentByName(entityId, "GunManager")
print(component.GunValues.name)

A system is just an entity with a script component!

For physics interactions I chose the JitterPhysics2 library, which enables easy & fast physics interactions, I had previous experience with PhysX (MagicPhysX) from Nvidia but that is incredibly hard to use, and relies on external dependencies as its C++ not C#.

You can check it out here https://github.com/MartinPrograms/BEngine though it is very early in development

You May Also Like

More From Author

+ There are no comments

Add yours