Reputation: 13
Apologies in advance for a probably super unclear explanation, as I am an extremely amateur game dev. I am currently trying to make a colony sim type game with the godot engine, so I am simulating a bunch of characters and having them interact with each other. Each character is an instance of the base character scene, which currently looks like this:
-BaseCharacternode
-UInodes
-LogicNodes
-LogicNode
-LogicNode
-LogicNode
Each Logic node contains the functions for calculating things such as relationships and day schedules and such. I was wondering if it would be worth it to change it so that there is only one overarching instance of each logic node in the game that each character refers to, if that would increase performance as there would be way less data in each instanced character or be a complete waste of time as the communication between each character would take longer. Again, sorry this is so convoluted, I am yet to learn a lot of the technical jargon
Upvotes: 0
Views: 214
Reputation: 171
Though I'm a fan of having objects knowing their behavior, in the case of "game characters" such an approach will most likely end up with wasting toom much of resources.
In such a context, I believe it will be more effective to have a "service level" that will handle all the logic and have characters as simple data-structures. So you can have services to handle logic and simple objects to represent characters.
I'd advise you to take a look at refactoring.guru to find more info about design patterns. It's a really good collection that will help you for sure - I use it all the time to refresh my mind.
Upvotes: 0