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

For questions about using Classic.

Post » Sat Mar 12, 2011 9:09 am

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?
B
2
G
2
Posts: 31
Reputation: 712

Post » Sat Mar 12, 2011 9:11 am

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.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat Mar 12, 2011 9:25 am

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?
B
2
G
2
Posts: 31
Reputation: 712

Post » Sat Mar 12, 2011 10:10 am

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).
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sun Mar 13, 2011 7:42 am

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
B
2
G
2
Posts: 31
Reputation: 712

Post » Sun Mar 13, 2011 8:22 am

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.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sun Mar 13, 2011 9:18 am

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.
B
2
G
2
Posts: 31
Reputation: 712

Post » Sun Mar 13, 2011 9:31 am

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.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sun Mar 13, 2011 10:16 am

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




And the end :



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"
B
2
G
2
Posts: 31
Reputation: 712

Post » Tue Mar 15, 2011 7:16 am

Any ideas ?
B
2
G
2
Posts: 31
Reputation: 712

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests