What is Client Side Rendering and how do I do it?

I’m making a tower defense game and I’ve just found out that tower defense games use “Client Side Rendering” though I don’t know what it means. I know the meaning of client and servers and all that stuff but not really familiar with “rendering” in Roblox Studio. All I know about rendering is that 3d modelling programs “render” the 3d model and make it look good for like a video. What is “rendering” on Roblox Studio and how do I “Render on the Client Side” to optimize my game.

All rendering means is generating an image, your computer does some advanced calculations like calculating light, shadows and objects, vertices, e.t.c, and spits it out as an image. The computer just takes all those calculations and makes an optical illusion to make it look 3D.

Rendering on the client side means exactly as its named, it renders objects on the client, for example a client sided render of a cube will only be visible to the client, and the server won’t recognise it.

This optimises the game because if the server doesn’t recognise the data/the data does not exist on the server. It takes up less memory and putting less stress on the server.

You can try this out yourself, if you create a place, insert a local script in StarterCharacterScripts, and type something like this and test:

local Part = Instance.new("Part", workspace)
Part.Position = Vector3.new(0,10,0)

It will create a part 10 studs above 0,0,0. And you will be able to see it. But if you move onto the server, you can see the part is invisible and is not seen.

Client:

Server:

2 Likes

Okay let’s have an example.

My tower defense game has moving units. Are the positions of the units listed on the server? And all clients are just updating the position to their client. I’m currently facing a bug where if I change the rotation of the unit to look at the enemy on the server, since the client is slower then the server for some reason when the server changes the rotation the unit on the client side just instantly teleports to that CFrame. Would “Rendering on the Client Side” mean I’d have to use a remote event and use :FireAllClients to change the rotation and position of the unit?

Will the VFX also be using this type of system??

1 Like

You could do that but you could also have a folder of CFrame values that the server constantly updates and the client constantly cycles through so that you don’t have to spam remote events (I’m not 100% sure if it is but I think it should be more optimised than spamming a remote event )

1 Like

If you want them to replicate to every client, then they should be.

You can do that, but I think just moving and rotating them on the server is much more practical, and there is less delay. And your not spamming remotes.

I have no idea what you mean, explain a little bit more.

So every unit will have a their own CFrame Value instance and using run service it gets the position of the unit. On the client it will keep changing the position of the unit for the client matching the CFrame value? So basically the client just updates the position of the unit depending on the CFrame value that gets updated every heartbeat on the server?

Yea that should work charssssssss

That’s a weird way to do it, also you can’t use RunService on the Server. And a while loop wouldn’t be fast enough.

Alright got it.

Rotating them on the server alone will have a big delay on the client.

Really sorry for the bad explanation. What I meant was Since the client is replicating what the server does to the player, there will of course be a delay, especially with a moving humanoid. When my unit (12 WalkSpeed) moves on the server, there will be around a 2-4 stud gap between the server and the client. We could use “past and future” terms like the client is 2 seconds in the best of the server. The problem lies when I change the CFrame of the unit on the server. If I change the CFrame of the unit, it will “Time Travel” to the servers pace and go straight to where the unit is “On the server” and since the server and client have a 2 second gap, it will look like as if the unit teleports to that CFrame. Think of it as Jojo’s Bizzare Adventure’s “King Crimson” if you watch the show. Really sorry for the bad explanation and no video, I’m having trouble uploading videos due to my connection,

Pretty sure we’re able to use runService.HeartBeat on server? Correct me if I’m wrong.

Whoops, your right, you can use RunService.Heartbeat on server, didn’t know that…

the more you know ig…

It will leave a delay, but not a huge one.

I still not quite understand, if possible, upload a video or maybe turn your video into a gif and upload that, or use a streaming platform like google drive or Gyazo.

No it’s massive.
Would you mind if I get your discord so I can send the video?

I don’t have discord lmao, kind of sad.

But the truth is it’s just not possible to remove this delay, that’s just always going to be there. You can’t really avoid it, it’s the same in other games besides Roblox. I don’t know what to tell you ig.

1 Like

Really thanks for the help. So for the resolution, Client Sided Rendering is just having all the effects and important visual stuff only be on the CLIENT instead of SERVER AND CLIENT. This is so its more optimized and less laggy.

Please correct me if anything is wrong and add more information if I missed any.

Close enough I’d say, sounds good.

Never mind I didn’t see ur post mb

1 Like

If I’m not mistaken, Client Side Rendering just means creating models in the client instead of the server…

For example, I’m making a Sword System and i decided to make a completely custom tool handling system instead of traditional roblox tool handling.

Obviously i would start by making it so when the Player Equips the Tool, the Sword appears on the Player’s Hand… and if did on the server, it might cause some problems, so i decide to make it so that the Sword gets created on the Player’s Client, and does so on every other Players… which means Ping won’t really affect the Host (one with the sword) when they want to Equip a New Tool

If too confusing, you can try to reverse engineer this code

local RenderedTowers = {}

local function PlaceTower(TowerModel)

local NewTower = TowerModel:Clone()
NewTower.Parent = workspace
table.insert(RenderedTowers, NewTower)

end

ReplicateTowerEvent.OnClientEvent:Connect(PlaceTower)

And if a Player wants to move the tower, what you could do is use FireAllClients, and since all placed/rendered towers is placed in a table, make a localscript that tries to find the specific tower inside the RenderedTower table, and then move it to the target position… and to find the specific tower you can give each tower a unique code, by using this instead

local uniquecode = uniquecodegeneratorbleh -- string

RenderedTowers[uniquecode] = NewTower

and then to find the tower and do something to it, you can do this

local towercode = towercodehereithink

local FoundTower = RenderedTowers[towercode]
FoundTower.Position = newposition

So the sword wont appear on the server and when the player attacks only the hitbox will he on the server?

Correct! The Hitboxes (this part can be on the client though, but up to you), Damage Handling, and others will be on the server…