0 Favourites

Video vs. PNG image sequence performance

  • Hi. Been testing out the new video feature, and it's completely godsent! I also see that it doesn't consume nearly as much memory as I first feared. So I have a question I would love for someone tech-savy to answer for me.

    Currently my game uses a lot of rectangle shaped assets which are fully animated with 8 frames of 512x512. This consumes a lot of memory and spritesheets, but I see potential in turning these animated assets into video to save memory and load times. Has there been any testing on how many video files running at the same time can effect performance, or if it's even practical at all?

    I would appreciate it if anyone has any insight on the matter.

    Thanks

    Tom

  • I can't imagine you could have too many. video is similar to music streaming.

    Slice of data is read.

    Slice is unpacked <===== CPU HOG

    slice is rendered

    slice is destroyed

    on pc you could probably get a way with a good handful. Maybe even many primary objects. However on mobile this technique would probably die and cause the device to burn in glory.

  • I see. Haha yeah mobile isn't a target platform for the game. Any potential mobile device version will have way downscaled ambitions.

    So you're saying video is mostly CPU intensive?

    Thanks for the insight.

  • Lots of browsers already have GPU-accelerated video decoding.

    I think 8 frames isn't enough for much benefit for video - the memory usage may or may not be lower, but 8 frames of video is likely to have a significant quality impact, since it will probably just have one keyframe then seven delta frames. Video is also designed for long-running media and it may end up just decoding everything fully in to memory anyway if it's short. It could be worth experimenting with though.

    Note your spritesheets will be a lot more space efficient if you use just under a power-of-two size, e.g. 500x500, since spritesheets are power-of-two plus an extra pixel transparent border round each image. So you can only fit 3 tiles of 512x512 across a 2048x2048 spritesheet, not 4.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I see. What exactly is the complete optimized spritesheet sizes for taking advantage of the most space possible? Most assets are currently 128x128, should I just downscale it to 120x120, 124x124, 127x127? Also for the 500 mark, is it 500x500, 508x508 or 511x511 per asset?

    Thanks again!

  • The maximum spritesheet size is 2048x2048, but if it can fit on a smaller power of two size (1024x1024, 512x512 etc) then it will. Since every image gets a 1px transparent border added around it, the most efficient size is two pixels smaller than a power-of-two size. For example 126x126 will have a border added bringing it up to 128x128, and then that can fit perfectly on any size spritesheet (2 across on 512x512, 4 across on 1024x1024, 8 across on 2048x2048).

  • Personally I think the OP should try this out. I'm sure this could work great to an extent. It's just that I think this would be best used for high frame count objects, that are few and far between. CPU/GPU acceleration. In either even there is a reason why the industry doesn't use video's as the primary form of animation.

    As an example. This could work well for animated backgrounds. Interactable characters in adventure games. Monsters in Final Fantasy combat.

    However I don't think these would work well in games where it's used for the player in a platformer. I think the buffering for the video would causes visual latency.

    Also here is a question. What about transparency? Can video's have transparency?

  • Personally I think the OP should try this out. I'm sure this could work great to an extent. It's just that I think this would be best used for high frame count objects, that are few and far between. CPU/GPU acceleration. In either even there is a reason why the industry doesn't use video's as the primary form of animation.

    As an example. This could work well for animated backgrounds. Interactable characters in adventure games. Monsters in Final Fantasy combat.

    However I don't think these would work well in games where it's used for the player in a platformer. I think the buffering for the video would causes visual latency.

    Also here is a question. What about transparency? Can video's have transparency?

    I am pretty sure that videos can not have transparency once rendered.

  • Then you are pretty wrong.

  • Joannesalfa

    That is a fantastic answer. I really could see a few videos here and there. volcanic backdrop. City street backgrounds. Or how about Cyberpunk video adds on billboards going by.

  • jayderyu You could try it with node-webkit, I can see videos with alpha background.

    http://simpl.info/videoalpha/

  • I'm not sure alpha-videos are widely supported - I don't think there are many video editing tools and encoders that are alpha-aware, and I don't think h.264 supports alpha videos either, so that means IE and Safari wouldn't show transparency.

    In general I'd advise sprites for in-game playable objects, and video for anything that is, well, a video - like cutscenes, short clips, background TVs, etc.

  • Thanks for all the feedback. Will definately experiment with it!

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