GameSalad

Image loading delays

tatiangtatiang Posts: 11,039Member, Sous Chef, PRO, Senior Sous-Chef
edited September 1 in Working with GS (Mac)

I'm making a yearbook sort of app where you can scroll through pages of photos with names. This is all in a single scene with 25 actors with no images (to start with). I'm changing their self.Image values to match images in the Library whenever the left/right page actor is clicked. Each image is about 700 KB and they are all jpegs. It takes about three seconds for all 25 of the images to change (at once) when I "switch pages." After I've done that once for each "page" of 25 images, I can navigate between "pages" as quickly as I want and the images change immediately.

I'm wondering if there's a way to prevent the initial delay. I tried checking or unchecking Preload art which doesn't seem to matter (makes sense since technically the actors have no image values to start with). I also tried looping through all possible image names in a hidden actor but that didn't make a difference.

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Best Answers

Answers

  • Two.ETwo.E Posts: 366Member, PRO
    edited September 1

    How were you looping over them?

  • tatiangtatiang Posts: 11,039Member, Sous Chef, PRO, Senior Sous-Chef
    edited September 1

    @Two.E I was hoping that simply changing an actor's self.Image to each picture in succession would help.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Posts: 11,039Member, Sous Chef, PRO, Senior Sous-Chef

    Interestingly, when I manually change the value of self.Image as follows, it does reduce the delay to almost nothing:

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Posts: 11,039Member, Sous Chef, PRO, Senior Sous-Chef
    edited September 1

    I'll try that. I put it in an every 0.1 seconds Timer and it worked so my next step is to lower the Timer duration and/or try a Loop. Thanks!

    Edit: A loop didn't work but setting the timer to 0.05 seconds did the trick.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Posts: 11,039Member, Sous Chef, PRO, Senior Sous-Chef

    Another thing that removed the loading delays was changing the dpi on all image files from 300 to 72 or scaling the sizes down by about 50%.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Posts: 12,725Member
    edited September 2

    @tatiang said:
    Another thing that removed the loading delays was changing the dpi on all image files from 300 to 72 or scaling the sizes down by about 50%.

    This doesn't sound right, changing an image's ppi will have no effect on the file size (which would effect loading times), I suspect you are actually changing the image's resolution instead ?

  • tatiangtatiang Posts: 11,039Member, Sous Chef, PRO, Senior Sous-Chef

    Hmm... I plead ignorance. What I did was to run it through Photoshop's Image Size... and change the Resolution from 299.999 to 72. But I just checked and it does indeed change the pixel dimensions when I do that.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Posts: 12,725Member

    @tatiang said:
    Hmm... I plead ignorance. What I did was to run it through Photoshop's Image Size... and change the Resolution from 299.999 to 72. But I just checked and it does indeed change the pixel dimensions when I do that.

    Then you must have 'resize image' checked in Photoshop's Image Size window, which means you are changing the image's resolution and not simply changing the ppi.

    If you just want to change the ppi then you should uncheck 'resize image' or change the measurement to pixels or percent (or anything that doesn't have an actual size), but - of course - this will have no effect on the image's memory footprint / loading times !

  • tatiangtatiang Posts: 11,039Member, Sous Chef, PRO, Senior Sous-Chef

    @Socks said:
    An old trick I would often use was to throw all the images into an animation behaviour (placed in the scene so it played/loaded when the scene was loaded) - the images need not be the same size (as would be the case in the normal use of an animation behaviour), just drag all your images into the animation behaviour's window set at 30fps and then place the actor with the animation behaviour off-scene/out-of-sight somewhere, or make it's size x=0, y=0 . . .

    That's even better. Thanks!

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Posts: 12,725Member

    @tatiang said:

    @Socks said:
    An old trick I would often use was to throw all the images into an animation behaviour (placed in the scene so it played/loaded when the scene was loaded) - the images need not be the same size (as would be the case in the normal use of an animation behaviour), just drag all your images into the animation behaviour's window set at 30fps and then place the actor with the animation behaviour off-scene/out-of-sight somewhere, or make it's size x=0, y=0 . . .

    That's even better. Thanks!

    You can also spread the images across several actors (with animation behaviours) if you need faster (than 30fps) loading.

  • Two.ETwo.E Posts: 366Member, PRO
    edited September 3

    Just curious, have you tried just adding all the images into an actor as separate change image behaviours?
    I know with change attribute behaviours, they will activate in order within the same code cycle. I did over 200 behaviours each changing an attribute to +1, and the results were instant. I know there is a big difference between an attribute value and an image.

    Just curious, I will do a test some time this week to see, because if having multiple animation behaviours work, then a change image isn't that different.

    Best

  • tatiangtatiang Posts: 11,039Member, Sous Chef, PRO, Senior Sous-Chef
    edited September 12

    @Socks said:

    @tatiang said:

    @Socks said:
    An old trick I would often use was to throw all the images into an animation behaviour (placed in the scene so it played/loaded when the scene was loaded) - the images need not be the same size (as would be the case in the normal use of an animation behaviour), just drag all your images into the animation behaviour's window set at 30fps and then place the actor with the animation behaviour off-scene/out-of-sight somewhere, or make it's size x=0, y=0 . . .

    That's even better. Thanks!

    You can also spread the images across several actors (with animation behaviours) if you need faster (than 30fps) loading.

    So I did this and though it worked great, it caused GS Viewer on my iPhone to time out ("Device Disconnected"). I'm still looking for a perfect solution and may try @Two.E's suggestion.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.