Handling hitbox

I’m working on a combat game right now and I was wondering on whether to do client-side hitreg or server-side. On melee hits clientside hitbox would work easily since for sanity checks you can just do a simple magnitude check but it gets way more complicated when it gets to abilities, let’s say you have an ability that has a long hitbox or anything irregular, simple magnitude checks won’t help that. Are there any alternatives or sanity check tricks that could work or do I stick to server-side.

1 Like

Client SIded combat.

I dont know any game that relies on Server-Sided Combat.
It causes delays.

That’s not what I asked at all.

You didn’t?
||||||||||||||||||||

Well maybe you should read what I said completely instead of reading the first line and answering.

Lol? You’re joking? The reason you assume they use client-sided hitbox is because of animations, animations play on client then an event on server handles hitbox.

Use RaycastHitbox and on the OnHit event, conclude a distance check with magnitude.

Heres an entire essay for the “confusion of me not answering 50% of your question”

There are a few alternatives and sanity check tricks that you could consider to improve hit detection in your combat game:

Hybrid approach: You could use a hybrid approach that combines client-side and server-side hit registration. For example, you could use client-side hit registration for melee hits and server-side hit registration for abilities or attacks that have irregular hitboxes. This approach can provide a more responsive gameplay experience while still maintaining the security of server-side hit registration for more complex attacks.

For abilities you would MOST DEF USE client to server with server checks with Booleans, positions. debouse etc

1 Like

I was thinking about doing abilities on server-side but I was wondering if there was a cleaner approach. Do you have any ideas other than magnitude checking from player to hit target?

Raycasting: You could use raycasting to detect if an ability hit a target on the server-side. Raycasting involves simulating a line or beam from the attacker’s position to the target’s position, and checking if the line intersects with any obstacles or entities in the game world. If the line intersects with the target’s hitbox, then the ability is considered to have hit the target.

Collision detection: You could use collision detection algorithms to detect if an ability hit a target on the server-side. Collision detection involves checking if two or more objects in the game world intersect with each other. You could use different collision detection algorithms depending on the shape and size of the ability hitbox and the target hitbox.

Hitbox approximation: You could use an approximation of the ability hitbox to simplify hit detection on the server-side. For example, you could use a bounding box or sphere to represent the ability hitbox, and check if the bounding box or sphere intersects with the target hitbox. This can simplify hit detection and reduce the computational load on the server.

Yes, is this a case of the classic switcharoo?

Might try hitbox approximation, thanks.

Anytime! :smiley:
|||||||||||||||||||

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.