Spriter/C2 update 11/2 bug fix for performance mode

Discussion and feedback on Construct 2

Post » Thu May 12, 2016 11:35 am

@chadorireborn Did you include the scml event sheets both into the preloader and the main sheets where you want to use the spriter sprites? The code are necessary to be included in every event sheets they are used, it's not optional.
B
36
S
18
G
11
Posts: 248
Reputation: 8,694

Post » Thu May 12, 2016 12:54 pm

@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?
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
30
S
12
G
77
Posts: 964
Reputation: 51,350

Post » Thu May 12, 2016 1:25 pm

@chadorireborn It should since I have been using it as such for quite a while and have no issue whatsoever.
If you don't want redundancy, simply create a layout with the scml sprites with its own event sheet for the initialization events and include the event sheet in every event sheet that you plan to use the sprites in, including the preloading layout/event sheet.
B
36
S
18
G
11
Posts: 248
Reputation: 8,694

Post » Thu May 12, 2016 2:31 pm

@Sethmaster - You are right. It finally works :D Thanks. A preloader is way better than adding it besides your game layout.
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
30
S
12
G
77
Posts: 964
Reputation: 51,350

Post » Thu May 12, 2016 3:36 pm

I just wanted to give a huge thanks to lucid for providing the "Set C2 object to Spriter" action. I spent way too long and revamped entire events trying to eliminate lag of an object from my character moving. Once I read about this and used Spriter's internal action point, and now it's working beautifully. Thank you so much!
B
6
S
2
G
1
Posts: 5
Reputation: 958

Post » Thu May 12, 2016 5:57 pm

@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?
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
30
S
12
G
77
Posts: 964
Reputation: 51,350

Post » Fri May 13, 2016 12:21 am

No experience for using Spriter in mobile implementations since I never aimed for that but you can try creating one dummy for each spriter object you plan to use on the start of the layout outside of the layout (use negatives position) and deleting them shortly afterward (use 0.1 second of 8 ticks delay).

Then create the sprites you actually want to use afterward with none of the lag or problem.

No difference from preloading it using another layout.
B
36
S
18
G
11
Posts: 248
Reputation: 8,694

Post » Fri May 13, 2016 5:48 am

@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.
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
30
S
12
G
77
Posts: 964
Reputation: 51,350

Post » Fri May 13, 2016 6:25 am

chadorireborn wrote:@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.


As I said in my previous post, just create those spriter sprites first at the startup of any layout that will use them outside of the viewport (use negative coordinates). On creation, disable the DestroyOutsideLayout behavior for those instances only.
Then delete it soon afterward.
B
36
S
18
G
11
Posts: 248
Reputation: 8,694

Post » Fri May 13, 2016 8:02 pm

@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.
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
30
S
12
G
77
Posts: 964
Reputation: 51,350

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: rekjl and 9 guests