Advertisement

How do you handle game performance issues?

Started by
7 comments, last by veronicawinston 1 month, 2 weeks ago

I’ve been running into some game performance issues lately and could really use some advice. How do you handle game performance issues? I’m talking about things like lag, slow loading times, and frame rate drops. Do you have any tips or strategies that have worked for you? I’d love to hear your experiences and suggestions! Thanks in advance.

Developing My Own World

Use a good profiler, measure what is slow, fix it, measure again.

Repeat until it is fast enough.

Advertisement

Its a difficult thing 🙂 It usually helps to be educated when it comes to this sort of thing, but two major suggestions I can make are:

  1. Don't repeat memory usage

ie meaning this, when you instantiate a gameobject that has a shared item (ie like a Sprite or Texture, or perhaps something else that takes up a lot of memory), make sure that if you create this object many many times (say 100 times), the sprite/texture is only loaded once (instead of 100 times). You may want to google how you are creating your objects to see if they are by reference and are not consuming memory per every object.

2. Be careful you are not doing really serious computation in your update/loop methods

Usually in video games, there happens to be an update method/game loop that is called every frame (or every couple of frames etc). If you are doing a heavy calculation in this loop, and every time the loop occurs, it will slow down your game. If you have a heavy calculation, try to somehow remove it from your loop, or have the loop continue on while this calculation is being made.

Hope this helps 🙂 If you want to ask me anything about this, you can simply message me or comment again on this post 🙂

jeffmoretti86 said:

If you want to ask me anything about this, you can simply message me or comment again on this post 🙂

Going to private messages is generally discouraged. We have quite a few forum members with decades of experience, a 20 years, 30 years, a few building games in the early 1980s. Keeping discussion in the public forums allows experts and veterans to chime in about all kinds of potential ideas.

Don't repeat memory usage

There are times when repeating in memory makes sense, but yes, managing instancing of objects is generally something to consider. Instances in different domains can be a good idea, like one in main memory for physics and another in video memory for rendering. Cache effects of duplicates in a different place can sometimes come into play depending on details. Always measure with a good profiler.

veronicawinston said:
Do you have any tips or strategies that have worked for you?

I think the question is too broad. You'd need to follow frobs advice and come back if you encounter some specific problem.

But some general practices that work for me:
Preprocess your assets so you do not need to do a lot of data transformation after loading from disk.
Use the algorithm with the best time complexity, but also pay attention to memory access patterns / core saturation, which might might require a preference of brute force.
Use multi threading, but as lock-free as possible.
Use memory management to minimize allocations, reserve before you push to vectors.

@frob Ok thanks for the advice

Developing My Own World

Advertisement

@jeffmoretti86 Thank you so much for this information

Developing My Own World

@frob No thanks buddy thank you for your information

Developing My Own World

This topic is closed to new replies.

Advertisement