What's the best method to create a melee combat system?

As the title says, I’m looking forward to find a new method. I already tried different methods:

  1. Raycasting, which I always use for my combat systems
  2. Region3, I tried this and it looks very good, but many times it doesn’t work properly (ex. you can hit behind the player’s character);
  3. Touched, very laggy and unresponsive. The hit is very delayed;
  4. Magnitude, well it “works” but as you all know, it finds target near to the player in any direction, which is not what I’m looking for.
    The best way would be to make the client do the hit, then fire a remote to the server telling the server which player was hit, but that would be a mess cause of exploiters.
    So: does anyone here know how to create a good non-laggy and functional combat system? And also, what method do you recommend in the 4 I mentioned? Thanks! :grin:
2 Likes

Yeah you’re not really giving us any information here. The methods one uses depends entirely on what one is trying to make.

A melee combat system is a very vague. There are lots of different kinds of melee combat games out there. Something like mordhau and something like insert MMO here aren’t going to be comparable at all

3 Likes

I am curious to know what method did you use for the combat knife tool in your Project (The Wild West). I am assuming you used raycasts (since it is a pretty nifty function), but with short distances and curvatures.

Region3 is my recommendation mate ive seen alot of epic combat system just made with Region3

Edit1: As an example elemental battle ground

1 Like

Yeah it seems like one of the best too. I probably just am not used to use it. Thanks for the answer :slightly_smiling_face:

1 Like

local threshhold = 0 --set this number to the ‘percent’ at which the object is facing the target (-1 for fully facing away, 1 for completely facing the target); values go for all real numbers between -1 and 1

function ObjIsLookingAtTarget(object,target) --make sure all arguments passed in this function have a CFrame value
local dot = (object.CFrame.LookVector:Dot(target.Position-object.Position).Unit) – computes the dot product between the object and target
print(dot>=threshhold) – is the object facing the target?
return dot >= threshhold – will return a true or false value for later usage
end

No idea what all this code means. Just grabbed it from somewhere.
Just wanted to throw this out there, to get you on the right track if you’re interested.
But you could mix magnitude with something that returns whether or not you’re facing someone.

Also I don’t think a quick frame magnitude check is too expensive to need to put it on client.

4 Likes

As you said in my opinion the best way is to wait for the hit in the client and then fire a remote to the server that’s the way that will give u the best response in my opinion and then u can just do checks in the server to see if that hit actually should have hit , like magnitude check or raycast btwn the
(target and you) to see if there is a part btwn both I cant think about more but there is surely more.

2 Likes

I find GetPartsBoundsInBox and GetPartsInRadius to be really good.

Oh someone found this topic after 1 year.
And yeah, surprise surprise, I use GetPartsBoundsInBox. I find it extremely useful. It’s basically Region3 but easier to setup and more advanced. More customizable too i’d say.