Strangely specifc questions about optimization? techniques

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • First of all hello! Hope you're havin' a fine day.

    So I have a game with a large first level, but it isn't just the first level that sometimes stutters, I think it's the whole game. Or at least, some frames.

    I know what you are thinking and I've already gone and read a bunch of optimization techniques. Don't worry I'm doing those, but I've also come up with a few questions of my own so I just wanted to throw these out there to see if some knowledgeable people could fill me in.

    I was wondering if making every enemy invisible when they are off screen would help.

    I have two lines that look like this:

    Enemy is getting -16px from window's edge -> make invisible
    Enemy is getting -0px from window's edge -> reappear

    So my question is, is it worth it to have these two lines being checked every loop in order to make stuff invisible? I'll put these in a group that is only active when there is more than 0 enemies, as well.

    Which leads me to my next question. I have an event that says:

    Enemy = 0 -> Deactivate group "Enemy"

    Would it be more efficient like this?

    Enemy = 0
    +Only one action when event loops -> Deactivate group "Enemy"

    Is checking one condition and always doing one action more efficient than checking two conditions and not carrying out the action? (Other than the first time)

  • I'm pretty certain that making objects that are off screen invisible, is not going to improve performance - the display engine itself is going to ignore those objects anyway. All it would do is add the extra (very small) overhead of checking the position of each object.
    With the second question it's really not going to make any difference . In general, it depends on the specific action and condition in question, as some take longer than others (for example, collision detection is slow; performing a complicated calculation is fairly fast; reading the value of a flag is super fast) - but in this case neither is using any measurable amount of processing power.

    You're really worrying about the wrong things here. There are basically two things that restrict performance - fastloops, and displaying large amounts of objects. Do what you can to limit those, and then with everything else, you should just be focused on writing clear, easily readable code, which will help you avoid bugs etc.

  • Hey thanks for the response MuddyMole!

    Oh I know about how important limiting fastloops and image size/quantity is, I was just wondering if there was any other weird not often talked about techniques (\ ' -')/

  • I also have some advice. The debugger causes your game to lag while testing too. If you have objects in the debugger it will lag even more. If you want to realistically test your game's efficiency, close the debugger.

    Everytime I ask for help in the forums, I must help another member in the forums.<3

  • Thanks lootercuster!

    Ok here's one about negations. I heard they were more intense than other stuff so you should put them at the bottom of the list of conditions. I'm assuming object overlapping object is more intense than any negated event and should still go below a list of negated conditions, no?


    Ah one more thing! I made the mistake of using the TimeX object early on to say things like 'every 10 loops'. Should I just replace this with an active object that has countdown variables? I kind of want to rely on as few extensions as possible..

    Edited 2 times, last by FlipSwitchX (July 15, 2016 at 10:42 AM).

  • As far as I know negated conditions aren't any more taxing than standard conditions. Putting conditions higher or lower based solely on how expensive they are isn't exactly what you want to do, though. I address this below.

    Now, as for advice... nothing that hasn't already been posted in other optimization threads, really:

    -Use as few extensions as possible because most aren't compatible with all runtimes and some can be slow (but not all). I'm definitely not the one to ask about extension efficiency, outside of the Array object which is possibly the best extension there is (#fanboyism XD) and anything made by Nifflas since his extensions tend to be both multi-platform compatible and fast in my experience.

    -When making conditions with multiple inserts, make sure you keep in mind Fusion reads these from top to bottom, and operates using 'short circuit' logic (the first false condition breaks fusion out of reading the conditions). Generally you want to put conditions most likely to be false higher up in the chain. If you have an expensive condition (any type of collision/compare two general values/etc) that is also likely to be false, then you want to move it up in the chain, but not necessarily to the top (since less expensive conditions that are more likely to be false should be highest). Keep in mind that condition order can also affect object scope if you're using overlap conditions as well as value conditions (check for overlap of an object before comparing to its value so that the correct object is scoped, for example). IMO, the best order for conditions is: least likely to be true, not very expensive > least likely to be true, expensive > most likely to be true, not very expensive > most likely to be true, expensive

    -Uncheck 'use Fine Detection' on actives if you don't need it. This is especially crucial for large actives and anything that you will be scaling with events.

    -Always use arrays over ini and list objects unless you absolutely need them, as arrays are much, much faster

    Best person at writing incomprehensible posts. Edits are a regularity.

    Edited 11 times, last by casleziro (July 16, 2016 at 7:39 AM).

  • I was told by Anders a while back that, when possible, order flag conditions first because it is the first condition checked. And that aligns with the logic casleziro mentioned. He is pretty much spot on in his approach.

    Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!