Handling lots of animations/rant

New releases and general discussions.

Post » Sat Apr 03, 2010 8:19 pm

construct really needs a way to handle big animations.

i dont know exactly how construct does it now but i think it just dumps everything into vram and runs?
i read a bit on this stuff and it looks like ever since 2d games existed, only background texture type stuff was loaded into VRAM, and then for animations, everything not needed isnt loaded, only the current animation frames needing to be drawn would be loaded into vram that game frame. so that would mean that vram usage isnt a problem unless the total amount of texture data needing to be rendered at a given frame would be really big. the problem most people are having is dealing with alot of frames, and no vram space to put it in, its rare that the total amount of texture data needing to rendered in one screen is too much for vram.

does construct have an option to this right now, or is it already?
what would be the advantage/disadvantage of this method.
and do you think it would be a good idea to have it for frame heavy games?

id like to see the devs' view on this and what the community thinks etc. discuss!
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sat Apr 03, 2010 8:44 pm

Probably whats really needed is an object made specifically for this.
One way to reduce size is to make the animation where its not creating the same data every frame. Some animation types reuse data in places of the image where there is no change, IE if there is a pixel in the previous frame, and the current frame, don't erase the old one, and don't draw the new one.
Not sure if that's even possible in Construct, same goes for collision detection.....
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Sat Apr 03, 2010 8:54 pm

I think Construct should be tapping into the vast amount of regular RAM everyone has. What if it stores some stuff in regular RAM then puts it in VRAM when needed? I'm not sure what would help exactly, but VRAM is strained while RAM is hardly touched...

Edit: Things that aren't stored in VRAM would kind of have to be put in RAM so as not to be loading off the HDD constantly.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Sat Apr 03, 2010 9:10 pm

Hardware accelerated graphics cannot be stored in standard RAM, only VRAM. Construct already stores all textures PNG-compressed in standard RAM, and loads them in to VRAM when needed. The default is to load everything in to VRAM on startup, but you can set the texture loading to go layout-by-layout, so a large animation is only loaded in to VRAM when on that layout.

Loading animations frame-by-frame is not really plausible - the time it takes to decompress a PNG from system memory then upload to the video card, done for every frame, would create a noticable delay. It'd probably totally kill the framerate; this is why Construct loads entire layouts in to VRAM as a minimum.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,528

Post » Sat Apr 03, 2010 10:56 pm

Okay, good to know how Construct actually works. I kind of wondered about the transfer time for that stuff. This kind of thing would work for, say, checkpoints in the save level though wouldn't it? Some games load stuff around you as you move through them and compress everything else. That probably couldn't be added to C1, but an interesting idea anyway.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Sat Apr 03, 2010 11:14 pm

You can swap textures mid-level, but it requires some manual work. First you have to store all of your objects on a different layout from the game level layout. That will prevent construct from loading all the textures at once. Next you'll need to make a level editor, and load the placement of all the objects in the level from something like an array. When you load the layout, create the objects you need for the first section of the level. Construct will automatically load the textures for those and not for the second section. When you reach the second section, in the same frame, delete the objects you don't want in VRAM anymore, dump the unused textures and load the rest of the level from the array and create the objects needed, and construct will load the textures then.

The downside is that you're going to get a pause when it loads the textures for the new objects. I seem to recall that texture streaming isn't possible with DirectX - might it be possible with OpenGL for C2?
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Sun Apr 04, 2010 2:20 am

[quote="Arima":n78ehulz]
I seem to recall that texture streaming isn't possible with DirectX - might it be possible with OpenGL for C2?[/quote:n78ehulz]
Isn't possible? 3D games (using DirectX of course) can stream textures. It's a VERY useful thing. Call of Duty: Modern Warfare 2 uses it. Also, it may be 3D, but it's still using DirectX and 3D doesn't mean it can't be used in 2D.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Sun Apr 04, 2010 2:44 am

What I was basing that off of was Ashley's post here: viewtopic.php?f=2&t=2997&p=23220&hilit=streaming#p23220 - it would be awesome if texture streaming was possible!
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Wed Apr 07, 2010 1:35 am

Streaming would have to be handled VERY carefully for 2D though. It's fine for 3D because even if the textures are not fully streamed in right away, the player still has the full shapes of the models and level to be able to begin playing immediately even if it doesn't look great :lol:
B
2
S
2
G
4
Posts: 156
Reputation: 1,762


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests