Problem with rendering enemies on client-sided (tower defense)

Synchronize the enemy once before spawning on the client using workspace:GetServerTimeNow(), then use RunService.PreRender and deltaTime or os.time() for path movement. This will make the movement smooth since it doesn’t depend on workspace:GetServerTimeNow(). Only send clients the list of enemies in the wave and unit creation, nothing more. The client should calculate the absolute position using all resources on its own

For example, the server created a unit that slows enemies within a radius. The server sends a creation signal to all clients. The client iterates through all current enemies and checks: did the enemy intersect the slowdown radius before the unit was created on the server? You calculate the enemy’s position at the moment the unit was created on the server, and so on, and so forth. There are many moments to account for: the enemy is inside the circle; the enemy passed near the circle at a short distance, less than the radius; the enemy passed at a great distance

by the way, I created a similar system, but it is extremely not optimized in terms of memory, and generally has insufficient methods

1 Like