tarek2's Recent Forum Activity

  • Problem Description

    it seems there is a memory leak or something like that I have no idea how you will call it.

    The first time the App starts and Runs is all good and smooth Runs between 7 to 10% Cpu and as long as you keep Playing without closing the App or change the Layout the Cpu stays stable on those values.

    Now the problem starts when the App closes for the first Time or at the change of the Layout the CPU jumps straight to 100 and stays there permanent the phone gets hot really hot, in one of the occasions it froze the IphoneX.

    Here is the weird thing even when I change to (Layout 2) which has nothing just a Txt box and a Button the Cpu is still at 100 permanent I thought between layouts it shouldn't get affected by other Layouts

    Closing the App and opening it again the same puts the Cpu to 100%

    doesn't matter how many times you close it and open it the 100% Cpu doesn't calm down.

    The only way to stop that and normalize the Cpu back to normal is by turning off completely the iPhone and restart again, but after restart the first time you open the App it will play normally at 7 to 10% Cpu and the sooner you close the App or change the Layout Cpu will be back to 100% permanent.

    is quite serious as it nearly kills the phones

    I tried to reproduce a Capx with the first thing that came to my mind so I didn't optimize anything and is nothing to do with my game I just put something quick roughly putting the number of objects

    that I have on my real project and a loop to give c2 some work and it did the same so I manage to reproduce it Again

    Attach a Capx

    https://www.dropbox.com/s/c46xh0u38j8a8ep/3-Bug%20%28Cpu%20High%29%20When%20Reopen%20App.capx?dl=0

    Description of Capx

    The capx has just a basic controller so you can move around 300 Tiles and some enemies moving around,

    and has some loop to change tiles frames just to keep C2 busy

    Steps to Reproduce Bug

    • Step 1 >> Export and Install the App on iPhone, I used Cocoon and Canvas+
    • Step 2 >> The first Time you play as long you don't close the App or change the Layout keep watching the Cpu to have an Idea how the App it should run normally I got around Cpu = 7 to 10 on Iphone 8 and X Cpu = 40 % on Iphone 7
    • Step 3 >> once you have an idea about how the App it should perform close the App and reopen it again you should see that the App jumps to CPU:100% and stays there permanent you can change to (Layout 2) swell and the 100 Cpu will not calm down
    • Step 4 >> After you opened and closed many times and changed layouts and you are sure that is something wrong going on then you can turn off the iPhone and back on again and try the App again you will notice that the Cpu is back to normal, it will stay normal as longs as you don't close or change the layout if you do then the 100cpu will be back again
    • Step 5 >>I recorded some videos to help reproduce the Problem I didnt want to make the videos long so this is what I did 1-I open the App for the first time and I move around for a few secs/min enough to show the real Cpu usage wich the App it should run normaly 2-I close the App and open it again to show how the cpu Jumps to 100% and there is no way to drop it down even I changed layout to layout 2 many times and is still showin 100%Cpu on a layout that has nothing just a few objects with no events at all Iphone 8:https://www.dropbox.com/s/4h0am6u4pvvjlxo/Iphone%208%20Plus.mp4?dl=0 Iphone X:https://www.dropbox.com/s/bn98tl1xelm2ife/Iphone%20X.mp4?dl=0

    Observed Result

    while you play if you close the App or change the Layout the Cpu jumps to 100% and stays there permanent,

    even when you go to (layout 2) wich has 2 objects only no events the cpu is still 100%

    Expected Result

    I expect that the Cpu stays normal the same as the first time you play wich is when is totally normal doesn't matter how long you play the CPU stays cool, example on Iphone (8 and X ) Cpu is (7 to 10) %

    I expect when I close the App and open it again if the App normally runs at Cpu: 7 to 10 % then it should be back to the same values not jump to 100%Cpu for no reason Trying to kill the Phones

    I expect when I change Layout to (layout 2) which is empty and has no events to run I would expect if (Layout 1) Runs at Max Cpu: 10% with all those events and enemies and loops, then I would expect as an empty Layout Cpu should Run = 1% Maybe? 3%? Not Cpu:100%

    Affected Browsers

    • Chrome: (YES/NO) I don't know is an Exported App
    • FireFox: (YES/NO) I don't know is an Exported App
    • Internet Explorer: (YES/NO) I don't know is an Exported App

    Affected Iphones

    Iphone X

    Iphone 8 Plus

    Iphone 7 Plus

    Operating System and Service Pack

    Windows 10 version 1709

    Construct 2 Version ID

    Yesterday I installed the latest version R254

    but previously I had R252 which is still affected

  • Hello guys,

    A simple thing that I can not do, can you help me? He wanted that when a VARIABLE had the value X, the FOR loop was interrupted.

    I did it, but it did not work:

    global VAR = 3

    System: For "" from 1 to 10

                   system: VAR > LoopIndex

                                  system: Create object Sprite on layer at 360, 450 - 40 * LoopIndex

                   system: Else

                                  system: Stop Loop

    But it does not work. Can anyone help?

    Thank you.

    It works but you need to make sure you put the Loop under any "Trigger" a Function can be good swell or A variable where you can turn it (on or off ) other ways the Loop will keep running none stop because you comparing against the (LoopIndex) the loop stops when is > 3 but starts again from 0 because the Top Event Condition is always true after you stop the Loop >>> For "" from 1 to 10 will be like Every thick if is true do this

    Or another way to stop it the way you do it is on

    The Else>> StopLoop & one more Action set global VAR = -1

    but the proper way will be to put it under a trigger or Function or etc....

    https://www.dropbox.com/s/7j8had08tlgh3sg/Stoop%20The%20Loop.capx?dl=0

  • Hi tarek2, Thanks for looking into this. I tried with your bug capx too and got the same result. Interestingly, if you check the timer tags in debug you can see that each sprite has a different tag ("change0","change1","change2") so it seems that the UID is being applied to the tag correctly.

    So the problem is that even if they have different tags if they finish on the same tick then "change"&self.UID still picks them all together, so the function Call "ChangeAnimation"(sprite.UID) will only fire for the first sprite in that group. Adding the "for each" to the function call (as suggested) fixes it, which renders the UID unnecessary.

    OK, I'm pretty sure that explains the issue I've been having - time to rewrite some code! Cheers again

    You Welcome mekonbekon

    Yeah the best thing is For each forever jaja

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • AnD4D

    Here is another Capx, I removed some Global Variables and changed the way the Loop stops at the End of the Game, I didn't check everything 100% so you may find something that I missed

    https://www.dropbox.com/s/4epggm9jh4ojswy/LimitedFlood_4.capx?dl=0

  • >

    > > tarek2 Took me a while to understand the code. I couldn't see where you were inputting the range, but now see that you are doing it using the line of sight behaviour, which is very clever indeed. I didn't even consider doing that. Great stuff!

    > >

    >

    > Hahha I can imagine hunting for that hiding part lol

    >

    > Thank you, That's a little trick I use when I don't want to use the Overlap is very helpful and limits the Los Range for performance, what I notice in all my experiments with Line of Sight is the more you turn up the Range the more expensive it becomes even if is not in use by the events

    >

    > I'm Glad, you like it, was really fun Puzzle to solve, if you have any questions that you don't understand in my Capx you can always ask me

    >

    I do have one question, actually.

    If I look at the tile in debug during a test; if the selection number = 1, and I click on it, it doesn't change the instance boolean "Checked" to true (1). However, if I pick a higher selection number, such as 5, and then click the exact same tile, it will change the check boolean to true.

    Do you know why that is? Is that important? When I try to change the code so that it will allow such a thing to happen, things start breaking.

    AnD4D you right I didn't count on that Possibility of one single Tile selected at the start of the Game I always counted with one Tile+

    This problem would only happen if the first Tile selected at the start of the Game is only one anything more than one it wouldn't have that problem only happens if is the first tile of the Game selected, if the game was already started and you change to select 1 tile only it wouldn't have that problem as the tiles already active will take care of that

    You can Easly fix this problem by adding one more action on Event 5

    Sprite >>set Checked To True

    That will fix it, I can comment the capx if you like if you have any trouble understanding how it works just let me know

  • tarek2 Took me a while to understand the code. I couldn't see where you were inputting the range, but now see that you are doing it using the line of sight behaviour, which is very clever indeed. I didn't even consider doing that. Great stuff!

    Hahha I can imagine hunting for that hiding part lol

    Thank you, That's a little trick I use when I don't want to use the Overlap is very helpful and limits the Los Range for performance, what I notice in all my experiments with Line of Sight is the more you turn up the Range the more expensive it becomes even if is not in use by the events

    I'm Glad, you like it, was really fun Puzzle to solve, if you have any questions that you don't understand in my Capx you can always ask me

  • AnD4D

    Haa I new Something will be no right, I thought you wanna follow the source where the Flood bigging, I miss understood this statement

    [quote:1eznd0l3]

    having the flooded parts remain in a second click, but spreading. By that, I mean, say you're using a flood of 5. When you click on a tile, 5 other tiles are highlighted.

    I fixed for you

    https://www.dropbox.com/s/x97zzeeoyt8dxtp/LimitedFlood_2.capx?dl=0

  • Yes, you are right, is better like that . I've changed the event to "on pressed".

    I remember that a long time ago I used "On Pressed" for several times and it didn't worked right for me in that situation and after I changed to "On released", than it had. So I guess that's why I avoided using it since then .

    lol I understand now

    Important Note: I forgot to Remove the Boolean "PlugTheBox" from the object (EnergyBoxPickable) as a result you have one more action on Event 90 referencing to that Boolean that is not needed, you can delete the Boolean and automatically the Action from event 90 it will be deleted swell

    Good luck with the Game

  • Ok, got it. So basically add "for each" everywhere.

    Jejeje lol, kind of but the way you say it it sounds really really scary jaja

  • I have a bug in one of my projects; multiple instances are running simultaneous timers and I've been using a tag containing the instance UID to differentiate between them. Sometimes an instance hangs when the timer expires.

    If making the tags unique by including the UID isn't enough to distinguish between timers for instances of the same object finishing on the same tick then that might explain the issue I'm experiencing, hence my interest.

    mekonbekon

    I test it with your idea by using ("fire"&self.UID as a tag) with the example that I posted on the bug report but it didn't work, nice idea by the way and this leads to the next question is the ("fire"&self.UID as a tag) working as it looks? shouldn't give for each Object different tags because the UIDs are all different yet on my test didn't work, so my guess is

    "fire"&self.UID as a tag = exactly the same name no UID numbers added

    or

    "fire"&self.UID as a tag = or something weird because doesn't work jeje as in theory if it added each UIDs of the objects it should work because they have a different unique UIDs and on the manual part it stated if the "Tag" is the exactly the same

    [quote:ih3sh0zv]Manual

    started with the same tag has reached its duration. NOTE: this trigger can fire with multiple instances picked, if their timers all reach their time in the same tick

    Notice the part where it says "Same Tag"

    I think the question now is what is the real "Tag" it gives when you add "fire"&self.UID as a tag, that could tell you if the problem is with the Timers, example the exception is for both (Same Tag or Different Tags)

    or the problem is in something else on the events

  • blackhornet tarek2

    Re. the timer multiple fire issue, is it possible to circumvent this by using "fire"&self.UID as a tag?

    Hi mekonbekon

    As blackhornet said, I don't think it will make any difference if I understood right, the problem is if many Timers trigger at the same Time you can expect sometimes that they will not work as is intended if they have the same "Tag" names, at list this is what I understood I may be wrong though

  • AnD4D

    I Love challenges so I give it a try

    Capx:

    https://www.dropbox.com/s/vu4b0v2dmgbkfoe/LimitedFlood_1.capx?dl=0

    This is based on what I understood but maybe I understood it wrong though

tarek2's avatar

tarek2

Early Adopter

Member since 26 Jan, 2016

Twitter
tarek2 has 12 followers

Trophy Case

  • 8-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x5
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

15/44
How to earn trophies