2 ms·
Essentially all a game engine is are these things: * A tuned database for mostly-static, repurposable data * I/O functions * Compilation methods for assets a
by syntheweave 3y ago
Essentially all a game engine is are these things:
* A tuned database for mostly-static, repurposable data
* I/O functions
* Compilation methods for assets at various key points(initial load, levels of detail, rendering algorithm)
* Constraint solvers tuned for various subsystems(physics, pathfinding, planning).
A lot of what drives up the database complexity for a game is the desire to have large quantities of homogenous things in some contexts(particles, lights, etc.) and fewer but carefully indexed things in others(mapping players to their connections in an online game). If you approach it relationally you kill your latency right away through all the indirection, and your scaling constraint is the worst case - if the scene is running maxed-out with data it should do so with minimal latency. So game engines tend to end up with relatively flat, easily iterated indexes, a bit of duplication, and homogenization through componentized architecture. And that can be pushed really far with static optimization to describe every entity in terms of carefully packed data structures, but you have to have a story for making the editing environment usable as well, which has led to runtime shenanigans involving "patching" existing structures with new fields, and misguided attempts to globally optimize compilation processes with every edit[0].
Godot's architecture is a good example of how you can relax the performance a little bit and get a lot of usability back: it has a scene hierarchy, and an address system which lets you describe relationships in hierarchical terms. The hierarchy flattens out to its components for iteration purposes when subsystems are running, but to actually describe what you're doing with the scene, having a tree is a godsend, and accommodates just about everything short of the outer-join type cases.
[0] https://www.youtube.com/watch?v=7KXVox0-7lU https://www.youtube.com/watch?v=7KXVox0-7lU