How to optimize a game that loads images into folders by MS?

This forum is currently in read-only mode.
From the Asset Store
Elevate your games with our AI Chatbot Integration! Seamlessly connect your Construct 3 projects with GPT-4 for dynamic,
  • Everything is in the title ^ ^ I made ??a construct with RPG and I chose to manage the animations of monsters and not with the character animation editor but by folder. Why? Because I noticed that if I put all the images in my. cape, it'll end up putting a half-hour to save and launch the game, the more it reduces considerably the memory ram, but I must load my pictures all the recess milliseconds indicating the way forward.

    Whatever the number of images in folders, I noticed that the game was super slow because of that whenever I add something NPCs loaded images every millisecond and whatever the number of frames of animation Is it possible to reduce this latency? I had to optimize the game myself by saying that the object outside the screen no longer load images, but this is very ugly because there is a difference in playing time, the character works very slowly near the NPCs and suddenly accelerates when the other disappears, it's a bit annoying, there-there not a time management construct that optimizes the game?

  • What you are using is a very inefficient solution. You need to load animations well before using them, otherwise you get delays like that.

    Typically on layout start/transition.

  • Yes but to load all images in the layout at first, it must import them into the. cap, but do it greatly increases the ram of the game, and when I save my. cap it takes 3 times longer to save . So it's not a good solution.

    And besides, I like this opportunity to ask is it that tells me the debug construct 100 mb ram, and that in reality I have 250 mb?

  • No, no, I meant that you only load images at RUNTIME, not import them into .cap.

    So basically:

    + On start of layout

    Load a bunch of images

    Surely you've seen loading screens in other games? That's the idea, you only load the images and textures when you need them (on start of layout), then unload them when you don't need them anymore (on layout change).

  • Excuse me but can you explain the technique to do what you say because I try something and it does not work

    For exemple i don't understand how import at runtime a group of frame, and after call them

  • Sprite object has "Load animation frame from a file".

    Just loop through all frames at start of layout and load an image into each frame.

    Like this:

    + For "frame" from 1 to 8

    Sprite: Set animation frame to loopindex("frame")

    Sprite: Load animation frame from AppPath&"animations/character-"&loopindex("frame")&".png"

    What this does is loop through animation frames and load images from animations folder, such as character-1.png to character-8.png.

  • Thanks ! It was the "Set animation frame to loopindex("frame")" that i hadn't , i understand now, because before , i tryed to load frame whithout saying which frame it was.

    But i have a lot of animation with my character, so in my case, i must do this ? :

    Set animation WalkDiagDown ( for exemple)

    + For "frame" from 1 to 8

    Sprite: Set animation frame to loopindex("frame")

    Sprite: Load animation frame from

    AppPath&"animations/character/Walk-"&loopindex("frame")&".png"

    and the loop stop after 8 ? because i think that you must put a break loop at the end.

  • The 8 is number of animation frames you have. You just set that number to however many frames are in that animation. The For loop automatically ends after the last number.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ouch sorry ^^ but first i need that the loop restart, because i must restart the loop for n side : down, up, right, and diag up and diag down i have this systeme : Download the images because they're too large

    <img src="http://img859.imageshack.us/img859/2460/20851892.jpg">

    And the end :

    <img src="http://img853.imageshack.us/img853/8619/63344708.jpg">

    RUNTIME is a private variable just integer

    RUNTIMESIDE : a char side of the animation and you can search the folder with

    RUNTIMEANIMATION : a char, the name of the animation ( run, walk) and you can search the folder with too.

    ImageMax : the maximum of images of the animation, i update this integer when i go to an other RUNTIMEANIMATION.

    But on this code there is no way to restart the loop, but he should must work with the first value

    RUNTIMEANIMATION :=Walk

    and RUNTIMESIDE : =Haut

    and ImageMax :=19

    And FINALLY when i start the game i have an error : "A nested loop was started with the same name as an already running loop rename your loop to a unique name"

  • Any ideas ?

  • Oh, that's a bit too much for me, sorry Like I said, I don't do much animations, I'm just familiar with certain game design paradigms.

    Why don't you create a new .cap and experiment there? Might find a solution that works for you.

  • I'll see about setting up a demo later, but in the meantime I'd suggest naming your files, and animations numerically, and using folders to make things easier.

    Start of layout

    -for "folders" = 1 to 4

    --for "frames" = 1 to 10

    ---sprite set animation to loopindex("folders")

    ----sprite set frame to loopindex("frames")

    -----sprite load frame from appath &"\"& loopindex("folders")& loopindex("frames")&".png"

    It shouldn't be necessary to set animation speed as this is happening at start of layout, and all within a loop.

    Although that does mean that if you plan on loading an animation later on you will have to change the speed.

    Edit:

    http://dl.dropbox.com/u/666516/skelanim.zip

    Not my sprite

  • I think the best way is to make new action in plugin "Sprite".

    Says you just need to specify folder where from to load sequences and prefix for frame count and file extension. Action look for subfolders and creates new animations for each one. Then for every subfolder it loads amount of frames equal to amount of files. I think it will be very usable for everybody if someone make this.

    For me it's very needed feature because artists always improves animations and you need every time to reload it manually.

  • Not sure if your aware of this, but there's already an action under sprite called "load frame from file", so you don't have to use the image manipulator.(see download above)

    Also you can do all you suggested via events, and the file object.

    The only thing you can't do is add frames during runtime.

  • I'm just trying to understand the advantage of animations loading at the start of layout...

    For example, I have next animations and associated RAM use:

    1. Hero (100 mb of RAM)

    2. Enemy1 (20 mb)

    3. Enemy2 (20 mb)

    4. Enemy3 (20 mb)

    On total - 160 mb

    At the first layout I'm using Hero and Enemy1, so - 120 mb of RAM are used.

    At the second layout I'm using Hero, Enemy1, Enemy2 and Enemy3 - all 160 mb are used.

    If I understood correctly, comparing usage of unique .exe, I have an advantage of free 40 mb of RAM only at first layout (and at the meny layout of cours).

    The question is: if at each layout I have to render all my animations, is it usefull to use "Load frame" ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)