PvP Game Architecture?

Hey there!
I’m trying to plot out a game structure which includes features like Dashing, Attacking, and getting Stunned.

Suppose we have the following situation:

1 → Player 1 Begins Attack Animation
2 → Player 2 Begins Attack Animation (with lil delay)
3 → Player 1 Hits Player 2
4 → Player 2 Also Hits Player 1 (with lil delay)

Now, logically, the 4th step should not even take place. I can handle the backend for this by labelling Player 2 as ‘Stunned’ after the 3rd step and then ignore Player 2’s attack request.

Problem is, I don’t know how to reset the Animations, clean up the VFX, reset Velocity, Disable BodyGyro’s etc; like resetting everything that took place during Player 2’s attempt at attacking which failed.

// In games like Black Magic II, I can't help but notice how their Guardbreaks, Parries, Superarmors and Immunities work so well at cleaning up after the player who got countered.

I’ve considered StateMachines and have worked with them in the past, but I don’t know how far they will get me.

EDIT : I forgot to mention, I’ve learnt the Knit framework, so if anyone wants to talk specifically about that, please don’t hesitate!


This isn’t really a general question, but I’ll try to put it that way.

So, first of all, you should try not to create these instances in the first place. VFX should be parented to the character at all times, and not being cleaned up, just disabled. BodyGyro is deprecated and I recommend using CFrames directly.

For player states, I recommend creating your own OOP framework. Once it’s done, you can add as many features as you want and create the game overly advanced.

1 Like