MOBA-Style Game Experiments with Godot
I am currently experimenting with a prototype for a MOBA style game using Godot. I’m trying to figure out the best way to manage the characters and their skills.
All characters will have similar attributes (Name, health, run speed, strength, etc.), but each character’s skills will be different. I need to be able to configure skills so that I can use re-usable behaviors when possible.
Ideas I’ve Tried
I tried to use resources for the skills and characters, but it looks like resources may not be the way to go since I can’t seem to have different behavior/scripts for each resource instance.
I also tried with a PackedScene. I may be able to have custom code using a scene, but I’m not sure how to access the skill name from the packed scene.
For the character, I think I can use a resource. This would have a Name, Sprites/3D model, etc. I would like to have a way to assign skills to my characters, and be able to access them from the player controller to display them on screen and call them when needed.
One approach you can take is to use a combination of resources and script inheritance in Godot to manage the characters and their skills.
Here’s how you can set it up:
Create a base character resource that contains the common attributes for all characters (Name, health, run speed, strength, etc.). This resource can be a
Script or a
Resource depending on your needs.
Create individual character resources that inherit from the base character resource. Each individual character resource can have its own unique attributes and properties.
For the skills, you can create a separate resource for each skill. Each skill resource can contain the behavior and logic specific to that skill. You can use scripts or scenes depending on the complexity of the skill.
Assign the skills to the individual character resources by adding a property to the character resource that holds an array of skill resources. This way, each character can have a different set of skills.
In your player controller, you can access the character resource and its assigned skills. You can display them on the screen and call them when needed by accessing the properties and methods of the individual skill resources.
By using this approach, you have the flexibility to configure skills for each character and reuse behaviors when possible.
Note: This is just one approach, and there may be other ways to achieve the same result. It’s important to experiment and find the approach that works best for your specific game requirements.