Laggy Camera Shenanigans
by Ben Garney · in Torque Game Engine · 12/10/2003 (1:14 pm) · 5 replies
Hey.
I've been mucking about with a little strategy game in my spare time these last few weeks, and I've been running into a nasty problem with lag.
I run my camera in orbit mode, and have it focused on the "current avatar" in the game. So if you're controlling Orc A, it is focused on that; Orc B, it is on that. Now the problem is, to update the orbit target, I have to send an event to the server and get one back, then interpolate the cam to be on the new object.
So even on a local system, it feels laggy to switch between objects. And lag isn't fun.
I've been thinking about ways to fix this problem. I think that what I need to do give the client side scripts a reference to the client side cam, then make a script method that a) sends a NetEvent to the server to update the camera, and b) starts moving to the new orbit object immediately.
But I'm not sure how to get that to play nice with the network updates the server is sending while still letting the server have some say in what's going on. (ie, don't want the players to trivially iterate through all the other team's guys.)
Help! I seem to be running into a mental wall here. I think I see what I need to do, but I feel like I'm missing something important. Maybe this is just a brain fart? Am I approaching this problem from the wrong angle? Something just doesn't seem right here. :(
I've been mucking about with a little strategy game in my spare time these last few weeks, and I've been running into a nasty problem with lag.
I run my camera in orbit mode, and have it focused on the "current avatar" in the game. So if you're controlling Orc A, it is focused on that; Orc B, it is on that. Now the problem is, to update the orbit target, I have to send an event to the server and get one back, then interpolate the cam to be on the new object.
So even on a local system, it feels laggy to switch between objects. And lag isn't fun.
I've been thinking about ways to fix this problem. I think that what I need to do give the client side scripts a reference to the client side cam, then make a script method that a) sends a NetEvent to the server to update the camera, and b) starts moving to the new orbit object immediately.
But I'm not sure how to get that to play nice with the network updates the server is sending while still letting the server have some say in what's going on. (ie, don't want the players to trivially iterate through all the other team's guys.)
Help! I seem to be running into a mental wall here. I think I see what I need to do, but I feel like I'm missing something important. Maybe this is just a brain fart? Am I approaching this problem from the wrong angle? Something just doesn't seem right here. :(
Associate Ben Garney