Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Optimizing interpolation codes

$
0
0
Hi I have finished my multiplayer game interpolation code. It works fine. But I am looking for ways to optimize it and what could be done to improve performance. As for now I have too many temporary variables and objects inside the interpolation function which is running at 60 times per second on client side. I've read some articles that creating those temp variables and objects too many times may slow my game. To make things simple, I create a object literal like this in the class that defines the interpolation function { timestamp:0, allStates: {}, allOtherStuff: {} } In each interpolation I will clear the object, which means I am just creating a new empty object. Then in the interpolation function I use a for loop to push the interpolated value and other unchanged properties from previous state into object.allStates and object.allOtherStuff. Although this works perfectly but the interpolation function looks bloated. Is there anything I can do to improve this?

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>