How do I performance optimisation !!!

  • [quote:nsvayk0p]yes

    and if thats like you said better add condition to collisions script

    for example like i said

    if object A (player) is on collisions with object B (ennemy)

    and if object B is on screen

    this will tel to construct engine to calculate colissions only if object B is on screen

    ??? am i logic ?

    I would still say no, I don't see any evidence that it should matter in regards to collision checks. As you can test it pretty easy. Make 2 sprites and put them on the layout.

    In the code you write "On collision object 1 with object 2" that would give you 60 collisions checks, if you move one of the objects out of the layout you get 0 collision checks. So to check if its on layout doesn't matter.

    yes you get reason

    is on layout or on screen it will still calculate same collisions BUT if we destroy the object it will reduce ...

  • [quote:3fbcni14]yes you get reason

    is on layout or on screen it will still calculate same collisions BUT if we destroy the object it will reduce ...

    No, even if you destroy the object it wont have any effect on the collisions. You will save some memory etc as someone else mentioned.

    You can do the is on screen that would help, sorry missed that part. But then you might as well use a distance check as you can then make it smaller than the screen size.

  • i just try it now ...

    when i use on screnn condition with collisions

    it still calculate collisions even when object is outside screen

    and if destroy the object it will calculate 0 collisions

    try an example ...

  • [quote:3dkoh9xw]i just try it now ...

    when i use on screnn condition with collisions

    it still calculate collisions even when object is outside screen

    and if destroy the object it will calculate 0 collisions

    try an example ...

    What I wrote above doesn't really make sense, so let me try again, using on screen doesn't make much sense. Because if you want to be able to scroll it wont work, and if it aint possible then you don't need a big layout either, so distance check make sense to use and not really "On screen" unless its not a normal layout for some reason.

    The reason yours doesn't work is probably because you use "On collision"?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yes i use on collisions

  • >

    >

    > thanks aphrodite ... you are really like aphrodite in mythology (saverrrr)

    > yes this why i was thinking to destroy object when its outside layout maybe will reduce the collisions calculations ... so as i understand i will help (just little but better than nothing ...)

    > and for reduce polygons collisions on object (as you sad i have object with some parts that not need to be checked for example only their X and not ther Y so ... that will help ??? yes ?

    >

    > finally i just not understand something ...

    > when you say "Some collisions maybe could be check only each other ticks."

    > that mean that i have to add another condition to "when object 1 is on collisions with another object B" for example every tick or every seconde ?

    >

    > thanks a lot for all

    >

    > i just finish my game and publish it on appstore ... but i see that its slower on iphone 4

    > so i would like to improve performance at maximum for iphone 4

    >

    For the collisions, C2 already checks only the bounding box first, then if the bounding box are indeed colliding(very fast to calculate), it checks the true collisions, this can be slower depending on the complexity of the collision polygon, also C2 arranges everything in different cells (areas) if it is possible to reduce the collision checks, but other than that, I do not know much about how it is done.

    As for not checking every tick, I would say for exemple a large (relatively speaking, testing will tell if it works or not) projectile can checks if it is colliding with the player only one tick out of two for exemple, to achieve that, you can add the system condition "Compare two values: tickcount%2 equal to 0", that may help (it could also cause problems in some cases, but I consider that this kind of projectile will be destroyed right after colliding)

    I do not know much about your game so I cannot help a lot, the debugger feature of C2 may help you see what parts are cpu consumming.

    Also, it may be possible that graphics are what kneel you game down, but not sure about that

    you are master aphrodite ...

    but what you mean exactly by the collisions polygons ? the number of polygone or surface of collisions ?

    and maybe if you have time , i can send you my full game to take look on it

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