Magistross's Forum Posts

    As a rule of thumb, I steer clear of "Wait 0". Rarely do I really want to postpone actions back to the end of a tick.

  • It's something that could indeed be useful, you ought to suggest it on the C3 suggestions & ideas platform, if it's not already there.

    construct3.ideas.aha.io/ideas

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I expanded my example to switch over to the wallclock check explained by Ashley.

    github.com/Magistross/Magistross.github.io/raw/master/files/progressWallclock.c3p

    There's still plenty of room for improvement, but the basic idea is there.

    20 millions iterations, done while trying to keep FPS at 60.

  • Just a small bump for those following this topic, I uploaded a new version with a bunch of improvements and dedicated for the C3 runtime. Get it while it's hot !

  • Using "else" is the proper way to deal with this particular situation. All your triggers have complementary condition, so you should just completely replace every second condition with "else".

  • You need to use the "main" loop, to execute a set amount of "units of work" per tick. Otherwise, the whole thing is gonna hang while the logic is running.

    Check out this file : github.com/Magistross/Magistross.github.io/raw/master/files/progress.c3p

    10 millions of "units of work" (that does nothing) are ran per tick, after each time the progress is updated and the screen is refreshed. You can tweak the amount of "units of work" you want done in a tick, higher numbers will make your FPS drop to a crawl, but less time is loss updating the screen/progress.

    You will however need to change how you implemented things so you can exit the local loop mid-task without crashing everything :P.

  • It's getting quite irritating. That, and having to read "should not of" instead of "should not have" everytime! :P

  • Essentially, the console is accessible by pressing F12 to open DevTools, and clicking on the "Console" tab. You should see some initialization message, and most probably an error message.

  • Open the javascript console, there's probably a thrown exception which could give us a hint as to what is happening.

  • I want to add one small UI issue - when you have lots of functions in the project, "Set return value" action becomes buried in them:

    By giving your functions their own "Category" it won't clutter the "Functions" category. Not perfect, but it becomes easier to spot the lone "Set return value" that way.

  • I could not test the BinaryObject properly since it seems it can't load padded base64 (filed a bug report for that).

    However, 1 of your image in your example was not padded so I could test a bit. The JS Heap was still badly overused, although I did not test for any kind of difference in terms of lag.

  • It's not the execution time that is troublesome, it's all the memory allocation overhead of the whole process. Memory get allocated at a high pace and also quickly become flagged for collection, thus the regular garbage collection.

    First I thought using the BinaryData object would reduce the problem, but it seems to be plagued by the same excessive memory allocation...

  • Well, the bottleneck here is really the multiple calls to "Load image from URL", so as long as it stays the only way to edit a sprite's image data, achieving something truly dynamic AND performant seems out of the question.

  • I don't think it's a good idea as a whole to continually load image data. I don't know the inner workings of the engine, but I believe it's not optimized in any way to do something like that.

    What could work, however, is to create a lot of placeholder animations and animation frames. During your loading phase, preload all of the image data into said placeholder animations/frames. You'd be able to use C3 animation engine that way, although you could also set every animation speed to 0 and create your own.

  • I don't think there is an expression or condition to check whether an instance is global. So you'll have to create your own property. Maybe a family instance variable, that you set to true with various "on created" triggers of your global members of the family.

    If you only need to test one UID at a time, you could also create another family but only add your global "Cork" ("CorkGlobal"). You could then have a function that test if "pick by UID" returns 1 instance in both family, indicating that your "Cork" is also a "CorkGlobal".