GameDevTecnico / cubos

A still very barebones game engine focused on voxels and data-oriented programming
https://gamedevtecnico.github.io/cubos/
MIT License
80 stars 20 forks source link

Fail in a controlled manner when configuring Cubos improperly #1266

Open RiscadoA opened 2 weeks ago

RiscadoA commented 2 weeks ago

Problem

Currently the Cubos class methods abort in case of configuration inconsistencies/errors, e.g., due to registering a component twice, or missing a plugin dependency. This is a problem when loading applications into Tesseratos - if a buggy/incomplete game is loaded into the editor and run, it could crash the editor itself, and the dev may lose work.

Solution

The Cubos class should hold a 'failed' flag or something similar. When it fails, it logs an error, and sets the flag, making all further operations do nothing. Then we should have a method to check whether the app is in a valid state. If run is called even with an invalid app, abort should be called.