Performance question

I know performance depends on one’s computer, but in general, how would this affect a game.

  1. Does having objects in level 1 affect the performance of level 2 in any way?

  2. How much would several small ray casts affect the performance of the game? (for example, 6 different ray casts with a length of 90 pixels each)?

  3. If I had 10 objects with those 6 ray casts would it affect the performance in any noticeable way? What if I had 100 of those objects?

  4. The longer the game run, does the performance get lower?

  5. Does a sprite with a checker pattern for example affect the game more than a plain sprite (Sounds weird, but sometimes weird visual things happen so I want to know if this affects the game at all)

  6. Does using a frame rate higher than 30 lower overall performance if you have 100 moving objects? If so, does using a frame rate that is lower than 30 increase performance even though it has lower fps?

What other ways are there to increase performance? I don’t have a game where the things I mentioned applies, but I’ve been thinking of something and I also just want to know more about performance anyways. Sorry to contact you @grazer, but I figured who better to ask than the creator of flowlab?

  1. Another question, would an object that is 64x64 pixels have better, worse, or equal performance compared to 4 objects that are 32x32 pixels?

Ah, I’d be interested in seeing the answers to these too.


Does anyone else happen to know the answer to some of these? (If you edit a post and add a @ to it will the person get notified?)


Ok, so because this has not been answered I guess I’ll add 2 more questions.

  1. Does having a bigger game screen size lower performance?

  2. If it does because more objects are shown on screen, then what about objects off-screen? (So if I had 100 moving objects with logic off-screen would it have better performance than if they were on screen?)

1 Like

I sent the topic link to grazer on discord (he’s more active there).

1 Like

While the game is running, not really. It will affect download and loading time though, which is part of “performance”

When you cast a Ray, the physics engine has to check all the objects in the game that could possibly intersect it. There are many optimizations to make this faster, but it will never be “free” from a performance perspective. If you have two rays, then all the objects have to checked twice, and 6 rays means 6 checks of all the objects. This means that adding more rays, or adding more physics objects to your level will both influence how fast the logic runs.

See above. 10 objects means the rays can all be in different places in the level, which means they will each need their own checks. Here’s an example:

  1. Your object has 6 raycast triggers
  2. You have 10 copies of this object in your level
  3. You have 90 other random copies of objects in the same level

This will require 6 * 10 * 100 = 6,000 checks per frame. Now, keep in mind that these checks on their own are very fast, so you can perform a lot of them quickly, but they will eventually add up.

In theory: no. In practice: There have been cases in the past where bugs have caused slow downs over time, but I fix them when they have been found. If you discover that your game seems to be slowing down over time please let me know.

No, but sprite sizes can matter though, a lot. Sprites use up lots of texture memory, and the larger they are, the more memory they use. This is important:

Sprite Memory

It’s not obvious, but larger sprites grow memory use very quickly. In fact, doubling the size of a sprite uses 4 times as memory, since pixels go in both the x and y dimensions.

A 1x1 block sprite (32x32 pixels) has 1 byte each for Alpha, Red, Blue, and Green “channels” in the image. So this means 4 bytes per pixel, so:

  • A 1x1 block sprite uses 32x32x4 = 4096 bytes, or 4K of memory.
  • A 2x2 block sprite uses 64x64x4 = 16384 bytes, or 16K of memory
  • A 10x10 block sprite uses 320x320x4 = 462K of memory

You can see that the memory use grows very quickly as sprites get larger. This is a problem because it takes longer to move the pixels around and render them, which can make the game render more slowly.


That depends. When it comes to physics, one larger object will process faster than 4. When it comes to rendering, One large object will (generally) render faster than 4 diferent smaller sprites. It all comes down to where the bottlenecks in your game are. If it is spending more time on the physics (and physics behaviors like raycast, proximity, etc), then fewer objects will improve things.

Also keep in mind that static, rectangle objects with no behaviors will be combined together when the game is running.


Offscreen objects still effect the physics, so lots of offscreen moving objects can lower performance, even if they are not being rendered

When it comes to performance, your best bet is typically to measure using the built-in metrics rather than try to guess where the time is being spent.