GS loads every image from any referenced actor. How to prevent?

Fodder76Fodder76 Member Posts: 154
edited November -1 in Working with GS (Mac)
Hey there,

I brought up this issue in another thread, but I though I'd try a new one since that thread is a couple of pages long now. This, for me, is a huge issue, and I'm desperately hoping there is a way around it.

In my game I have a situation where I'm loading one of a set of nine images. Basically, I have one of 9 characters you can choose from, each has a bunch of animations associated with it.

When the level starts, based on which choice the player made, it will spawn the actor of one of the 9 characters. Well what I realized, is that GS is actually loading ALL of the images of all of the actors, regardless of whether they are spawned or not!

Its adding about 5 seconds to my load time, which is unacceptable. The only way I can think of to get around this is to have 9 separate scenes, each one loading its own character. But that SHOULD be entirely unnecessary.

Does anyone have any advice?

I have another situation that's similar, but I'll wait on that until I see if there are any suggestions to fix this issue.

Thank you very much!

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Your gonna have to make a separate actor foe each character. Anytime you place an animate behavior GS loads every image in the animate so there is o lag when it needs to run. So because you are spawning an actor with 9 different characters in it. I will load every image in an animate behavior in that rule.
  • Fodder76Fodder76 Member Posts: 154
    Thanks tenrdrmer,

    I do have separate actors for each character. When the scene starts, I have one actor that essentially says 'if CharacterNumber = X, then spawn X actor'

    The animate properties are only in the separate characters actors, (not in the primary actor) which shouldn't even be loaded at all, but, I believe, because the other characters are simply referenced in the 'master' actor, all of them seem to load.

    When I delete this actor and no character spawns at all, it knocks 5 seconds off of my load time.
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    Instead of having actor whit images, you should have them with a VERY small image, and a Change ATTRIBUTE, self image to : The image.

    But that will load the image in the game (Instead of the beginning) and will make you have some lag when you load the image.

    Cheers-
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Fodder76 said:
    Thanks tenrdrmer,

    I do have separate actors for each character. When the scene starts, I have one actor that essentially says 'if CharacterNumber = X, then spawn X actor'

    The animate properties are only in the separate characters actors, (not in the primary actor) which shouldn't even be loaded at all, but, I believe, because the other characters are simply referenced in the 'master' actor, all of them seem to load.

    When I delete this actor and no character spawns at all, it knocks 5 seconds off of my load time.

    Oh well it shouldn't be loading images for anything not in the scene even if it is referenced as a possible spawn. it still wont load then. What size are the images you are using?as well as how many are there in the animations. You may simply be overloading the engine with a massive number of smaller images.

    If you really believe the load tie is affected by the unspawned actors go into your spawner rule and turn all of the rules for spawning a character off except 1 and see if that improves things. if it does you may have found a bug and need to report it.

    I have a feeling though you are just spawning a ton of images in one actor and they may even be oversized. You can also try optimizing your images based on powers of 2. Let me know what the image dimensions you are using and I can tell you real fast if its close enough to a size for less memory usage.
  • Fodder76Fodder76 Member Posts: 154
    Each character consists of about 17 128 x 128 pngs. They are saved properly and optimized. A single character shouldn't be that big of a drain on loading. But taking that times 9 would certainly have a bigger impact.

    I haven't actually tested what you suggest: removing the references to the other 8 characters. I will when I get home today. But I'd be very surprised if loading 17 128x128 images is adding 5 seconds to the loading.

    Thanks again!
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    No it prob shouldn't hurt it that bad. although it is Really though if you are not spawning it until the scene loads it should not affect your scenes loading time at all. Try putting like a 0.1 or 0.2 second timer on your spawn rules. THat may delay the spawn enough that the scene can load first and then it spawns after its completely loaded.

    Another thing that may or may not work is moving the controller that is spawning to the top of the highest layer. From what I understand The scene loads and reads all of the actors from the bottom of the layer list to the top. so if its in the bottom all of those spawn rules right off the bat it may be jamming things up while its try to load other actors. I dont know if any of that would help but those are things I would try.
  • Fodder76Fodder76 Member Posts: 154
    Hey there, thanks again for the post.

    So first thing. I'm home now and I did my test. I deleted all of the extra parameters that point to other characters, except for my default primary character. And sure enough, it cut my load time down from 8 seconds or so to a little less than 4. No doubt about it in my mind, GS is loading lots of images that it doesn't need to.

    I'm not sure how much of the forums the GS devs look at, but I'd like to officially submit this. To me, and for the game I'm making, this is a major problem.

    I'll try the delayed spawn now. Thanks for the suggestion.
  • Fodder76Fodder76 Member Posts: 154
    Delaying the spawn time of the actors didn't do anything for the load time. I even made it quite extreme (5 seconds).

    So basically, while a scene loads, GS looks at any actors that will, or even MIGHT spawn, and loads all of their information including any images associated with them.

    Ohh boy what I'm I gonna do.

    Thanks for everyone's help in this thread!
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    What about reordering the actors so the one with the spawn rules is at the top?

    Definitely submit that as a bug report. they have bugs(at)gamesalad.com that you can send your project file to them showing the issue.

    ___________________________________________________________________________________
    TEMPLATES AND PROJECT HELP BY TENRDRMER. CLICK HERE!!!

    AppSolute Entertainment on Facebook
    AppSolute Entertainment on iTunes
  • Fodder76Fodder76 Member Posts: 154
    I haven't tried that, I'll give it a shot.

    I did submit it as a bug. We'll see if I hear anything back.

    Thanks again for all your help! Promo code coming your way in a few weeks. :)
Sign In or Register to comment.