|Topic was automatically imported from the old Question2Answer platform.
I had no idea how to start implementing a combat system so I started working on top of the GDquest’s 2D JRPG Combat
I wanted to implement more complex behaviours as examples:
- skill requires an specific number of allies and specific number of enemies
- skill effects that trigger under specific conditions
I ditched the Action subclasses like AttackAction and started building Action out of resources that control the behaviour of the skill: data, target_behaviour, triggers, effects, etc…
It’s working fine but since I dont have much programming experience I would like to understand the thought process behind the original code.
One “annoyance” I found is that in ActiveTurnQueue.gd _play_turn() the action is hardcoded to be AttackAction and you need to use new() because its a Reference instead of a Resource, this adds some small complexity to the code and I don’t see any benefits is there any reason to use a reference over a resource here?.
I also want to know what do you think about my approach I’m worried about maintenance and readability.
How would you tackle these skills that have unique functionalities and behaviours withing the GDquest code, I just thought about creating subclasses of the Action types (Action subclasses) that overwrite the functions would that work?
Would you create a subclass for every skill with a behaviour that doesn’t fit in the current action types.
Just some ideas. I would like to use lists to contain the data. All your skills will be strings in a list. All the enemies will be on a list. The characters will be on a list. For the skill, I may try to build some basic functions that can assemble all kinds of effects. For example, some skills require the object (enemies or character) to move from one position to another. Then I will make a function that takes the start location and the end location and use it to move the object. Here is another example: some skills that may need to play an animation. Then I will make a function that takes the animation path and position to place it. Through this kind of function, I can make a lot of skills in a really similar way: provide the animation path and the position for each parameter. I don’t need a lot of subclasses to do that.
The skill will have a class called SkillClass, it will contain all the data I needed (the path, the position). I leave some rooms for custom function if the skill needs some calculation.
The skill is actually doing one thing: doing damage to a target. I would simply write this in the class as a function called give_damage() [sorry for the bad name.]
I got many other ideas, but I really need some sleep now.
Hope you have a good day.
dethland | 2021-09-05 04:48