Hello. I hope this is right part of forum to ask and I won't break any rules. I'm working on my own DirectX/C++ game engine for my purposes and after months I decided to completely rework its structure because I had some problems that started to bloat everything. I read books and information on web about game engines and it seems that there isn't much definitive answer on question how should be game engine structured exactly, I mean some standard rules describing it to details. It more seems like everybody is doing it more or less their own way, suiting their own needs which makes sense. However, I would like to ask anybody who has experience in making their own engines, maybe giving me a little tips about how I should structure it (simply: do/don't do this, you will regret it when you will start making game and bloat everything). Just a little note: I don't have editor like Unity/UE. All I want is some kind of skeleton of code I can build games on, so I don't need to code everything from scratch every time I decide to work on a game.
1. What exactly is purpose of object called game controller and how I should work with it? I was always used to have in game controller stored game related data (score, health, etc.). Currently my game controller is pretty much just telling main loop what game level to load and how to load, draw, update and release it. Do you think it is good idea, to move this stuff to another object that would be loading game levels and use game controller just for storing and passing particular game related data? What exactly means term game controller in relation to game engines and not to game development itself?
2. Currently in my main.cpp I have whole process of rendering window and main loop. Is it good idea to move main loop (initializations, render function, update function, release functions) to object that would be above main.cpp to keep everything more clean? I'm thinking about this because I would like to avoid overbloating my main.cpp file when I will start with game development. I would also like to avoid mixing my low-level engine structure with calls related to game, in other words, I don't want in my main loop next to D3Dinit something like "load level #1", that would be function of another object above main loop and only integrated in main loop, and I thought this object is game controller but then I realized, that I honestly have no idea what should game controller do.
Simply put, I would appreciate any advice and even better would be if you have some kind of good schema about how should be structure/object hierarchy of game engine done. I'm also expecting that nobody can help me with this because as I said, it seems that everybody is solving this stuff for theirs own needs.
↧