@AcetheSuperVillain said:
I'm not really enough of a computer science person that "modular design" means anything too me. I kind of understand the meaning of the words in context, but there's nothing specific that jumps into my when I read them.
What I was trying to say is making each component/part of it where it doesn't rely on other aspects in order to run, so if you need to change/remove a part of the game/level/etc, it doesn't cause a cascading chain of everything breaking. That way, you can add new features, swap things out, and adjust code without having strange bugs pop up or have a total game crash if something seemingly unrelated is adjusted.
For example, if you make the system that for diving cars modular in the player, then if you need to remove the ability to drive cars (for example, maybe the maps in the game are too small for vehicles) then it doesn't cause any breaking issue. Or, another example with the driving system would be if there is a bug in driving, you could fix it without needing to worry (at least as much) that something in the climbing system (for example) is going to suddenly break because of a fix in the driving, since the climbing system doesn't rely on anything in the driving system.
The general ideas is to make it where it's not super interlinked so each part can be worked on, fixed, and swapped around as needed! It's one of those concepts that is easier said than done, but especially for games with lots of moving parts and complex interactions, I imagine it would be helpful.
(Though I haven't made a game like that myself, so it's mostly speculation on my part :smile: )
I'd rather think about optimization early because I've had several games that crashed and burned halfway into the project because some optimization problem happened and I had no idea what to even search for. (this was back in AS3 Flash, not Godot) I'd rather start with at least a vague idea of what scope I'm capable of. Hence, any general optimization advice would be appreciated.
That's fair, I've had that issue a few times. Again, since I haven't done it myself I cannot speak from experience and instead have to speculate, but what I imagine are going to be big bottlenecks are NPCs, making the world load in/out as needed to save memory and performance, and making all the complex systems work together.
For NPCs, one of the first things I think will need some optimization is path finding and collision, since most sandbox-crime games require NPCs to react to their environment, run away from enemies (or towards the player if they are attacking), and otherwise just act like they are 'living' in the world. I imagine a lot of tricks are used for NPCs to make it seem move lively and populated than it really is, like deleting NPCs when out of sight, making path finding only work nearby the player, and other tricks. I'm not sure on the specifics though. There might be some GDC talks on this type of thing, though I did some quick Google searches and didn't find anything.
For making the world load in and out, there's a few ways I can see of doing it: Chunk-based loading/deleting or streaming the data. Chunk-based would be where the world is broken into smaller sections and then you just delete ones that are too far from the player and load new ones as the player moves in. I know that games like Morrowind use a system like this and it allows for a big world, though in Morrowind the technology of the time wasn't quite there for loading/destroying at seamlessly.
This article seems to implement something similar in Unity.
For streaming levels in and out, I think that is how GTA does it. This is completely speculation but I imagine how it works is that it loads a low resolution version of the map (maybe in chunks?) that contains a very low resolution and low polycount version of the scene. It doesn't include any entities, NPCs, or really any game play elements, just a basic visual. Then, as the player gets close, it loads a higher detailed version of the scene just in that spot, populates/spawns the entities, and activates game play elements. Spots further away are replaced with the low-resolution version again until the player reaches them.
That is how I think it is done or could be done, but I'm not positive and haven't looked into it really. I know that some game engines have systems build in for level streaming, so it may be that there's other, better ways of handling it, but that is what I might look into doing as a level-streaming like solution.
Finally, for the complex systems I'm not really sure what to recommend. Like with NPCs, I imagine a lot of the optimizations are saving processing time by only processing what would be interactive or visible to the player, and letting things that are too far or invisible just freeze until they are needed again.