Тёмный
No video :(

How to Build a Modular Ability System in GODOT 

Andrew Hoffman
Подписаться 36 тыс.
Просмотров 41 тыс.
50% 1

👍👍👍 and subscribe for more GODOT tutorials: / @and1hof
Check out my best selling AppSec book: amzn.to/3pGO4Vz
Check out my behind-the-scenes newsletter: www.andrewhoff...
In this video tutorial learn how to build a modular ability system using the GODOT game engine. Abilities built using this architecture can be composed, upgraded and transferred easily to new games.

Опубликовано:

 

24 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 48   
@betadyne9559
@betadyne9559 Год назад
Very good tutorial. Most tutorials focus on implemeting the ability, but not about scaling your whole game to implement multiple systems, and this is really lacking in most tutorials. Thanks !
@pcelarstvo7971
@pcelarstvo7971 2 года назад
Just a bit bigger text in editor would be great! :)
@MuffinMan_Ken
@MuffinMan_Ken 2 года назад
The "move" ability takes parameters for the movement direction, so the appropriate Entity needs to know that. If the Entity using the abilities needs to know how to call each ability, it seems like it's not achieving the goal.
@badunius_code
@badunius_code Год назад
Markov Chains?
@poipoi300
@poipoi300 Год назад
It could be modularized even more, but I still feel like it's achieving the goal perfectly. The entity is responsible for WHERE it wants to move, not HOW to move. Separating logic from state, as intended. Going further is semantics and we'd have to really look at a specific case before being able to say which method is best. Even then, it's never perfect. There are always benefits and drawbacks for every sensible approach.
@diefuemf4416
@diefuemf4416 10 месяцев назад
I agree with your concern. I think it is still an interesting approach to have modular abilities. But I would remove any extra parameters from the execute() method and just pass only the Entity. I think, I would add two methods to Entitiy "get_move_vector()" and "get_aim_vector()". Then the ability can call these functions as needed. The ability shouldn't handle tracking the mouse position, that is part of the player mechanic. NPC AI can then implement other approaches where to aim at. When thinking about enemy AI, I see some additional problems. I guess, the AI script must know exactly what abilties it has and how to use them effectively, like dash away from an attack using blink or blink towards the player and doing a melee attack. Not sure if such a system is suited for every style of game, but I will try to play with it.
@kunai9809
@kunai9809 2 года назад
also use relative file paths! so that line isn't dependend on where you put the ability folder 7:47 var ghost = preload("./ghost.tscn")
@ygypt
@ygypt Год назад
damn b thats a great idea
@hiiambarney4489
@hiiambarney4489 Год назад
@@ygypt i hope that this b stands for boy.
@ygypt
@ygypt Год назад
@@hiiambarney4489 it stands for bingus
@SCALENE5
@SCALENE5 2 года назад
Dang Man. This is Amazing. Been looking for some thing like this for a while You could even go one step further and make the UI reflect the config options and have it be a system which go from code to no code and all be modular. Love it.
@godotShaderBoy
@godotShaderBoy Год назад
Really amazing tutorial! Created an ability shop where heroes can pick custom abilities. It's highly inspired by your method, thank you very much!
@badunius_code
@badunius_code Год назад
55:00 "a game where you start as a _primitive_ adventurer" @ player character is literally a square 🤣
@charlesabju907
@charlesabju907 6 месяцев назад
Dude I clicked, this video has less than 55 minutes
@AgnisNeZvers
@AgnisNeZvers 2 года назад
A bit improved ability loading would be to export variables for a PackedScene type. Because that does the preloading automatically and you can pass it to AddAbility() function... But then again why not just have them already in the player controller scene, that's inherited from the Entity scene? This system works, but I don't like the fact that entities need to know about the ability. In my opinion, for the ability to be modular, it should work by itself and affect its entity. So when an ability is ready it should fetch the reference of its entity, then go it's way. Then entity doesn't need to control abilities and abilities could control their own cooldown.
@fatfingersman
@fatfingersman Год назад
Hi Andrew, very nice that youtube algorithm recommended your channel to me!
@RadPotato2
@RadPotato2 2 года назад
Cool tutorial, also sounds like a neat idea for a game, you should do Dev logs on it!
@volt5
@volt5 2 года назад
Nice, elegant approach. It would be helpful if this video was in your Godot playlist.
@ygypt
@ygypt Год назад
this system loses its modularity when you introduce any entity-wide state, for instance a can_move variable. this can be solved by a property accessor that looks for entries in a dictionary and initializes one if it doesnt yet exist and the entry is removed when all abilities that reference it are gone
@Gandalf_Le_Dev
@Gandalf_Le_Dev 2 года назад
Very good tutorial it is very interesting. I was wondering how you would handle animations. Do you play them from the ability with the self or not ?
@jugibur2117
@jugibur2117 2 года назад
Wow, that was such a great tutorial, thanks for your effort!
@tprime2702
@tprime2702 3 месяца назад
Subbed. Amazing. I am tweaking this for Godot 4 and if I upload a modified/updated version, I will credit you thoroughly. This was brilliantly done, and it curtails the hazards of making long switch case statements without any structure in how one organizes their overall project. For anyone interested in a poor example -> See Undertale for examples of how to NOT structure.
@flashbash3233
@flashbash3233 6 месяцев назад
very well designed. excellent work!
@jasenlakic5033
@jasenlakic5033 2 года назад
Great system, will implement it right away thanks :)
@collinvisser7108
@collinvisser7108 2 года назад
nice - have you looked at resources files to do the same thing ?
@God_of_Art
@God_of_Art 10 месяцев назад
you are the best
@JayBekkr
@JayBekkr Год назад
Thank you, this will be very helpful :D
@stevendevonport737
@stevendevonport737 Год назад
Just watched this and a great introduction, one question how would you introduce temporary abilities rather than permanent ones through this approach. For example say I want to allow a weapon to have extended range for a number of turns?
@poipoi300
@poipoi300 Год назад
You could probably have the state be a parameter of the ability call, so the ability is responsible for keeping track of whether it should stay instantiated or not.
@Kazuren
@Kazuren 2 года назад
How would you go about coding an ability that would require some functionality of the entity/player to stop functioning? For example a channeled ability that would stop you from moving/using other abilities while you're casting it.
@SCALENE5
@SCALENE5 2 года назад
Just bouncing an idea. Maybe there is a way for a child node in Godot to restrict properties of its parent node and then give a list of acceptable properties which can still be changed?
@paulsullivan649
@paulsullivan649 2 года назад
You would only need to send a reference of the entity using the ability that the ability can then refer back to to set any parameters you need. For example, the ability can set the player velocity to null while a timer on the ability is still running.
@josebenavides1850
@josebenavides1850 2 года назад
Not sure if tags are a thing? You could have a dictionary of tags that an ability should cancel when it's activated.
@sechmascm
@sechmascm 2 года назад
Inside any ability have a check for that. Let's say a bool is true for abilities that lock the player in place, although generally you wouldn't want to let the player call 8 abilities on the same frame. Maybe a system that's similar to a behaviour tree where you have abilities that need to be fully executed before anything else happens, or abilities that run regardless of any other inputs made by the player, etc.
@will7466
@will7466 9 месяцев назад
Is there a link for your code?
@nicowagner8655
@nicowagner8655 5 месяцев назад
A question: Why do you instance the abilities in script and not do a more dynamic instancing? As of now i i want to bar player access to an ability i would need to have it load in anyways and the use a bool or deactivate the node to lock access to it. But if i would create an array of attacks, i would only need to write a loop which iterates through the array positions and uses the load_ability function to instance the abilities as children. Thus i would be able to add key-value pairs to the array to extend the list of available abiliities and reduce the amount of code if i had something like 100 abilities that could possibly be used by the player. I wouldnt even need a hardcoded list of what abilities the player has since i could just add them to the players array when they interact with something for example. The only CON i can see here is you dont have an easy grab for the ability. Tho you have the array as a library anyways so not a problem i see. Do you think an alternative solution would work better? Thank you for the guide, it touches on many important design matters like factorys and inheritance which are crucial in designing a well functioning modifiable game
@Darkest-Kn1ght
@Darkest-Kn1ght 2 года назад
I have watched this video, as well as your scalable video several times and have enjoyed them both tremendously. I'm currently attempting to get better utilizing the godot engine to begin building games. I have already (in godot 3.4) created a completely separate dedicated multiplayer framework and am in the process of slowly trying to recreate it within the 4.0 alphas that are slowly being released. My goal is to build a "base", upon which I can implement "upgrades" which will expand upon the base. New characters, abilities, places, npcs, etc..., but I am wondering about the entity script. My game will be sci-fi based, and will have normal humanoid-based characters, it will have 4 legged, 6 legged, and 8 legged entities, all with different defaults. I'm thinking I will need to utilize a different entity base for each type of character and though this seems just too easy to me, would I only need to implement, for example, entity2.gd, entity4.gd, entity6.gd, and entity8.gd from which to inherit to different characters, then just make sure each character inherits from the proper entity script? This just seems like it would be too good to be true as it would appear, to be far too easy. Would it actually be that easy, or am I missing something entirely?
@Shupertux
@Shupertux 2 года назад
Would need to know more about your setup, but there are some coding ways to handle this using overrides and overloads. Where the entity4 inherits entity.gd but then overrides some of the features or just adds more methods. You could also just add overload methods to the entity.gd script like if you had: regen_mana(amount) you could add a new method called regen_mana(amount, numOfLegs) this would extend this entity method to allow for code specific around the number of legs. or you can refactor regen_mana to always take in a numOfLegs but default if its not provided to humanoid. regen_mana(amount, numOfLegs = 2) not sure the syntax in godot but this is something that is done but you can end up in iheritance hell if you not careful.
@arisu8118
@arisu8118 11 месяцев назад
I know this video is very old but it would not hurt to try, I have a problem starting the physics of falling. I called the gravity project variable within entity.gd, but the method ,if not is_on_floor(): velocity.y += gravity does not work within the player or within move.gd :(
@utkarshshukla
@utkarshshukla Год назад
How do I package the modular abilities to load them in runtime...
@IllusionistsBane
@IllusionistsBane 2 года назад
How much more complicated will this get if the ability needs to invoke a certain character state? For example, if I want the ability to make the player jump on execution?
@user-uj1cr1qg6k
@user-uj1cr1qg6k 2 года назад
Hi. It is good video , but how i can do health and mana regen every 1 second? I not see game master .gd script.
@Oasez_
@Oasez_ 2 года назад
How would you handle animations on the character with this system? For example, how would you play the idle animation since it's not an ability
@udippatel6147
@udippatel6147 2 года назад
tweens are supposed to be able to change any property of any object over time. if you create a modular set of functions that run tweens on location/rotation, might be able to reuse those functions on any set of objects. i am trying to see if i can do this to tween between shape keys of my objects, will see how it goes.
@ygypt
@ygypt Год назад
@@udippatel6147 pretty sure they mean like spritesheet animations. tweens are irrelevant there
@brandonstone2754
@brandonstone2754 Год назад
What happens when you need things like pathfinding on a tilemap
@violanze8484
@violanze8484 9 месяцев назад
is it working for godot 4 3d?
@pietraderdetective8953
@pietraderdetective8953 Год назад
The font is too small to read in a phone's screen..i've been enjoying the contents of your channel but I can't do that using a mobile phone. Please kindly increase the font size in the text editor, thanks!
Далее
Easily Build Projectile Weapons in GODOT
8:38
Просмотров 16 тыс.
Using Composition to Make More Scalable Games in Godot
10:13
OBLADAET - BARMAN
03:06
Просмотров 251 тыс.
Damascus Steel From Stick Welding Electrodes
14:15
Просмотров 650 тыс.
The Clever Way to Count Tanks - Numberphile
16:45
Просмотров 1 млн
We made Vampire Survivors BUT in 10 Lines of Code
7:08
A new way to generate worlds (stitched WFC)
10:51
Просмотров 525 тыс.
I forced EVERYONE to use Linux
22:59
Просмотров 435 тыс.
They made a game about philosophy...
23:19
Просмотров 457 тыс.
How To PLAN your Game as a Solo Developer
16:26
Просмотров 488 тыс.
Now anyone can simulate flow for a 3D printer duct
11:17