Methods for creating Advanced Combat Systems

Hello people of the DevForum. I have a rather vague-ish question for you all.

I’ve recently been hit with the desire to re-try at making little projects and this time I wanted to try and make a combat system/game in an attempt to improve my abilities further. What I want to know is what is the best method of making a combat system or the pros and cons of each method?

I understand there are many ways to make combat systems, or more specifically hit detection? Some use raycasts, some use region3, some use hitboxes (might be the same as region3?) etc.

A lot of YT tutorials go on to use .Touched() though I have seen comments saying that this is a more beginner friendly way of doing it rather than an advanced/efficient way. They also use cooldowns and try to time the hitboxes to be correct when, at least I’ve heard, a better method to do this is to create markers/timestamps in the animation itself that you can link it to?

I’ve seen games that make module scripts for various versions of hitboxes/raycasts, I believe more so for Melee, Ranged and AoE abilities, is this generally done for combat games, or good practice?

I would like to make a system similar to games like Archived, Deepwoken, Type Soul, while allowing for more interesting and maybe larger scale visual effects/abilities. So absolute precision isn’t necessary (Maybe I can blend two methods?).

I’d love to hear your thoughts, ideas, suggestions and more.

Thank you all for your time!

The most practical way these games do these combat systems are with basic state machines. Never and i mean never use .touched for a competitive combat system. There’s a lot of free use hitbox modules on the devforum you can use. The thing that confused me the most about these systems is how the stun logic is handled because there has to be different types of stun depending on the game; If it’s a parry based game, then you have true stun, regular stun, endlag stun etc. You would have to find a way to smoothy transition between these stuns using states which is easier said than done. I would recommend learning how to use states to make a decently complex stun system before attempting an actual combat system. If you can do this, the rest of the combat system should be fairly easy to setup. (Main damage event / nodule that handles all types of damage, etc.)

What to use just depends on the needs.

  • Raycasts are precise but difficult to tweak since they’re embedded in movement (at least, assuming we’re talking about a melee raycast trail and not a gun).
  • Region3/Spatial Queries is a balance of precision and performance.
  • Magnitude is cheap but can only be made in a ball-shape.

.Touched(), as another has said, is not relaible. It’s only useful for when you need hit detection over a very long period of time on static objects over a long period of time, or if you aren’t concerned with precision.

Animation Events are bad for anything you need to tweak for game balance reasons. It takes far longer to open the animation up, move around the events, and wait for it to upload, compared to just changing task.wait(0.2) → task.wait(0.3).

Technically they could all go in the same modulescript, it just depends if it’s more readable for you or your team to split the module.