GIFs FTW

It was time to get cutscenes playing in the game. I did some research on free software codecs, licenses, etc.. I tried converting our cutscene from animated gif into an ogg-theora file… and it looked awful. Sure, I could have turned up the quality settings, and then the artifacts would not have been as visible, but it got me thinking: I wonder if there's a video format that does lossless compression, and is optimized for large solid areas, and possibly low color palettes. You know, something for video, like what PNG and GIFs do for images… wait… GIFs!

Seriously? Is it really a good idea to use GIFs in the game?

I don't particularly like gifs. First they were used to make most of the internet annoying (if you weren't surfing the internet over dialup in the 1990s… you didn't miss much), then random people were getting sued for patent infringement… but all the patents have expired, and there's a nice free library (very old, and sill maintained) that makes it really easy to open up GIFs, and get at the frames, palettes, etc.

So I incorporated giflib into the project, wrote some code to convert between the data structures you get from giflib and those that SDL2 needs, and voilà! We have cutscene (singular at this point) in the game!

Yay!

But wait, now that we have GIF support, can we use it for sprites in the game too? Answer: yes!

A bit more code later (and some preprocessing, so I don't have to support every GIF feature) and we've got a lively little talking goblin head in the game.

My GIF code has two modes:

  1. Movie: everything is opaque, supports partial-screen updates (great for the little camp fire in the main menu background)

  2. Sprite: supports transparency, and efficient access to frames in any order

The game is starting to look pretty slick! The GIF gameplay video last post is fun, but doesn't quite do the game justice, since it is short, low res and low frame rate.

One of these days, I'll have to do a real gameplay video, including the menu, cutscene, etc. at high resolution and a good frame rate. Hopefully we can make something like that look good on youtube or vimeo or something.

I've got an initial draft of a new "feature" code-named PainCloud. It's a pulsating red area that wanders about your brain obscuring your thoughts. You'll get these if you're injured… I think. You can get rid of them by clicking on them, but then your goblin audibly groans, which isn't great for rapport (and makes your thoughts wobbly for a bit).

Today I changed the way the code creates links to new thought bubbles. Now, instead of creating all the links right away when you move, there's a checkup that runs regularly and creates new links/thoughts as needed. This paves the way for us to add new effects that destroy thought bubbles, and the code will automatically add things back in if needed, so you don't get stranded.

2 thoughts on “GIFs FTW

  • April 15, 2017 at 9:09 am
    Permalink

    I hope you continue working on this project!

    Reply
  • April 15, 2017 at 8:33 pm
    Permalink

    Hi! We are still working on the game… but we’ve abandoned this blog. Please subscribe using the widget in the top/right of this site, so you’ll be sure not to miss our kickstarter. If you’d like to see updates, art, thoughts, etc, follow us on reddit: https://www.reddit.com/r/goblindiplomat/

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *