Jump to content
  • Advertisement
Sign in to follow this  
caymanbruce

Optimization Optimizing interpolation codes

This topic is 443 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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? 

Share this post


Link to post
Share on other sites
Advertisement

Do you actually have a performance problem in that code? Have you measured exactly how much time is "wasted"?

 

If you have not used a profiler, you want refactoring, not optimization.

Share this post


Link to post
Share on other sites
23 minutes ago, ApochPiQ said:

Do you actually have a performance problem in that code? Have you measured exactly how much time is "wasted"?

 

If you have not used a profiler, you want refactoring, not optimization.

Maybe it is refactoring. I have profiled my code and most time (85%) is spent on rendering stuff. I am just reading all kind of optimization techniques and some posts mentioned this might be an issue so I am looking for a nicer way to do the interpolation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!