How can I create colorful whirlpool background effect?

Started by Meistari F, Thu 16/04/2009 16:29:18

Previous topic - Next topic

Meistari F

I am looking for code for a background effect.  You have hopefully played Space Quest 1 and 4. But both of those games had some background with a amazing whirlpool background effect.

Does anybody know what AGS code are used to do that?

Here is a image wich should show you and explain what I mean. But as you can see in this pic Roger Wilco has already started up space shuttle and this amazing rainbow colorful  whirlpool background effect happens then. I just wanted to know how this is done. That background effect happens also on the Sierra logo background.











GarageGothic

#1
It only works in 256-color games and is accomplished by cycling the palette (or in this case, a certain part of the palette since the cockpit interior doesn't change). Check up on the function "CyclePalette (int start, int end)" in the manual. If your game is 16- or 32-bit color, you'll have to create the effect as an animation instead.

Edit: See also the palette section in the tutorial for a more thorough explanation.


Mr Flibble

I've been considering how to do something similar at higher colour depths.

Whilst I think in the long run, animating the thing by hand would probably save time, if it was something you wanted to do a lot if might be helpful to have a scripted implementation.

I haven't really tried this so I'm not sure if it would work, but I think you could emulate similar effects using dynamic drawing commands.

I think these would be far too slow to cycle convincingly for a vortex animation.. still, on a smaller scale it could work if you were really opposed to making it as an animation for some reason.
Ah! There is no emoticon for what I'm feeling!

Gilbert

There's actually an incomplete tutorial in the wiki about how to use 256 colour graphics and colour cycling in AGS.
Unfortunately the document is rather outdated and the fool who wrote it is too lazy to update it at the moment. You may probably need to change stuff to accomodate with newer versions of AGS.

GarageGothic

Mr Flibble, it's definitely possible - but as you say, the result will be horrible slow when performed in the repeatedly_execute on a larger part of the screen. I did a module which inverts, multiplies etc. color values, and even on small sprites it lowers the framerate by about 10. Pre-rendering all the frames at run-time is an option, but would mean a pause of several seconds while doing so. I think the best solution for doing it in-engine, would be to render the frames and then output them to .bmp files ready for sprite import.

SMF spam blocked by CleanTalk