I just opened up a Patreon account for my game engine to-be: Ryne Engine. The goal of this post is to give a high level overview of the C# scripting side of Ryne. This scripting project will soon be available open source, I’m still preparing the final bits and pieces.
Note: Ryne is still in alpha and is subject to change. Most of the time so far has been spent on the backend and creating a solid method for generating C# bindings to connect the two seamlessly.
High level overview
At the topmost level the application is a stack of game states. Ryne Editor implements a main menu that adds the Editor game state on top. All game states have Initialize, Update and Draw functions, similar to frameworks like Monogame. For more flexibility in logic separation there’s currently a PostFrame overridable function, and it’s easy to extend this if you require more such steps. The Register- and UnregisterEntity functions can be used to run custom logic when adding any entity to the scene.
An entity component system is running parallel to the above. My past article on entity component systems laid out some interesting concepts regardings ECS designs, however in Ryne the design is intended to be as simple as possible. It’s plainly laid out as follows
- Can run a loop over all entities with a certain set of components. For example the physics system loops over all components with a transform and physics component.
- Game objects that can have one of each component type.
- Data structures with optional logic.
- To connect systems to entities using an event. For example the CollisionSystem sends out an event to all entities involved in the collision
Entities can be controlled using InputMappings fed to a Controller. The input mapping describes an action that is executed when the input combination triggers. Currently this is done by polling the input combinations on the backend, but future release plans involve transforming this to an event based system.
All of the Editors graphical user interface features have been implemented using custom C# bindings of ImGui. Delegated window creation with editable inputs are made possible by GuiElements, which can store the final values in a Dictionary to lookup at a later time. All in all this gives a powerful feature set to support a lot of tool creation possibilities.
Material editing supports a simple Node Editor built on top of ImGui. This editor can be used for mapping texture channels to material inputs. I’m not sure if this feature is going to stay as I plan to move away from texture maps completely, and for now that is it’s only use.
The final aspect for this high level overview is the Utility folder in the repository. Hidden in there you can find a basic vector math library (which also translates to the backend) which also contains quaternions to describe rotations in transforms. Collision detection is done using the Separating Axis Theorem implementation, combined with a scene Bounding Volume Hierarchy.
For now the backend API can be explored by looking through the RyneEngine.dll for all the functions I exposed. Editors like visual studio open this metadata whenever you try to go to the function definition. In the future I will document API functions on the RyneEditor github page.
You will have noticed there is still a lot of functionality missing for Ryne to be a feature complete game engine. For example, I still want to support animations, audio and a lot of tools. However I’m currently focussing mainly on the rendering side make the most simplistic API with a performant backend for everyone to use.
In the meantime you are free to create missing functionality on the C# scripting side when it is released. Most of the engine parts are tweakable in there. You are also welcome to create pull requests if you think other users can profit from your changes. I’m not sure if I will merge in changes as I’d like to set a narrow scope to keep the project streamlined and simple.
Why “release” it now?
I don’t want to create endless videos about a new technology that you will have to believe is real. Instead I’d like to include as many of you as possible while Ryne is in development. I know Ryne still has flaws and is nowhere near as usable as I want it to be, but I’m still convinced that putting out tech demos like these will bring the point across that we will get there eventually. This will both help me focus on the most important issues, and make everyone aware this is no longer a dream, but we can actually render something right now.
I’m trying to keep a stream of releases going out whenever I feel a new set of features or bug fixes are good to go.
If you’d like to discuss or have more questions, feel free to join the discord server.