(I hope this isnt too tedious, sorry. TL;DR - I have little idea how Games and their Engines work.) I started using SDL 3 weeks ago and made my first minesweeper, it was quite simple, based on the sdltutorials tutorials, but now I’ve decided to create a full minesweeper game (with main menu, game over screen, right-click flags and question marks, escape menu, etc.) and after that move onto some 2D RPG or perhaps a 2D TD game, reusing the Engine from the minesweeper game. Now I came here to ask for help, I saw the 2D engine tutorial by Seoushi in The Game Programming Wiki, and I understood how to create the State Manager and how it works, as well as the Input. I haven’t seen the Sound core yet, but for the moment I don’t need it. The Graphics Core is OpenGL, which I haven’t looked into, so I decided to make it the SDL way, however I came to a problem. I don’t understand how games work, I mean, I know there’s an engine, but is that engine generic? Like, is it universal so that you can use it in other games without changing it, or you have to adapt it to the game. And if you don’t have to adapt it, then how do you write the states, do you have to create other class called for example Game, specific for each game, that stores all info about it, like surfaces neede, sounds, algorithms, etc., where you have a function for each state(Main Menu, Configuration, Gameplay, Save Game, Load Game, etc.), and in main() you call the Engine’s state manager which then calls the Game’s state function. How do you handle Surface loading, in that tutorial I saw Seoushi had one function that loads a surface into memory, but what if you have many surfaces, do you have to create like an array of pointers to surfaces, and if yes, how do you implement that in the Engine, does it need an array declared in the Engine itself, for example, in the Graphics Core, or do you declare it in the Game class, and if you do it in the game class, how do you load all the surfaces through the Graphics Core, function, yes, but how do you pass the locations of the BMPs, the number of surfaces, color keys, etc., doing that with arguments would require more than 3-4 arguments. I’m puzzled by all this, my previous minesweeper was easy, just creating new .cpp and .h files for everything i needed, but designing a generic engine and linking its functions to each game’s functions is quite difficult for me. Also I don’t quite grasp the structure of a game, the basics are Input, Update, Render, and then what, is that infinite, or maybe if there is no input, then delay? What happens with animated games? Do they render forever? If I need a new game, how do I tell the core that I’m starting a new game, without it loading the surfaces yet again (probably loading could be out of the game loop)? Many questions like these are bugging me each time I try to write anything, and I can’t focus. Now I’m not asking you to answer every one of them, but if you could give me some directions, tutorials that explain in details, or anything. How did you learn to create Engines, how did you get used to structuring it, that kind of thing.
Thank you a lot in advance.