- Home /
Question on hitboxes and an online fighting game
This is more of a general design based question.
I am working on a 2D fighting game and was looking for some advice on hit boxes. Since I will have an online multiplayer component, I was curious which design practice sounds the best for networking code:
For each character, have all their hit-boxes attached with the character prefab and simply activate them. So all the hit boxes are in the scene, placed in relation to the character and they only activate when the correct attack is called.
Instantiate each individual hitbox in relation to the character and delete the hit box after use.
I think the first choice might help the net code since I won't be making so many instantiation calls at once. The second option might be a bit more complicated to deal with and lead to some complication issues and a lot of true-false validation for the moves.
Thank you for any advice!
Answer by rutter · Mar 28, 2012 at 08:39 PM
It sounds like you're already leaning toward the first option. It's a little more work up-front, but also sounds like it could run faster and might be easier to debug.
As still another option, what about using trigger colliders to manage the whole thing? At that point, you don't even have to enable/disable them, and you can just check if a particular trigger should be "hot" for the current attacks.
Your answer
![](https://koobas.hobune.stream/wayback/20220613065638im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Collision Updating UI Slider only once. 1 Answer
Network Animation Layers 0 Answers
how to activate smartfoxserver 0 Answers
My network server doesn't work. 0 Answers