Harold Serrano

View Original

In Retrospect: Three Game Engine Development Choices I'd Change

If you had the option to rewrite your game engine from scratch, what would you do differently? If you ask me, I would do the following:

  1. Use ECS (Entity-Component-System) over OOP.
  2. Leverage Industry-Standard Exporting Formats rather than using my format.
  3. Bulletproof my engine by providing defaults upon load failures.

Let's go one by one so you know what I mean.

Use Entity-Component-System

I wrote my game engine using C++ and decided to take the OOP approach. OOP served me well until my engine became too complex. Soon after, I realized the limitations of OOP; it can lead to complex dependencies and deep class hierarchies, making the engine difficult to maintain and scale.

I've written smaller renderers using the ECS architecture, and I can tell you that if you implement ECS, your engine will improve its performance; ECS allows efficient memory access and cache coherency. Moreover, the codebase of these renderers is a lot cleaner and less convoluted.

Leverage Industry-Standard Exporting Formats

A huge mistake that I don't regret doing was coming up with my file-exporting format. Instead of using OBJ, FBX, USD, etc. I decided to come up with my format and write my exporter. I learned a lot about Computer Graphics doing so but it came at a cost.

See, I wrote a file exporter for Blender version 2.79. Since then, newer versions of Blender have been released and my file exporter no longer works. I can't export 3D models from newer versions of Blender into my game engine. I can fix the issues but I would have to do the same thing with newer versions of Blender. This is something I do not want to do.

So, instead of coming up with my format, I would leverage the industry-standard exporting formats such as USD and make it compatible with my game engine.

Bulletproof my engine by providing defaults upon load failures

Finally, I would prevent any crashes due to missing files, incorrect file paths, missing textures, etc. I would provide default textures, and 3D models in case the user forgot to provide the assets.

I would provide informative and user-friendly error messages. Instead of just catching the error, I would provide clear error messages that users would understand and provide guidance on resolving it.

As you can imagine, I failed to add default assets to my game engine. Some of the error messages are not informative enough, to the point that I have forgotten how to solve them. That is not good.

So, if I was crazy enough to rewrite my game engine all over again. These three things would be the top priority. So tell me, what would you do differently?