How do i Optimize Game

0 favourites
  • 4 posts
From the Asset Store
five golem elements Sprites Sheet.Best for enemy or villain game characters.
  • Right now i am setting all collisions properties to False for every sprite that is used as a "detail" for the levels

    I also went and decided to make 1 big shared event sheet where all the player controls are, such as movement and pausing, so the code wouldn't have to be repeated in every level's sheet

    After doing some research about further possible optimizations here are my following "Unanswered" questions:

    = I read this

    "To ensure previews are fast, duplicate images are not removed when previewing. However when exporting, Construct 2 looks for and removes duplicate images. This helps reduce the download size and memory use, since there's no point having identical images downloaded twice or loaded in to memory twice." from another thread here.

    I often used the same image (resource) but opened with in different sprite(because i wanted one block to do nothing and another to do something while they were both identical on the outside)

    Can i be assured that all the repeating objects i have won't be included in the final file size? (as in, all those sprites on the right that i imported but deleted or that i imported more than once because "noob" mistakes)

    =i read this: (regarding minifing script)

    "This renames everything possible in the javascript code to use the shortest names possible, which makes the script smaller and quicker to download."

    But most importantly

    "It may also make the resulting Javascript slightly more efficient, since it employs some basic optimisations like inlining and removal of unused code."

    Does this mean that all those Copied variables i have

    (for example: at the start i copied all my movement code, including variables, and now i have (for example) variable: canyoudoublejump2 on level2 canyoudoublejump3 on level 3 and so on)

    and that are, most probably, not used will be removed from the code thus i can just ignore them in the project and not "hunt" the unused variables since, upon exporting, they won't be an issue?

    =i read this:

    "If you have many background and graphics sprites, you can add all the images in one sprite and make the animation speed to 0 , then change the frames as you like.

    This better than using 50 sprites as background and graphics."

    Does this have a big impact on the framerate/loading overall performance or is it something done because it is more "convenient" (and i could see why it would be!)

    And a side question:

    I have a text object on all of my levels that indicates the distance of the player from the end of the level, to do this im using the distance between 2 points code i found here, my question is: Since im using the "calculate distance and put in text" code "on player moving" , does this affect the performance since every time the player moves the CPU has to calculate X1-x1,y1-y2 or is it insignificant in terms of performance drop?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To find out what images are in the final build export it and look in the images folder.

    There are different levels of minifying, I can't say for sure which C2 uses but if a variable is never referenced it should be automatically removed. You could try find an example, open the js file for editing and search for it to see.

    [Note some minification will rename variables to shorter names too and not as you wrote them]

    Calculating the distance will be negligible, however displaying it every tick would have some impact, instead update it every second or so.

  • majesticAsFk Hey man thanks for the reply (and sorry for the late answer )

    First i'd like to say AMAZING name really, hahah

    And second: I did the following things to fix the overall performance:

    As you suggested i checked the resources in the final build export and there are only the used ones (construct 2 removes the unused ones apparently)

    As you suggested, again , i changed the text display to change every 0.3 seconds

    As for the minifying and variable issue i didn't know how to check the js file myself so i just went on an eight hour adventure of hunting down every unused variable!

    Also, for those interested, removing Collisions Enabled to every non player interactive sprite improves everything!

    aaaand not repeating code also helps, using a common event sheet helped me lower my lines of code from 1800 to 1055! (and i could have probably lowered it even more if i used functions and such similar magical inventions!)

    Overall achieved Fps increase and size drop, good!

  • Ah excellent, great tip with the collisions.

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