Static vs Dynamic Strategies, Pros & Cons?

I am wondering which one would be more performant. Having a static system or dynamically creating everything. For example I can create part dynamically using a script or just insert the part pre-made into ReplicatedStorage. I want to know the pros and cons of both systems. Would dynamic be better memory-wise but worse in performance (cpu load)? Or a static system, better for readability sake but sacrificing client memory.

Some context might help answer your question.

Why are you wondering?

Im wondering what system would be better in the long run. I agree some contexts where one might be better but I just wanna understand the correct situations where one or the other would be better.

I think it really depends on the context of the system in question.

For example, I’m using a system where I assign a ‘Model’ component to an entity, the system searches for the set model in ReplicatedStorage, then creates a duplicate of that model in the workspace. Since I’m still in testing, I use very few models. In this case a Static system works very well as I can make changes to models very easily and I don’t have to first make a complex system to serialise, deserialise and store model data, and a system to be able to alter it. In the greater context of my game, this setup won’t result in a performance bottleneck or overload a client’s memory - even if it’s not the most efficient way it could be done.

However, if I had dozens or even hundreds of complex models, I’d quickly find a static system would be unsuitable. Unnecessary data is being stored. The entirety of the model library is being replicated to every single client, regardless of what they actually need. I can still make edits quite easily. And copying them into the workspace is a quick and efficient process. But the static solution doesn’t scale well. That should be main decider of what system you’ll use. Scalability and how it performs in the specific context of your game.

By converting to a dynamic system, I could serialise models into a binary format and store them on the server until they’re needed. This not only compresses the data, but it also takes it away from the client completely until it’s needed. Loading the data into the workspace will take longer, but you’re dramatically saving on memory usage.

Both techniques are more performant than each other in certain scenarios. For the worst case scenario of one, the other will perform a lot better. If you can predict how frequently the worst case scenario will occur for each system, that’ll help you make a much better informed decision on what system to go with. The worst case scenario for one might freeze the game for 10 seconds, but you know that the chances are it’ll only happen once every hour. But you might prefer that over having the game run slower constantly. And keep in mind, the static system will be a lot easier to implement. Dynamic systems take a lot of trial and error to work correctly in every situation, and you might opt for a static system purely to speed development time up.