Powers System - Server or Client?

Hello! I am scripting a powers system, something similar to what you might see in many popular Anime games such as Anime Fighting Simulator, Boku no Roblox, Blox Fruits, etc. In these games, the player will activate a power/ability by pressing a key, at which point we need to spawn in various parts and particles (mostly parts) for the effects as well as have some other parts that handle hit detection.

My question revolves around where to run the effect parts, server or client? Currently I am setting everything up and running on the server, but I have been told this might become problematic with more players in game (hoping for around 16) and that I should consider animating effect parts on the client instead and just let the server do the hit detection.

My current system works like this:

  1. player hits key, send remote to check which power they have
  2. server then spawns in the required parts and sets them in motion
  3. hits and damage are all done on the server as we might expect wit parts already used in animation
  4. parts get get destroyed when they are done

A client side method might look like this:

  1. player hits key, send remote to check which power they have
  2. server does checks, then does a :FireAllClients() where each client is then spawning in effect parts
  3. hits and damage are done with special parts spawned by the server
  4. parts on server and on client get destroyed when they are done

The server version is much simpler and I don’t have to worry about clients seeing powers/hotboxes de-syncing. If I do the client-sided version, I am worried about the server-side hotboxes not syncing up with the client-sided animations and the whole thing looking messy and feeling weird in PvP situations.

Specific Questions:

  • Will doing things completely on the server with around 16 players really be a problem?
  • If I split things up between client and server, how do I keep the hitbox in sync with the effect parts?
  • I know this have been done many times before on Roblox, does anyone have any advice?
1 Like

Always have the player that is initiating the action receive instant feedback, it helps keep them immersed and know that their powers are being used. No one likes to see a delay in game.

Your methods should only receive information that is needed to recreate the result on other clients. (Facing direction, positioning, etc…). Use FireAllClients() to have them manage their own view of the power.

The reason for this is to try and minimize the server load. ROBLOX servers can handle a lot, but not all player connections can. Some players have more poor connections than others. Also, a server with high ping will cause players to lag more than others in different circumstances. Servers should only handle things that players do not need control of. Such as important information and key objects.

Effects and client sided things (Objects that the server shouldn’t care about) should be handled by the client. If the server handles these objects, there is a possibility of visible latency for some, or every client (Depending on their connection).

Firing just one remote event to all clients and having all clients process their own effects will have smooth transitions (since its ran on the client machine) instead of relying on the client’s connection to the server to receive the information.

Processing 100 parts on a client is more efficient than the server. Since the server will have to process and transmit the data to the clients 100 times. (Again, latency desynchs can occur) Try to abuse the client’s machine as much as you can. ROBLOX does not fry the client’s computer. Anything you can throw on to the client for processing makes your game much better on performance. Once the server starts lagging, it’s a bad experience for everyone. Which also leads to remote event delays.

3 Likes

makes sense, but how to handle desync of where the server thinks the hitbox is and where the various clients think it is due to animations?

For example: player 1 shoots a fireball at player 2, a medium-speed projectile. The server does its check and spawns the part responsible for registering hit to other players while sending the :FireAllClients() to set the animations and effects in motion. Player 1 sees this all happen as it should be, the server ping for them is such that the hitbox part ontheir server and the aniamton parts are well synced. Player 2 however has a slow connection, the server syncing the hitbox part and the animations are not well timed, and they experience being hit and taking damage while the effectparts have not touched them.

Ok so, given example above, how do we address this issue? Thanks!