aradarbel10 said:
I want to say that I don't know where to begin, but that's not quite true. I understand that to make my codebase maintainable and sustainable I need some kind of structure and abstraction. I have in mind a vague idea of how it will work- specifically for my game. I sort of have an idea of what systems, modules, classes I will need.
Maintainable and sustainable is a difficult aim, don't really expect that until 3 or more iterations. Each iteration you get a better design.
aradarbel10 said:
But when I start a new project, I am just stuck. I don't know what to do, where to begin. What if my structure isn't that good after all? What if I don't actually understand it? These are the questions I want to answer before starting the project.
You cannot get all the details right before you start. There are just too many details, and they are connected in too many unclear ways until you go down to code level. So let go of the idea that you do this in one time and get it right. Instead, start what feels ok, and start with something. At some point it will feel bad, then stop what you're doing , reconsider your ideas that led to what you have, and adjust ideas and of course the code.
By the end of it, you'll likely have something very different from what you now believe is what you should make. Then sit back, and consider how it turned out. What is good, what is bad, do you want change it, etc...
aradarbel10 said:
In my opinion, writing a general engine is a good idea. I can make a renderer, a sound module, a simple memory allocator, etc. These things will be completely separate from the game. But where do I stop? What *is* the game exactly? Is it the main loop? Just the player? And if I don't make an engine, then what am I making? Just a game? What does it mean to make a game and not an engine? At some point I will have to abstract away things, and so what's the difference between the two, right?
Engine versus game is indeed about "where does the game begin?". I use as guide "where the code doesn't change between games". Obviously, this has more than one answer. If you write only one type of game the "engine" is larger than when you want to write "any game" with the same engine. I solved this by thinking of the engine as a collection of modules. You don't need all modules all the time, or a game needs a small modification of a module. Also, maybe (not sure yet), the game should handle the glue between the modules, giving a lot of flexibility of organizing the modules?? The game would be leading in organizing the engine parts, no idea if that would be a good idea at this time, I'll have to try that.
"Make a game and not an engine" basically means you discard the whole idea of being generic, reusable, etc. There is just one goal, the first game and only the first game. That's what you have to produce. In theory, for the second game, you throw away everything, and then make the second game from scratch. In both cases you'll have abstractions, but games have a concrete and finite set of things that must be done, so you can reduce abstraction effort to just those specific things. It doesn't have to be generic for all games, or handle an unknown amount of things. The game has 6 things, so write code for those 6 things. The game dictates how the things interact with each other, no need to have arbitrary (not yet specified) interactions between an unknown number of things in an unknown number of ways. Way simpler thus :)
While this feels like a bad idea, it may be less bad than you think. To write generic reusable etc code, you need to understand deeply what you need to implement. The arguably simplest way to get an understanding is to write a few test-cases. Write a handful of different games, then find out what is common, what is unique, and why.
Personally, I am taking a different approach, I write a game but try to keep the game-specific code and the engine code separated. Likely I will fail to get it all right, and I will have to fix things, but I haven't reached the end yet to consider the good and bad parts.