About the best way to do some background animation...

Started by DiegoHolt, Fri 11/10/2024 22:08:20

Previous topic - Next topic

DiegoHolt

Hello, Great Sages (by this point I think I'm referring mostly to @Crimson Wizard @eri0o @Khris and sorry if I forget the names of others that are always there to help)

I'm having some thoughts about background animation. I have some large backgrounds and I think that it could affect the game's performance. I'm using characters to create the animations instead, and I was thinking if there was a better way of doing it. Are 'views' exclusive for characters, or can objects use those too somehow?

As always, thanks for your time!  :-D

Crimson Wizard

#1
Yes, room objects can use Views and animate, this may be found in the manual:
https://adventuregamestudio.github.io/ags-manual/Object.html#objectsetview
https://adventuregamestudio.github.io/ags-manual/Object.html#objectanimate

In regards to performance, it's not exactly clear from your description, but if you animate same big picture, then it won't make a difference whether you animate as room background, character or object. It only makes difference when you break big picture into multiple smaller parts that animate separately, while most of the background stays static.

Rik_Vargard

Objects can use views and be animated.
Just make sure that the Object has a baseline that's like 1 or 10 or whatever, based on your room size;  if you want it to be "behind" the player it has to be less than player.y in that room.

DiegoHolt

Quote from: Crimson Wizard on Fri 11/10/2024 22:54:00Yes, room objects can use Views and animate, this may be found in the manual:
https://adventuregamestudio.github.io/ags-manual/Object.html#objectsetview
https://adventuregamestudio.github.io/ags-manual/Object.html#objectanimate

In regards to performance, it's not exactly clear from your description, but if you animate same big picture, then it won't make a difference whether you animate as room background, character or object. It only makes difference when you break big picture into multiple smaller parts that animate separately, while most of the background stays static.

Alright, so you're telling me that it's better to animate a whole room of 3100x1200 than doing individual objects to animate the same thing? My doubt is about the limited number of background animation frames, if I recall correctly it only allows 5 or 6. In case I need a larger animation, what would you suggest?

Khris

CW meant that the opposite is the case: if only parts of the background need to be animated, you should use non-clickable objects instead. This also has the benefit that you are not limited to 5 frames of simultaneous animation (although it is easily possible to animate the entire background using a lot more frames if you code it yourself).

Crimson Wizard

#5
@DiegoHolt if you would just explain what kind of animation do you want to make, then we would be able to tell what is the optimal way to do that.

But in general, if animation changes only certain portions of a room, then it's better to make objects per each visible changing part and animate only them.
If you must animate a big seamless picture at once, then it does not matter which type of objects to use, since every animated kind of object (room bg, object, character, button) works exactly the same. Since the room bgs are limited to 5, and you need more frames, then of course using a object for background animation instead would be preferable.

eri0o

Other thing is repetition, like, if say you are going to have like 200 animated objects in the room but all of them are running the exact same animation, AGS will just repeat the texture graphics for all of them, which is fairly fast, if the 200 objects are different animations, then things will perform worse. Overall it really depends on what exactly you are doing.

DiegoHolt

#7
Actually I'm working on different options and I'm trying to plan the best way to do some of these.

One of the things I'm working on is a big arcade scene, where many videogame images are looping on each one of the screens (13 in total, not all visible at once because it's a large background) but some of the loops are longer than others, and I need some of those arcade games to be interactive at some point.

I haven't experienced any memory problems so far, but I don't want it to be a problem.

Maybe I'm just being too cautious, right?

Anyway, thanks again for being there @Crimson Wizard @Khris @eri0o @Rik Vargard  :-D

Rik_Vargard

You can make animated PNG sequences from just the animated parts (the videogame screens) and then place them accordingly in the room as an animated object.
In this case, you just need one background.

SMF spam blocked by CleanTalk