BrainStronk / TinyEngine

A tiny game engine written in C.
Creative Commons Zero v1.0 Universal
31 stars 1 forks source link

Engine/Platform/App Abstraction #10

Open strangezakary opened 4 years ago

strangezakary commented 4 years ago

How do we wanna handle abstracting the platform layer, engine, and game from each other? Obviously they all need to talk to each other but how do we go about preventing coupling. Ideally maybe they all should even be able stand on their own.

ryanfleury commented 4 years ago

I have a few scattered and perhaps opinionated thoughts without much cohesiveness. These are my initial feelings and are subject to change, and I don't mean to suggest this is the right way of doing anything, just that it's my first gut impression:

So, in terms of the actual hard-line abstraction cuts we make, I think it should be:

  1. Platform layer, hard-line. Abstraction layer by the globally-available engine stuff, provides simple API (just a struct with data + function pointers?) that just passes necessary stuff to the game layer.

  2. Various modular engine APIs, hard-line. Keep engine flexible by only making really big assumptions in modular areas. This would simplify the APIs too--if we don't have to worry about 3D graphics in the 2D renderer, but can swap the 2D renderer out, then the 2D rendering API can be much more specific, and more useful for gameplay code.

  3. All engine code included with game projects? Keep build self-contained + non-breaking forever, until the game person manually integrates new changes?

Again, scatter-brained and just initial instincts, to throw some thoughts in here. :)