Is there a problem with using a Rule for "attribute self.image"?

POMPOM Member Posts: 2,599
edited May 2014 in Working with GS (Mac)

Hey guys,

Im renewing one of my project, and I'm noticing that some of my rules are breaking..
While trying to investigate why is this happening, I think I've found 2 things.

1) if your actor currently have an image called e.g "3.png".
and you have an animation rule that animates for example - "1.png , 2.png , 3.png"
and below this animation rule you have a rule with the following condition:

when attribute self.image contains 3 .. DO something ("at the end of the animation").

Unlike older versions of GS when the animation will fire and the rule below it will not fire until the end,
seems now that the animation has a small (even 1 single frame) delay, so the rule below it fires before the animation even starts.

2) generally processes that rely on an animation and the rule

when attribute self.image contains "a string" .. DO something

Seems to break often..

Any insight on this? did anyone had this kind of problems too?

Roy.

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @POM said:
    1) if your actor currently have an image called e.g "3.png".
    and you have an animation rule that animates for example - "1.png , 2.png , 3.png"
    and below this animation rule you have a rule with the following condition:

    when attribute self.image contains 3 .. DO something ("at the end of the animation").

    Unlike older versions of GS when the animation will fire and the rule below it will not fire until the end, seems now that the animation has a small (even 1 single frame) delay, so the rule below it fires before the animation even starts.

    I'm finding the opposite, that using the same set up . . . . 3 image sequence + rule looking for frame 3 . . . that the rule never fires, even though it used to in previous versions of GameSalad !

    Basically it appears to be broken for me too, but in the opposite way !

    Personally I've given up on the animation behaviour, it's great that it now has working frame rates but it's so limited, no reverse button, no ping-pong loop, no attribute control over frame rate, limited frame rate ceiling . . . etc etc

    You may as well bake your own animation behaviours, I use:

    Constrain self.image to [floor( game.Time * A)%B]

    (A= frame rate / B = sequence length).

    It is much much more flexible than the animate behaviour, using it you can run sequences backwards, speed them up as they are playing, slow them down, you can have much higher frame rates than Animate is capable of - and rules that look for a particular frame to trigger an event work as they have always worked (just tested your 3 frame > trigger rule - and while it is now broken in Animate, the [floor( game.Time * A)%B] still works just fine).

    https://forums.gamesalad.com/discussion/63454/fast-frame-swap/p1

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @socks how do you address the particular images to animate?

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271
    edited May 2014

    @The_Gamesalad_Guru said:
    socks how do you address the particular images to animate?

    I'm sure you could add the prefix at the beginning on the expression to identify the pictures you want to grab. Something like this :

    "Animate"..floor( game.Time * A)%B

    Or something a long the lines of that

  • SocksSocks London, UK.Member Posts: 12,822

    Interestingly with the animate behaviour . . . it never gets to (displays) image 3 !?

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @The_Gamesalad_Guru said:
    socks how do you address the particular images to animate?

    This . . .

    Constrain self.image to . . . . floor( game.Time * A)%B

    . . . just generates a number, so stick whatever you need before or/and after it, I often just use numbered sequences - so basically an image sequence that reads 1, 2, 3, 4, 5, etc . . . but if you have something like this:

    CarExplosion001.png

    CarExplosion002.png

    CarExplosion003.png

    CarExplosion004.png

    CarExplosion005.png

    The you'd want . . .

    Constrain self.image to . . . . "CarExplosion00"..floor( game.Time * A)%B

    . . . . .

    EDIT, Braydon_SFX beat me to it, basically what he said too.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271

    @Socks -- Yeah, I'm waiting for the "agree" from you. ;)

  • SocksSocks London, UK.Member Posts: 12,822

    @Braydon_SFX said:
    Socks -- Yeah, I'm waiting for the "agree" from you. ;)

    Damn, god knows I've pressed that button, but it just won't work, I suspect it's broken.

    :p

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    Here, look . . . animate never gets to frame 3 . . . not 100% sure what is going on, the problem seems a little inconsistent ?

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271
    edited May 2014
  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @Braydon_SFX said:

    Look, you can even see me trying to press the agree button, must be jammed or something.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271

    @Socks said: Look, you can even see me trying to press the agree button, must be jammed or something.

    Okay, I have to admit, that was pretty good. :P
    I'm almost tempted to give you an "awesome" but I'm not that easily moved.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Thanx guys I may switch to that method as it gives more control over the rate.

  • POMPOM Member Posts: 2,599
    edited May 2014

    @Socks lets play "Spot the Difference"

    try that again mate :)

    Roy.

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @POM said:
    Socks lets play "Spot the Difference"

    try that again mate :)

    Roy.

    Just wrote a long post explaining how I think you're mistaken . . . but I suspect I've just made some basic error somewhere, I'll take another look.

    . . . . . . . .

    EDIT: Yep, a basic error on my part, I had 0, 1 and 2 as my animation frames, rather than 1, 2 and 3 . . . whoops!

    But anyhow, I'd still say floor( game.Time * A)%B is the way to go with animated sequences, it's simply far more flexible and a lot more robust being based on the game's clock, it never suffered from the weird frame rates of previous versions of the animate behaviour and doesn't suffer from this new issue where rules reliant on recognising the current frame don't fire or fire too early.

  • POMPOM Member Posts: 2,599
    edited May 2014

    @Socks said:
    But anyhow, I'd still say floor( game.Time * A)%B is the way to go with animated sequences, it's simply far more flexible and a lot more robust being based on the game's clock, it never suffered from the weird frame rates of previous versions of the animate behaviour and doesn't suffer from this new issue where rules reliant on recognising the current frame don't fire or fire too early.

    I wish I could do this, but most of my animations are not named properly..
    I have animations that looks like "hero1.png , hero7.png , hero 32.png , blank.png",
    Thats why I can't use this.. I can however, make a table with frameNames and the index counting will be the row/column number.. but I have so many!
    I think ill suggest @Manto1 for making such a tool (he is extremely talented):

    A tool that replace any animation behaviour with
    Constrain self.image to

    tableCellValue(theAnimationsTable, theRowOfTheAnimation , [floor( game.Time * A)%B])

    (A= frame rate / B = sequence length).

    where table is - theAnimationsTable

    row is - just a new row for the animation (the row name may be
    " (actor's name) , the string of the animation rule "

    column is - the frames, where frame 1 is in column 1 , frame 2 is in column 2 etc...

    Help me out here guys english is not my native..

    Roy.

  • MantoManto Member Posts: 796
    edited May 2014

    @POM‌ One way I can think of would be to create a table for each animation. That way theRowOfTheAnimation part won't be needed and it's easier to have animations that have different number of frames. So, the program would scan through all actors and create tables based on the animation behavior images, get frame rate (A) and the length (B) as well. This way it could be totally automated process.

    But it comes down to one question, will it be useful for you if they are in separate tables? Is it too hard to manage? I checked that tables are ordered alphabetically, so there could be a prefix (i.e. ZZZ) to put all animation tables on the bottom of the list.

  • POMPOM Member Posts: 2,599
    edited May 2014

    Sounds good actually..
    I'm happy to see you are interested in this!
    I hope GS can handle that many tables, after all, games has houndreds of animations..
    I think it worth a try, it might solve many animation related bugs for users, and also it will act with the desired frame rate..

    I'm tying of think of a way to automate the "loop" check box..
    Any suggestion is appreciated.. My thoughts are..
    If the "loop" check box is OFF, then add A rule that is wrapping the constrain that says
    When self.image Is not "the last image name in the sequence"
    Then constrain..

    And if "loop" is on, then simply do the constrain..

    Another possible addition is to check if the "restore actor image" is ON, this is relevant only when the "loop" is OFF
    So if "restore" is ON and "loop" is OFF, the you can add the actor's original image, as the last image in the sequence..

    And yes a prefix like -"animate" could be helpful, but also building the name of the table appropriately is important for maintanace, so the actor's name should be there too..

    Roy.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @POM, just have two tables, the first in which each animation sequence is stored in its own column, the second containing the setting.

  • SocksSocks London, UK.Member Posts: 12,822

    @POM said:
    I can however, make a table with frameNames and the index counting will be the row/column number..

    Nice idea, that should work just fine !

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @POM said:
    I'm tying of think of a way to automate the "loop" check box..
    Any suggestion is appreciated..

    I'm not sure what you mean by 'automate' in this context, but this is how I differentiate sequences I want to loop or just play once:

    Loop:

    Constrain self.image to floor( game.Time *30)%21

    Play Once:

    Rule: When self.image contains [last image in your sequence]

    Empty (leave rule blank)

    Otherwise: Constrain self.image to floor( game.Time *30)

    Example: https://www.mediafire.com/?bw7c5tr81ywb0d8

  • POMPOM Member Posts: 2,599

    @Hopscotch
    Agree, that's a good idea, putting all the info into 2 tables, one for the sequences and one for the settings..

    @Socks‌
    Socks by automate I mean that the converter that @Manto1 will make (if he'll make one) will add those rules automatically to handle "loop" and "play once"

    Roy.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    I was thinking a table loop would be easier too.

  • POMPOM Member Posts: 2,599

    Dave can you control the animation speed with table loop?!

    Roy.

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited May 2014

    Edited since values have changed since 10.4!
    ...

    Use a combination of @Socks' formula and Tables.

    The "Loop over Table" behaviour cycles at a constant speed, once per frame draw and can not be used to control the FPS of the animation.

  • Catnip StudioCatnip Studio Member, PRO Posts: 2

    I actually have a frustrating situation.

    I'm making a game attribute - a boolean - which turns on at the beginning of an animation. At the end frame of the animation, I tell the game to basically switch the boolean rule back to false. This works perfectly how I like it except for one thing - This ignores you and won't follow through if the value of the frame is 10 or above. I played with it enough that I discovered this- The most you can work off of is frame 9 of an animation.

    Maybe this is something that can be changed in the future.

  • SocksSocks London, UK.Member Posts: 12,822

    @Catnip Studio said:
    I actually have a frustrating situation.

    I'm making a game attribute - a boolean - which turns on at the beginning of an animation. At the end frame of the animation, I tell the game to basically switch the boolean rule back to false. This works perfectly how I like it except for one thing - This ignores you and won't follow through if the value of the frame is 10 or above. I played with it enough that I discovered this- The most you can work off of is frame 9 of an animation.

    Maybe this is something that can be changed in the future.

    This idea should work fine, can you post a screen grab of your rules ?

Sign In or Register to comment.