Fast Paced Combat

So I’m working on a fast paced combat system & would like to have some tips/Discussion on different stuff:

  1. What type of hitbox do you usual use?
  2. How do you provide smooth attacks/m1s and ragdoll?
  3. Any problem you faced during the combat system? Like m1 priority (which player hit first)
  4. Do you think it is a good idea to create the hitbox on client & server for more, why?
  5. What do you think is the best force for knockbacks, VectorForce, LinearVelocity or AssemblyLinearVelocity
  6. Anything else you all want to discuss/advice/add to this discussion will be appreciated

I’m not an amateur programmer, so bring on the tough stuff so I improve :wink:

  1. For the hitbox, clone a rectagular part and weld it to the character.

  2. I don’t know what you mean by smooth.

  3. Just add a small stun each time the player gets hit.

  4. Hitbox part should be cloned on the server then welded to the character attacking.

  5. Use the deprecated BodyVelocity, it is the only velocity that isn’t laggy and replicates correctly.

  6. Use animation events to decide the precise moment of the animation where you create a hitbox.

Well these tips are nice but I don’t think it helps me much, in combat system there are a lot of challenges such as the server replication on client causing on some issues only visible on the client (not the server)

Remote Events.

Client activates abilities:

  • Fires remote event
  • Does their own SFX.

Server listens to the remote event:

  • handle damage
  • Fire the remote event to all players except the client that activates the ability

Other clients listen to the remote event:

  • Does the SFX.
2 Likes

I personally use Network Library for remote events, anyway, I think some people use client and Server to handle CFrame andragdolls etc to avoid the Server-Client Delay. I just want to know if you usually do this

Handling SFX on the client allows for smooth and reactive effects and decreases unwanted load on the server.
CFrames can either be handled on server or the client. It is better on the client because it is more responsive but it is harder to replicate and implement.
Ragdolls are usually done on the client.
Damage checks are done on the server for security purposes.

I typically use the Raycast hitbox 4.01 module when it comes to hitboxes. It uses raycasts over BaseParts for hit detection. However, it really depends on what you favour more in terms of performance. Raycasts are more memory & processing expensive over traditional BasePart hitboxes but provide a more accurate form of detection than BaseParts. I should also mention that the raycast hitbox module is primarily for melee attacks, it’s not ideal for objects/attacks that have a large surface area.

Creating smooth attacks, in my opinion at least, depends on visuals. No matter how well optimized your code is, if the animation looks sloppy/choppy it will look poorly made. Of course, code performance is still important but so is the user’s experience. I would highly recommend using the raycast hitbox module (mentioned above) to create accurate hitboxes, as raycasts are not limited by Roblox physics like BaseParts.

As for ragdolls, handling it on the client is ideal as Server-Client replication sometimes has latency issues leading to a player’s character being frozen in place briefly which is not helpful at all.

I personally avoid M1 priority as it’s heavily latency related, the most I would do is determine which player fired the first hit event to determine M1 priority. Giving high-latency players an M1 advantage may cause frustration for players fighting against them. If this is truly an issue, I suppose you can circumvent the problem by simply teleporting players to their closest server to reduce player latency.

In terms of creating hitboxes on the client or server, it really depends, once again. If you decide to create hitboxes with BaseParts, it would ideally need to be handled on the client due to server latency issues with BaseParts (not only for hit detection, but for also inserting the hitbox at the correct position when an attack is used). Same goes for a raycast-based hitbox as raycasts are expensive for server performance. Of course, the client should never be trusted so you will have to implement security checks for example, determining the distance at which the player hit another player to prevent extended hitbox cheats.

Lastly, for knockbacks, I don’t really have much advice for which one to use, each have their own purposes, so I suppose you should experiment with each to determine which one best fits your needs.

1 Like

I don’t understand how handling Ragdolls on client is ideal, what about filtering enable?

Sorry, I should have made this a bit more clearer in my post! Handling ragdolls on the client is ideal for the reason mentioned in my previous post, as for how you would go about this, you would want render to the ragdoll on each client, opposed to rendering the ragdoll on the server and have that replicated to clients, as this completely removes server latency affecting the client visually when it comes to rendering ragdolls as there will be no external factor (the server) and will solely rely on the client’s processing power.