Sharing my current game engine made with SDL 2 (CPP and C#)

Hi all,
Just wanted to share a game engine I’m working on for my current project (using SDL ofc, with the usual extensions).
It’s implemented in CPP and have a C# bind.

CPP:
https://github.com/RonenNess/BonEngine

C#
https://github.com/RonenNess/BonEngineSharp

The engine is code base (ie no editor) and it basically aims to make everything as simple as possible to use and setup.

It has the following key features:

  • Scene-based architecture with all the basics - Update, FixedUpdate, Draw, Load, Unload…
  • Assets management (textures, sounds, music, config, fonts) with optional cache.
  • Graphics manager to draw sprites, text, textures ect.
  • SFX manager to play music and sound effects.
  • Input manager to provide key bindings and simple to use input using querying instead of events (ie IsDown(), IsReleased(), IsPressed()…)
  • Sprites and sprite animations.
  • Framework with all the basics (vectors, rectangles, colors…) but as classes with extended API.
  • Loading and using ini files to store config and game asset’s metadata.
  • UI system with windows, buttons, text input, checkboxes, sliders, and more.
  • Built in logging and diagnostics manager.

And some other useful stuff.
Here’s a tiny example to show the lib general vibe:

/**
 * Basic hello world scene.
 */
class HelloWorldScene : public bon::engine::Scene
{
private:
	bon::ImageAsset _spriteImage;

public:
	// on scene load
	virtual void _Load() override
	{
		Game().LoadConfig("config.ini");
		_spriteImage = Assets().LoadImage("../TestAssets/gfx/gnu.png");
	}

	// per-frame update
	virtual void _Update(double deltaTime) override
	{
		if (Input().Down("exit")) { Game().Exit(); }
	}

	// drawing
	virtual void _Draw() override
	{
		Gfx().ClearScreen(bon::Color::Cornflower);
		Gfx().DrawImage(_spriteImage, bon::PointF(100, 100));
	}
};

// init engine
void main()
{
	auto scene = HelloWorldScene();
	bon::Start(scene);
}

Anyway if you find it interesting feel free to use for whatever purpose.
Feedback is always welcomed.

Thanks,

The example looks pretty good and clean. I think you should add C# scripting support for the C++ version.

Thanks @TrnSTrA!
TBH my main focus is adding features that will benefit the C# side, because that’s what I build my game in, and I already have C# scripting going on there (it’s super easy to dynamically compile classes in C#), so its probably not a feature I’ll add soon.

Next on my list is extending the UI a bit, and adding effect assets (ie shaders), but that depends on my project progress.

That looks pretty fair. Another tip: add support for loading Tiled maps. Nowadays, many projects/people use Tiled because of its simplicity, the under-the-hood work it does for you and the time it saves.

1 Like

47fkbo

Why do I always do that.

1 Like

Guess you’re not the only one that does so. :smile: :smile: