• Laggy moving platforms
    4 replies, posted
I'm trying to make a gamemode where players are on a sinking ship, for which i'm using a func_rotating to make it move while rotating into the water (at 0.3 degrees per second). It works perfectly in singleplayer, but in multiplayer the ship moves extremely laggy, "jumping" about 3 times a second with no interpolation. The player's camera for people standing on the ship is also very jumpy. I've tried different tickrates, cl_updaterates, etc and haven't gotten it to be smooth. I also tried a func_door_rotating - same issue. There is also a func_movelinear in the level which is a bit laggy while standing on it, but not as bad. Any ideas? edit: hook.Add("Think", "testasd", function() for k,v in pairs(ents.FindByClass("func_rotating")) do print(v:GetAngles()) end end) Output on client: 11.602 0.000 0.000 11.602 0.000 0.000 11.602 0.000 0.000 11.602 0.000 0.000 11.602 0.000 0.000 11.602 0.000 0.000 11.602 0.000 0.000 11.605 0.000 0.000 11.615 0.000 0.000 11.623 0.000 0.000 11.632 0.000 0.000 11.645 0.000 0.000 11.646 0.000 0.000 11.689 0.000 0.000 11.689 0.000 0.000 11.689 0.000 0.000 11.689 0.000 0.000 11.689 0.000 0.000 11.689 0.000 0.000 11.689 0.000 0.000 11.733 0.000 0.000 11.733 0.000 0.000 11.777 0.000 0.000 11.777 0.000 0.000 11.790 0.000 0.000 11.821 0.000 0.000 11.829 0.000 0.000 11.865 0.000 0.000 11.865 0.000 0.000 11.909 0.000 0.000 11.909 0.000 0.000 11.953 0.000 0.000 11.953 0.000 0.000 11.976 0.000 0.000 11.997 0.000 0.000 12.013 0.000 0.000 12.041 0.000 0.000 12.041 0.000 0.000 12.085 0.000 0.000 12.102 0.000 0.000 12.129 0.000 0.000 12.129 0.000 0.000 12.142 0.000 0.000 It appears that the angles are being synced just fine
Large moving entities that have lots of other entities depending on it to calculate positional data requires a huge amount of network data being sent to each client, in addition to a large amount of CPU time to do said calculations. We had this issue in Pirate Ship Wars 9-10 years ago and we couldn't figure a way around it in our case because the ships were steerable. The only thing we could really do is brute force it and use more powerful server hardware. In your case, it seems you just want the ship to sink in a linear fashion. Instead of moving the ship, you can make the ship static and use a func_water_analog to rise upwards instead. If you want it to appear at an angle, you can slope the surface of the water. The downside to doing this is you'll have to basically have the ship out in the middle of an ocean and not have any land around it or the effect won't work. You may be able to have some very basic land and have it non-solid and be parented to the moving water, or use modeled terrain and do the same thing.
It wasn't a server performance issue, as it was getting 66 tick solid. My theory is that the angles are "snapped" somehow at some point in the process (even though they were synced from the network fine), and this was causing the jumpy effect. I had the origin of my rotation way far away from the actual ship, so that it would move down while rotating, and I think this rotation was being snapped. I now switched it to a func_tracktrain with the angles linearly interpolating at each point. The interesting result is that the positional motion is relatively smooth, but the angle change still seems to "jump" from value to value. I think I will change the angles so that the ship only rotates more quickly around track points to reduce the visual effect of this. I did look into func_water_analog, but the problem is I still want the ship to rotate. I suppose I could build the ship at a static angle, but that would be a huge hassle. Also, the graphical quality of analog water is bad.
The issue is Source doesn't predict moving objects in multiplayer afaik.
From my experience func tracktrains are a lot more reliable and smooth in multiplayer [url]https://developer.valvesoftware.com/wiki/Func_tracktrain[/url] Not sure how much it can help you but maybe give it a crack?
Sorry, you need to Log In to post a reply to this thread.