Client visuals?

In my game, there will be a lot of bullets being fired. I would like it to look as smooth and accurate as possible. I’m thinking of doing it like this: every time a bullet is shot it also activates a FireAllClients event, passing the bullet size, direction, speed, and starting point. I just want to know if this would work before jumping into it.

If you fired an event for EVERY bullet, the game will lag alot. Instead, try making two events: one for starting to shoot, then one for stopping shooting. This will prevent alot of lag, since you are not sending many events over.

1 Like

It would still work for every time a bullet is fired, it would just lag especially if you are sending all of that info for every bullet.

i think if you anchor the parts and move them with CFrame.LookVector your game will be less laggy

Would it be possible to send the actual bullet object as a parameter and put the bullet into the workspace of every client?

1 Like

If you are meaning by this: “If you fired an event for EVERY bullet” then it will work, but it will just lag alot.

1 Like

Is there any way I can make it not lag? Or at least keep it to a minimum?

1 Like

I dont really know another way. What game are you using this for anyway?

Edit: im saying this since i dont understand why you would need every bullet to be fired

I fixed it, the bullet is first shown on the client. Then it sends the CFrame and when to destroy the bullet to the server. It finally sends this data to make a bullet shown on anyone’s screen who is close enough to the player to see it.

1 Like

Yes, you’ll be better off making it so that people within a radius are the only ones who can see it. I do this with my game and I always split sounds, particles, and 3D FX into the client - so far I have not encountered ANY lag.

Future Reference:

Client - FX, sounds, particles, visuals.
Server - Hit Detection, game loop, managing clients

EDIT:

To add on to this, things such as bullets could still be expensive - even on the client, so it’s times like these where it is recommended to use a “cache” of bullets.

@EtiTheSpirit’s PartCache will come in handy, it lets you supply a template to create a cache of parts for later use.

But, don’t fear sending a whole ton of requests to the client, as long as it’s not a RemoteFunction, it can keep up with it. (Don’t be ludicrous and send data to the client every tick)

2 Likes