Server or Client sided rays for gun system

This is the first game that I’m developing without tutorials and I already have a working gun system that fires rays on the server, but I keep people saying that client sided rays are way better compared to server sided rays. I just wanted to ask would you guys recommend server or client sided rays for my game? I want to know if I should remake it and make it fire the rays on the client instead.

I will also attach an image of my game, it’s a recreation of a 2D flash game that I used to play a lot.

3 Likes

client-sided rays are great for if you want your guns to feel responsive.
one major downside, however, is that exploiters have access to everything on the client side. they could easily spoof the origin or the direction of the raycasts, giving themselves an unfair advantage. this won’t matter too much if the game is singleplayer.

on the other hand, if you use server-sided rays, your guns will be more secure and less exploitable, but they won’t feel as responsive due to a delay between the client’s input and the server performing the raycast.

1 Like

Will the delay have a huge effect on the players experience?

1 Like

Client sided is better if you want quicker results after an input. Server sided has a less chance of helping hackers rig the game. It really depends on if you want to sacrifice response time or sacrifice having less hackers.

Also, consider the network ownership for the gun and raycast, especially if the raycast is linked with an object, like a bullet.

2 Likes

it would all depend on the player’s internet connection. if they have a pretty strong connection, there will be minimal impact. however, if the player has a weak connection, there will be a HUGE impact on the player’s experience.