Chadori's Forum Posts

  • - Without you knowing, you helped me solve my scml object problem in initializing .

  • - It is working now. I made a preloader layout to initialize the scml objects on start.

  • Sethmaster - Still the same result still showing the visibility delay, btw. I wrong the whole time that I was thinking that the cause of the short invisibility of the scml objects is the image not being preloaded inside the memory. I retested both versions of my game, w/ preloader and w/out preloader.

    With Preloader: Memory Usage: 28.18 mb

    Without Preloader (Images on the same layout used) : Memory Usage: 38.44

    It seems that the spriter objects were already inside the memory the whole time and the preloader only worsen it since every layout change the memory is flushed out.

    My point is that maybe the memory management is not the issue but the initialization of the spriter objects causes a delay.

    I hope you can still be patient with me. Do you have any more suggestion?

    Edit: I will try it again using preloader for spriter objects for the sake of initializing the scml objects.

    Edit: Great it is working properly now without visibility delay, made a preloader again and separately initialized the scml objects without the destroyoutside behavior.

  • I noticed that many still suggests layout to layout preloader. They use it to preload images of the objects that they are going to create/spawn during gameplay but not initially present on layout startup.

    For example; I were to make an rpg game. All RPG games have so many maps so I need to make a lot of layouts for maps but the player objects are used in each layout but it will be very unorganized if I put the players and bullets on each layout (map). So I will make a preloader layout to store all the players, clothes, enemies, bullets that are going to be spawned during gameplay on the maps (game layouts).

    If you think about this, it will be a very good time saver until you read this on the manual, saying that this is useless:

    Construct 2 only loads the images for the current layout. This avoids loading the entire project in memory which would be slow and consume a great deal of memory. When starting a layout, all images for the objects placed in the Layout View are pre-loaded. This includes all frames in all animations of any Sprite objects. (In other words, Sprites are either fully loaded in to memory, or not at all - they are never part-loaded.) When the layout ends, all images that are loaded but not used on the next layout are released from memory.

    If an object is not placed in the layout view, but events create it at runtime, its images are not pre-loaded. The Construct 2 engine is forced to load the object images at the moment of creation, which can cause a momentary pause in the gameplay, or in extreme cases a constant stuttering (also known as "jank"). In order to avoid this, simply place any objects that will be used by the layout in the layout view. If they are not immediately needed then they can be destroyed in a Start of layout event. They will then not exist when the layout starts, but Construct 2 will still have pre-loaded their images, ensuring that they can later be created at runtime without any jank.

    Emphasis:

    When the layout ends, all images that are loaded but not used on the next layout are released from memory.

    If an object is not placed in the layout view, but events create it at runtime, its images are not pre-loaded

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    In a different angle of view:

    If people suggest adding both images on the game layout & preloader layout so that there will be respect to what the manual said :

    all images that are loaded but not used on the next layout are released from memory .

    So there will be no images that will be flushed from the memory since the images are present on the "previous" & "next" layout.

    The purpose of this is to preload the images of the objects that are going to be used on the next layout. So it will be preloaded without getting flushed from the memory.

    Well I believed this until I tested it. It seems that a huge FPS spike will happen on start of layout that can cause glitches to anything that is created on start of layout. This happened to a test platformer I made with solid ground using a preloader if layout image memory is above (30+).

    *BTW. Correct me if I made a mistake*

    So experts please explain, are we doing it wrong. Did I miss anything? Should we leave this idea or should we continue to use this?

    Thanks .

  • Sethmaster - No I don't get the lag problem. That only happens when I have both objects in the preloader and the main layout. Besides, I don't use events to destroy preloader objects, I use DestroyOutsideLayout Behavior which is fast enough to destroy objects than events. Also, what I am experiencing is a short amount of invisibility of spriter objects when they are spawned on gameplay and not initially present in the main layout on startup (but they are present in the preloader). The reason here as I said above must be because of mobile limitations + javascript garbage collection that objects not present in the next layout will be flushed (so the preloader losses it's purpose). So the result is that there is a short moment of invisibility of the spriter objects. In my case, these are the bullets spriter objects. And Bullets that are invisible on first launch is kind of weird. So I am open for suggestions, thanks in advance.

  • Josek5494 - Correct me if I am wrong. If we use Admob-free 100% of the ad profit are received by us but if we choose Admob-Pro we only receive 98% and 2% to the developer or is it the other way around?

  • Sethmaster - Btw. I further tested it, the result of my test is that it really does preload spriter objects more efficiently but it only is efficient with Desktops, Laptops but not in mobile phones. Even when I use the preloader and tested in mobile, there is still a short moment of invisibility when spawning/creating spriter objects for the first time on the main layout(preloaded on the preloader layout but not initially created on start of layout on the main layout.). My guess here is that due to the anticipation of mobile phones to conserve memory, garbage collection is more strict that images not present in the next layout will be automatically be flushed from the memory (that explains the lag when images present in the preloader layout is also present in the main layout that causes high fps drop due to memory flushing that causes layout startup glitches). So I believe depending on the phone's specs, there will be images in the preloader layout that will be flushed on end of layout. So any workaround suggestion?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sethmaster - You are right. It finally works Thanks. A preloader is way better than adding it besides your game layout.

  • Sethmaster - I believe I didn't add the initialization event in my preloader event sheet. Too bad I already deleted the version of my project that has the preloader. I am still remaking it and retry this. So if I add an include of my spriter event sheet, will the preloader work correctly that it will show the spriter objects on my main layout?

  • You guys have a point and it is also good to know that Scirra Team also considered thinking about this. Just wondered about HTML 5.1 currently set for release on approximately September 2016.

    I don't know if it will affect the web or even C2/C3 into changing things or it will just append features for HTML5 but we can tell that things do innovate every year that passes.

    Here is a webpage I read just now: http://whatpixel.com/html51-expected-release-rc-2016/

  • What if HTML5 were to depreciate, what will happen to C2/C3? or is it even possible? What if C3 were to launch and HTML5 were to depreciate? or what if you were about to finish a game and html5 will suddenly depreciate. Is there a Scirra Backup Plan or will they have to reprogram the entire engine again?

  • C-7 - I already tried adding a preloader layout but the problem is that only a few objects get preloaded since according to the manual:

    Construct 2 only loads the images for the current layout. This avoids loading the entire project in memory which would be slow and consume a great deal of memory. When starting a layout, all images for the objects placed in the Layout View are pre-loaded. This includes all frames in all animations of any Sprite objects. (In other words, Sprites are either fully loaded in to memory, or not at all - they are never part-loaded.) When the layout ends, all images that are loaded but not used on the next layout are released from memory.

    . The result is that other scml objects doesn't even show up since not present in the main layout. And they don't ever show up.

    But if I add objects to both the preloader layout and main layout, things get glitchy on start of layout (must be because of high fps drop caused of javascript garbage removal of duplicate memory images). Creating Objects becomes glitchy and platformer objects are scattered.

    With the fade-in delay, spriter objects already created are fine because it was hidden by the delay but during gameplay spawns, newly created objects are still invisible until a few seconds they show up.

    *BTW I use the DestroyOutsideLayout behavior instead of Start->Destroy(Object) to destroy not yet used spriter objects on main layout.

    Thanks in advance.

  • lucid - Hello lucid. Do you know an efficient way to preload scml objects because I experience delay of the scml object to show up when the layout has just started or the object has just been created. Do you know any efficient workaround. Thanks.

  • I have Spriter objects (scml) in my project and on start of layout when a spriter object is not fully initialized, it appears blank but eventually it becomes visible when it, I believe finished initializing. Do you guys know any efficient way to preload (Spriter)scml objects? Thanks

    Ashley - Well honestly, the multiplayer was my dream plugin and top of my list that I want to add in my games but you have to understand Ashley that not all are as smart as you. There are people like me who are still hesitating about using the multiplayer plugin since we might be going into something that is above our capabilities, making AI acting like players was hard enough to make, how much more adding multiplayer functionality with respect to lag problems. We are still here waiting for a better multiplayer plugin update for C3, something a high schooler who receives F in all his exams can still understand .