How do I make a better "dust" particles for the CPU?

0 favourites
  • 5 posts
From the Asset Store
Particles support animations, collisions, effects and etc.
  • Hello! So, this is a spiritual sequel to this topic. However, I want to focus on one particular part of the game I am working on, and I am all for ideas and suggestions to make it work well and possibly look good.

    The basics: It's a game featuring a vacuum cleaner that collects dust.

    The dust must be collected, so it's like dealing with multiple mini coins.

    Mini coins mean mini objects in a single room, meaning it takes up a bit of space.

    But that's fine: It's the core foundation of this game, after all.

    But, also, I want that it doesn't break the game for a low-end platform.

    In the beginning, the dust was exactly how you would think: small, and hideous, but unmistakable when put together with more pieces of dust, like the picture you can see here.

    The problem was the count number: In bigger rooms, the number could go up to 7000!

    That was a bit too much for the game. So I started making them bigger in a way to reduce the number of objects.

    Up until now, this is how dust looks. It's pink due to a game design decision that is unrelated. As you can see, they have a big black outline (in the sprite, so no effects or add-ons), so now they are even thicker.

    I can go down to 3000-1500, which is already a great improvement. But I have noticed that the CPU starts at 25%, and once collected all the dust it's at 12%!

    I believe it's too much for mini objects. So I am trying to figure out what causes it, and how I can fix it, maybe by even changing the whole concept of dust.

    For example, each piece of dust has Line of Sight and Move To behaviors.

    This allows making the "sucking" effect that vacuum cleaners usually have.

    I believe these can make a great impact, especially if they are overnumbered in just one room.

    Could it be? For the sake of less CPU usage, do you think there is another approach to make the "sucking" effect?

    I am afraid to continue changing how the dust works because I have noticed that they slowly turning more into coins and less into dust. I did try using canvases, like if the dust was "painted", but was, unfortunately, a bad experiment.

    How would you make the dust that looks like dust but doesn't dust out the CPU?

    Mini objects? Particles? Maybe a range where the dust you can't see is like "inactive"? Is it possible? I have heard it's a common technique in 3D worlds.

    That is all. Thank you for reading, and I wish you a good day.

  • There's nothing wrong with using the CPU. The CPU is there to be used. Are you running into slowdowns? 7000 objects still seems within the realm of reason, although the line of sight checks could be causing you issues, as those have collision checks. With so many objects moving, some fps fluctuations would probably be reasonable and hardly noticable.

    The first thing that comes to mind is to add a condition filter out only the objects in range first to check line of sight on, then you're only checking on a few hundred at a time. Actually I'm not sure if collision/los checks can be optimized this way, so it would be nice if someone else could confirm.

    Why are you trying to make this work on low end platforms? If you want to target low end platforms, you don't do something that would push any limits in the first place. If you want to make a game about being able to collect thousands of dust particles, your idea by nature is not targeting low end platforms. Also, how do you define low-end? The computer you're working on? The cheapest phone you can buy today? A tablet from 10 years ago?

    Here's a quick example that runs fine on my machine at 10000 objects. I'm sure you don't need to cover the entire screen so you should be able to do with significantly less. Another simple option is to lower your target resolution, so you just don't need as many objects to fill the screen in the first place.

    dropbox.com/s/4rrawizdr9404nb/vacuumexample.c3p

  • There's nothing wrong with using the CPU. The CPU is there to be used. Are you running into slowdowns? 7000 objects still seems within the realm of reason, although the line of sight checks could be causing you issues, as those have collision checks. With so many objects moving, some fps fluctuations would probably be reasonable and hardly noticable.

    The first thing that comes to mind is to add a condition filter out only the objects in range first to check line of sight on, then you're only checking on a few hundred at a time. Actually I'm not sure if collision/los checks can be optimized this way, so it would be nice if someone else could confirm.

    Why are you trying to make this work on low end platforms? If you want to target low end platforms, you don't do something that would push any limits in the first place. If you want to make a game about being able to collect thousands of dust particles, your idea by nature is not targeting low end platforms. Also, how do you define low-end? The computer you're working on? The cheapest phone you can buy today? A tablet from 10 years ago?

    Here's a quick example that runs fine on my machine at 10000 objects. I'm sure you don't need to cover the entire screen so you should be able to do with significantly less. Another simple option is to lower your target resolution, so you just don't need as many objects to fill the screen in the first place.

    https://www.dropbox.com/s/4rrawizdr9404nb/vacuumexample.c3p?dl=0

    Thank you for the kind suggestion. The idea is about using a vacuum cleaner that collects dust, so I am not sure I would change that concept. I am not focusing particularly on low-end platforms, but I want to use them to troubleshoot and see what can be improved for more platforms. For example, I have asked a friend of mine to lend me his low-end PC, and the room with the richest amount of objects can run at 60 fps with ~80% CPU, which is according to my previsions.

    Comments like yours help me remember to keep my resolution as low as possible, despite my ambitions in some matters. My idea was to make bigger rooms with details, but I think there are other ways to do it. Maybe small rooms are interconnected or rooms with fewer details, as you mentioned.

  • Make the sprite particles as an image with many image points. Whenever the vacuum close to the image, spawn "particles" with those image points and destroy proxy image.

    A proof: dropbox.com/s/aae40il0m4w6hsa/dust_proxy.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Make the sprite particles as an image with many image points. Whenever the vacuum close to the image, spawn "particles" with those image points and destroy proxy image.

    A proof: dropbox.com/s/aae40il0m4w6hsa/dust_proxy.capx

    Thank you so much for this solution alextro! I love the idea, and it's perfect for the game. I've partially implemented it with the rest of the game, and I could decrease the CPU usage from 26% to 17% without changing the design of the dust. Lovely!

    I'll keep you updated, but in the meanwhile, thank you for this game design help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)