Solution - reading from files
Our solution to both problems is to move all hard-coded values into text or binary files that will be read by the engine at runtime. Since we are using a component-based system in our game, this means being able to define which components belong to an object in the file as well. The benefit of this approach is that these files could be created with a level editor or some other content creation tool by a designer. For now, we won't focus on how these files get created, but instead on how they are read into our engine and how we can use them in place of an object builder class.
Now that we have decided to define our objects in files, we need to think about when they will be read by our engine. There are a few different ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access