For some time I’ve been trying to create some rudimentary hack’n’slash game. I didn’t want to use ready game engine because I consider it more of an exercise in programming a game than an honest attempt at creating one if that makes sense. So I started with SFML.
Along the way I’ve recognized the need for loading settings from files(Json library), logging, map editor(ImGUI) etc and it’s posing a questions to me for which I struggle to find answers to.
For example let’s consider map editor. Currently loading/saving the map to file is done by TileMap class itself but I don’t know if it should be. If the map is not as big as render window, should it itself be responsible for centering it or class/function using it should do it? What about scrolling map bigger than render window?
Another example is I have Entity class (player, monster can be entity) which can have Graphics, Physics component etc and it is responsible for rendering itself. But I don’t know if it’s the right approach. I would like to have logic separate from drawing but Entity essentially merges the two with some extra steps
Add to that is that I would like to painlessly inject debug enabled logging into different parts of this code and I’m afraid I will end up with spaghetti monster for code
What this long windup is leading to is a question. How do I write render independent, reusable game architecture? Where can I read more about this so I can make better decision about what I’m creating.
Now that I’ve read all of this before submitting it seems to me like what I’m really asking is “how do I make a game engine?”. And this was not supposed to be exercise in creating one, at least I didn’t think so when I started
I do not want to recreate 40 years of best practices, I want to understand them and try to implement them. That’s why I’m asking for some reading, educational material. It’s not that I’m averse to using an engine, it’s just not something I set out to do