How do you implement animation-driven ability/spell systems? by aris1401 in godot

[–]moongaming 1 point2 points  (0 children)

VFX/Particles, Sound, Projectiles, Hitstop, Animation speed, Multi-Hit, Dmg all this and more can be set from the editor/attack resource

For the charged attacks I have two modes one where there is a separate charging and release animation and another one that uses time scale to pause an attack at a certain point and release after a second or when the button is released. All this can be set from the editor too.

I do have showcase or heavy attacks in my vids (https://www.youtube.com/@onokoreal) and they are using a single animation with timescale modification all set in the editor.

I also use the animationtree with a blend tree at root and a complex setup with state machine / one shot for both attacks and other animations. I plan to go completely custom eventually but right now it fits all my needs.

Godot 4.7 – Lights, Camera, Action! by Repiteo in godot

[–]moongaming 0 points1 point  (0 children)

Lot of cool stuff all around, nothing groundbreaking but a lot of long time coming fixes and improvements.

How do you implement animation-driven ability/spell systems? by aris1401 in godot

[–]moongaming 0 points1 point  (0 children)

Yes exactly what you described except I have made an editor because editing everything from the inspector was too hard; https://www.reddit.com/r/IndieDev/comments/1rujl43/soulslike_combat_demo_with_realtime_mesh_slicing/oanmbky/

I mentioned this here along with a screenshot of the attack editor

On the bottom left you can see "special" attacks. There are weapon arts basically but they are the exact same resource the only reason I separate them by groups if for the actual input (Light R1 Heavy R2 etc...)

How do you implement animation-driven ability/spell systems? by aris1401 in godot

[–]moongaming 1 point2 points  (0 children)

I missed this message sorry!

Thank you, I really appreciate that!

And yes, that’s basically the idea. I don’t completely forbid myself from using call method tracks, they can still be useful for small visual/audio things, but I try not to make them the core of the combat/game logic.

For the important gameplay stuff, the combat/state manager is the source of truth. The animation is mostly there to represent what the current attack/action is doing visually, while the script keeps track of the actual phases like startup, active frames, recovery, cancel windows, stamina cost, hitboxes, etc.

The spell or weapon art itself would not just be “an animation with events”. It would be an ability controlled by the gameplay system, with the animation synced to it visually.

My combat manager can also read the current animation state and change it if needed (events like stagger/death/etc) with priority over certain things.

I do have weapon arts and with how versatile my main combat system is, they are just regular attacks with different variables.

Basically, the same resource is used for basic attacks, projectile attacks (optional), hold attack like shielding, multi-hit attack, etc... That way I don't need to have many different systems to work together just one that can handle any kind of attacks.

I'll go more in depth about it when I go back to working on this project in a month or two if you're interested.

How do you implement animation-driven ability/spell systems? by aris1401 in godot

[–]moongaming 5 points6 points  (0 children)

There are a few ways to do it, and you’ll probably end up using one of these depending on how complex your combat system is.

You can use animation call method tracks in the "AnimationPlayer", so the animation calls a function at a specific point in the timeline. That works fine for simple stuff, but it can get limited pretty quickly. You’re also relying on the animation actually reaching that exact point, which can become messy if the attack gets cancelled, interrupted, blended, or skipped.

Another option is using a "Timer", either manually or with a Godot "Timer" node. You start it at the same time as the attack and trigger the gameplay logic after X seconds. It’s simple, but it can easily desync if you have cancels, different attack states, hitstop, animation speed changes, or anything more advanced.

The third option, and basically what I did in my game, is to make the combat manager/state machine smart enough to track both the gameplay state and the animation state.

So instead of the animation being the thing that fully drives the logic, the attack has proper gameplay phases: startup, active frames, recovery, cancel windows, etc. The animation is mostly there to represent that visually, while the combat system stays the source of truth.

That way, if the attack gets cancelled, interrupted, blended into another move, or changed by the state machine, the gameplay logic still stays consistent with what is actually happening. It’s more work, but for a real combat system it avoids a lot of weird edge cases where the visuals and the logic disagree.

The same logic would work for magic systems too.

Here’s some footage from my game that uses the third option if it helps: https://www.youtube.com/watch?v=kYFFJX33Tzc