Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Playing a background animation

This thread is locked; no one can reply to it. rss feed Print
Playing a background animation
Frankincense
Member #14,367
June 2012

Hi guys,

I want to make a background that is an animation. Obviously I could just create a sprite sheet, well unfortunately each frame is going to be around 1100x700 (or close), which is apparently too big for allegro to handle (?)

Also I can't use a GIF as I can't see anyway of doing this (there was an addon, but it does not work for Allegro 5 and has licensing issues). I have also looked at .mng's, but there is basically no support for this and even if I somehow find a library that would work for me, it would probably be massively complex to get working.

What other choices do I have? Or is there a way to get the sprite sheets working (or GIFs etc.)

Cheers

Neil Walker
Member #210
April 2000
avatar

use memory bitmaps if there's that much stuff you need to animate - allegro isn't the limitation it's the graphics card memory.

or do it with a kind of dirty rectangle (i.e. your screens won't change entirely so have a table showing the bitmap(s) and locations for each frame - or how long to show each smaller bitmap in seconds before moving to the next), or simply just have multiple layers for the background to composite

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Dizzy Egg
Member #10,824
March 2009
avatar

Make it 4 x smaller and stretch blit?

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

weapon_S
Member #7,859
October 2006
avatar

Allegro 4 has FLIC support. Allegro 5.1 has a video add-on. I don't have much experience with either, but I know you can encode FLIC with the program FFMPEG, and it looks ugly. :P
The gist of these approaches is that they stream the file from disk (with a buffer). Not as easy as it sounds.
Memory bitmaps might be an option. I wouldn't try to load a 700MB movie, though.

CaptainVice
Member #13,313
August 2011

Animating something of that size sounds troublesome. Would memory bitmaps be fast enough? I know the few times I accidentally tried to use a decent sized sprite sheet from non video memory it lagged to hell.

How much of the background is actually animated? IE could you do a static background and do smaller, individual animations for the moving parts? This would drastically reduce your video memory requirements. You could even chop up the large background into smaller pieces if it needs to scroll to further minimize memory usage.

Frankincense
Member #14,367
June 2012

Thanks for the replies, I am trying to use the video addon in 5.1.2.

But each time I try to compile I get an 'error LNK2019: unresolved external symbol __imp__al_open_video referenced in function _main' error, but only for the command 'al_open_video'.

I have literally no idea why this is happening. I have tried both 5.1.1 and 5.1.2 and I am using msvc 2010.

Any ideas?

weapon_S
Member #7,859
October 2006
avatar

Have you added the video add-on (and your video back-end??) to the linker options?
(I'm not familiar with MSVC.)
You have to have Allegro compiled with video support. I believe theora of vorbis is one of the few totally free back-ends.

Frankincense
Member #14,367
June 2012

All I have done is download the build version of allegro 5.1.2 for msvc 2012, moved the bin, include and library folders into the correct directory, I didnt realise you had to do anything else?

Is there something else I have to install?

weapon_S
Member #7,859
October 2006
avatar

Before building Allegro (again) you have to build (or download ready-made) a video library Allegro supports. I know of FFMPEG (the library) and ogg (theora/vorbis).

Frankincense
Member #14,367
June 2012

God this is a minefield of documentation, I cant seem to find anyone trying to do what I am trying to do. I can't find any pre-built ffmpeg librarys that resemble anything that I know. Apparently you can't build ffmpeg under msvc.

Are there any links to a how-to for installing/building ffmpeg and linking so that I can play a video in my game?

Why is playing a 2 sec vid clip so difficult?

Arthur Kalliokoski
Second in Command
February 2005
avatar

I remember seeing the AVI demo in the OpenGL NeHe examples, maybe you could look at that and figure out a way.

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

weapon_S
Member #7,859
October 2006
avatar

It should be possible to build under MinGW and then port it to MSVC.
Apparently this guy has done so. You might have to build all the dependecies, though. But then you get support for A LOT of codecs.
Found via this.
I was curious too :P

Frankincense
Member #14,367
June 2012

Ok I have downloaded the dev version of the build from that site (the one that contains the .lib and header files to I can use it)

What do I need to do to use it? Do I just link in the .lib and hope the problem goes away?

weapon_S
Member #7,859
October 2006
avatar

All I have done is download the build version of allegro 5.1.2 for msvc 2012

Whoops, I've misread that because of your atrocious use of grammar (j/k :P).
Which files did you exactly download?
This is what generally needs to be done to get video in your program:

  1. Build and install (some) video library

  2. Build and install Allegro

  3. Link against video add-on (and maybe the video library)

The files you have downloaded may have done steps 1 and 2. If that's the case, you only have to do step three. I'm not too familiar with MSVC, but somewhere there's a project option that tells which libraries to use. And it is there that you have to add allegro and allegro_video.
If the files you have downloaded don't include step 1 and 2, only then you have to rebuild Allegro like I said before.

jmasterx
Member #11,410
October 2009

I think you cannot use MSVC because FFMPEG uses C99, something M$ is incapable of implementing >:(

Peter Wang
Member #23
April 2000

Note that the video addon is fairly immature. The ffmpeg backend has unreliable synchronisation. The theora backend doesn't implement seeking. The theora libraries should build with MSVC, but probably painfully (lots of manual work). It definitely was for the libvorbis/libogg combination, which you will also need.

Frankincense
Member #14,367
June 2012

Brilliant so now I can't even do that! This is becoming a joke.

Does anyone know to play a small video/gif in an Allegro game, that has a relatively simple setup and has a tutorial on how to do it?

Neil Walker
Member #210
April 2000
avatar

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

weapon_S
Member #7,859
October 2006
avatar

jmasterx said:

I think you cannot use MSVC because FFMPEG uses C99, something M$ is incapable of implementing

The links I posted suggest that MSVC indeed doesn't implement the features needed for compiling the library. They also suggest GCC[1] can be used to compile libraries usable by MSVC.

Brilliant so now I can't even do that! This is becoming a joke.

It probably can be done. Not much people have bothered to try, though. The missing synchronization only affects audio[2].

Quote:

that has a relatively simple setup and has a tutorial on how to do it?

There is no such way yet. You could decide to become a pioneer yourself and write down how you did it, and discuss the bugs you find with the Allegro developers. Or you could wait until such way becomes available. Or you could write a very simple bitmap streamer.

I'll repeat:

weapon_S said:

The files you have downloaded may have done steps 1 and 2. If that's the case, you only have to do step three.

References

  1. Ergh, I forgot the specifics, but it needs another program. So the correct term could be "GNU derived toolchains for Windows". BTW it seems to need MSYS; yuck.
  2. Of course in relation to the video; so you could rephrase it as: "it affects the video in relationship to the audio". Also it might(?) run a little faster or slower than expected. The point is: if you want a simple animated background, it might very well suffice.
SiegeLord
Member #7,827
October 2006
avatar

The ffmpeg backend has unreliable synchronisation.

I believe the synchronization issues have been fixed when the audio resampling issues were dealt with.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: