How would I structure a Combat System?

I’ve been wanting to make an efficient combat system, and currently I’m wondering what should be coded in the server and what should be coded in the client

Some people have told me: “Server is only for logic, client should handle everything else”
Is that so?

I’ve also seen that most good developer seem to use ALOT of module scripts

In any case if I had to sort many aspects of develping into 2 lists:

– // Animations, hitboxes, 2 player animations, Moveset logic, Damage logic, Stun logic, etc…

How would I sort them into 2 lists? Serverside list and Clientside list, what goes where?

I can give you a rough outline. What you are doing with the modules is purely visual and for yourself at that point. It can be simplified via functional programming. The modules may look impressive, but they aren’t. You can use that many modules, but there is really no point. Although more math-y stuff, like hitbox logic, raycasting, or things which are for repeated usage, would be a good idea to put into modules.

It’s really not that deep. People overcomplicate for nothing. A simple, usable approach is: client-handler (local script, with your modules, your game logic, etc.) and a server-handler. (server stuff, applying damage, damage verification, etc.)


Effects: client

General user experience logic (inputs, animations, stamina, etc.): client

Applying stun/knockback: client (i.e client stuns himself; results in smoother experience) If people argue this should be done on the server, I disagree. All these things will result in a client replicating his physics, so they can be turned off nonetheless.

Hit detection: client (raycasts are good)

Applying damage and validating damage: server

Other sanity checks: server

e.g:

client_sanity_check() → client_hit_function() → client_cast_hit detection: hit detected → hitremote:FireServer() → server_validate_hit() → server_apply_damage()

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