Handling lots of animations/rant

This forum is currently in read-only mode.
From the Asset Store
4 Block Soldiers with different animations, 400x400
  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.....

  • 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.

  • 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.

  • 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.

  • 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?

  • I seem to recall that texture streaming isn't possible with DirectX - might it be possible with OpenGL for C2?

    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.

  • What I was basing that off of was Ashley's post here: - it would be awesome if texture streaming was possible!

  • 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

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