(moved to bugtracker) Animating a disabled object

Started by Radiant, Tue 08/10/2013 14:00:41

Previous topic - Next topic

Radiant

The following causes AGS to hang:

ObjectOff     (1);
SetObjectView (1, 10);
AnimateObject (1, 5, 6, 0);
while (IsObjectAnimating (1)) Wait (1);

Simply put, if an object is set to animate but it's off, then (1) the animation never proceeds, but (2) IsObjectAnimating returns true. I'm not sure if this counts as a bug, but I think it should at least generate a warning in the logfile that you're trying to animate an object that's not on. Thoughts please?

http://www.adventuregamestudio.co.uk/forums/index.php?issue=509.0

Crimson Wizard

#1
EDIT: whoops, disregard this, I confused this with newer function.

Yes, I can confirm this: if object is not visible it simply does not update animation, yet allows to set up one.


//----------------------------------------------------------------

Not sure how to solve this.
Changing any behavior here will break backwards compatibility. While issuing a warning don't seem to be a very good solution, because on some occasions user may want to apply animation to invisible object, then show it after some delay, and this is perfectly valid sequence, IMO (for example, animation could be set in a separate script function with generic behavior, which does not care if object is shown or not).

monkey0506

While the scenario you're laying out sounds like it could have a real-world application, I'm skeptical that any published games have actually done that. And even if they have, it is not an intentional, documented feature. Breaking backwards compatibility in some edge cases (like this one!) are going to be impossible to avoid moving forward. I say document the change, break the backwards compatibility for this pseudo-feature, and implement the fix.

Crimson Wizard

Hmm, well, I can add a fork in code (if game version >= 3.3.0, then...)
The question is, what's the proper behavior? In my personal opinion, animation sequence is not directly bound with object visibility. I.e.: you could start animation and then show/hide object repeatedly for the sake of achieving some effect (something that AGS does not seem to allow right now?).

Radiant

I'm pretty sure existing games don't do this, because it would cause the game to hang :)

Expected behavior for me would be to keep the animation going even though the object is not visible. After all, animations don't stop either if I set an object's transparency to 100%, or if I place it behind some other object.

Crimson Wizard

Quote from: Radiant on Wed 09/10/2013 09:25:13
I'm pretty sure existing games don't do this, because it would cause the game to hang :)
I mean - they could run animation prior to enabling object. That does not make games to hang per se (only checking IsAnimating in the loop when object is disabled does).

monkey0506

I agree with Radiant though. An object's visibility should not be directly tied to whether or not it can have its frames changed (which is all "Animate" does, swapping out the frames on a timer). An object not being "visible" shouldn't be the same as the object being considered "not enabled".

Gilbert

Well, this same question was asked by the same person at almost exactly 9 years ago but then it got forgotten.

Don't get me wrong, as I actually do want animations and stuff to continue working even when the entity is invisible, as the current behaviour made what I was trying to do at that time complicated to implement(as shown in my reply a few posts below). Maybe we can reconsider this niw.

monkey0506

Well technically, what CJ said is right. It should still return that it's animating. The actual animation just shouldn't be paused because it isn't visible. :P The behavior of IsObjectAnimating is correct, it's the lack of updating the current frame that's the bug.

SMF spam blocked by CleanTalk