Recommended Posts

MetalTug    2

I'm a college game design major, but I have also picked up on some basic programming.  I've done some stuff in Javascript, AS3, Visual Basic, Stencyl, and I'm now moving into using C# in Unity.  Just as a general programming question, what are some tricks/techniques that any programmer can do, regardless of coding language, to make sure that their game runs as smoothly as it possibly can, in terms of frame rate?

Share this post


Link to post
Share on other sites
Hodgman    51328

Profile your code regularly. Budget out your frametime -- e.g. if you want to run at 60Hz, that's 16.67ms per frame, so divide that up between different game systems and then make sure you stay within your budgets. Run / test / measure on your minimum spec hardware. Optimize for the worst case, don't worry about the average or best case. The average case behavior of an algorithm doesn't matter if the worst case will blow your performance budgets. In managed languages (e.g. C#), do not generate garbage for the GC to pick up. GC time is highly variable, so the only way to keep it in line is to not produce any garbage during gameplay - don't create/destroy temporary objects, cache them and reuse them again and again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now