createAnimation()?

  • #1, by rhavin grobertTuesday, 07. November 2017, 23:20 7 years ago

    There is
    createSprite("vispath:file.ext")


    Is there also a createAnimation(), so one could dynamically create an animation…?

    Newbie

    47 Posts


  • #2, by afrlmeWednesday, 08. November 2017, 00:19 7 years ago
    Don't think so & that feature is relatively new to the engine. Does it work? So many new features I've not gotten around to testing yet...

    Imperator

    7285 Posts

  • #3, by rhavin grobertWednesday, 08. November 2017, 06:39 7 years ago
    Dont know, just found it. But as an animation in the xml-file is just something like
    ‹Animation name="tunnel0a" id="51" order="0" lastModified="1" AnimationLoopRandom="F" AnimationNumberOfLoops="0" AnimationPause="20" AnimationDirection="-1" AnimationMove="F" AnimationUseIndividualPause="F" AnimationReplay="0" AnimationModelAnimIndex="-1" AnimationModelAnimSpeed="-1" AnimationModelFile="" AnimationModelName="" AnimationEndDirection="-1"›
       ‹AnimationPosition x="0" y="0"/›
       ‹AnimationAction parentLink="F" id="-1" tableId="-1" LinkAny="F"/›
       ‹AnimationSprites›
        ‹sprite name="" pause="0" path="Kulissen/UBahn/Tunnel0.jpg" Transparency="2"›
         ‹position x="0" y="0"/›
        ‹/sprite›
       ‹/AnimationSprites›
       ‹AnimationMirror parentLink="F" id="-1" tableId="-1" LinkAny="F"/›
       ‹AnimationCenter x="0" y="0"/›
       ‹AnimationPropertyFrames›
       ‹/AnimationPropertyFrames›
       ‹AnimationWalkSteps›
       ‹/AnimationWalkSteps›
       ‹AnimationPauses›
       ‹/AnimationPauses›
      ‹/Animation› 

    …all a createAnimation() would have to do would be provide reasonable default values, copy from a given table and call whatever is called when parsing the xml-files animation-tag.
    (Yes, I know, telling someone how easy something would be without knowing the abysses of  the sourcecode is EVIL™ smile
    For example:
    local myAni = game.CurrentScene:createAnimation({
      name="tunnel0a", createSprite("Kulissen/UBahn/Tunnel0.jpg")
    })

    BTW, i'd really like to know where the implementation benefit is of repeating the tag-name in the tags attribute name. Doing that constantly would lead to:
    AnimationModelFileSpritesSpritePosition= {
      AnimationModelFileSpritesSpritePositionX = 5
      AnimationModelFileSpritesSpritePositionY = 8
    }
    --  XD
    

    Newbie

    47 Posts

  • #4, by sebastianWednesday, 08. November 2017, 12:14 7 years ago
    since RC2 there is a duplicate function for objects. May useful to duplicate, change its animation parameters and create a new one out of it...

    Thread Captain

    2346 Posts

  • #5, by afrlmeWednesday, 08. November 2017, 12:49 7 years ago
    Half of the stuff in VS is probably from back when Alex created the first version of the editor around 10+ years ago & because Thomas wants each & every update/new .x version to be back compatible it means that a lot of the old systems still remain. Why, is & what is something I can't answer.

    Who could be arsed to create an animation out of code really? Could you imagine having to link in each frame inside of a table. Too much hassle. I understand duplicating & destroying objects though & it's a very useful feature to have. GameMaker Studio handles create & destroy elements really well as the code is directly self contained inside of each object which makes it really easy to generate a bunch of enemies & other things which all contain dynamically set parameters thanks to being able use random math to determine speed, power, rotation, skin & so on. I'm betting it would be possible to do something similar in VS, well... if self is a valid target; & I'm not talking about some function hackaround version of self. I'm talking about returning the parent object/name because each animation/object needs to have a unique name to be accessed. If that's possible then mini-games like Space Invaders & other things could probably be created with VS.

    Imperator

    7285 Posts

  • #6, by rhavin grobertWednesday, 08. November 2017, 13:33 7 years ago
    No offense meant, but what some call a hassle is a walk in the park for orherswink

    In my case, creating the animation out of code is the better to maintain and simplier to set-up way to do it.

    Newbie

    47 Posts

  • #7, by afrlmeWednesday, 08. November 2017, 15:18 7 years ago
    No offense meant, but what some call a hassle is a walk in the park for orherswink

    In my case, creating the animation out of code is the better to maintain and simplier to set-up way to do it.
    I don't see how it wouldn't be a hassle. If I want to add in an animation inside of the editor, I simply create one, specify the loop & delay values, then click on the import animation button to import all of the animations with the same name & a prefix number attached to them.

    You are forgetting that you can also assign sounds & action parts/scripts to each individual animation frame as well as custom pause values for each frame & offset values & the direction the animation should play & whether or not it should play in order or randomly or have a random loop value between each loop (good for environment animations such as bird flying across the screen every so often, etc). So many things to declare for animations. It's overkill nonsense & like I said, Lua is not the fastest scripting/programming language out there & I'm not talking about the time it takes you to write a script but the time it takes to read & iterate through scripts.

    While I like the fact that you are willing to script, I really don't recommend using it for everything as it will eating into system resources & RAM which would be better utilized for the already heavy 2D animations. 2D games can easily become much more system hungry than 3D; especially with full hd plus games & large animations.

    Imperator

    7285 Posts

  • #8, by rhavin grobertWednesday, 08. November 2017, 19:49 7 years ago
    Lua does not do the animation, it just sets it up. In my case, the animation consists of actual 5 syncronized animations that I need in about 10 scenes. Id be mad if I really set up 50 single animations instrad of calling one well written script from every scene. In the end, it will be a oneliner per scene.

    Newbie

    47 Posts

  • #9, by afrlmeWednesday, 08. November 2017, 21:08 7 years ago
    You can copy/paste scene objects, animations & scenes in general you know. There's even a duplicate button floating about on the editor toolbar.

    Imperator

    7285 Posts

  • #10, by rhavin grobertWednesday, 08. November 2017, 22:09 7 years ago
    And then? When I decide after 2 weeks I want some detail different in the animation-sequence? Shall I edit all scenes again? What for? Developing with computers is about letting the computer do the computer-stuff.

    What you describe is for me just a maintainance-hell. If you have to do something just once, do it. If you have to do it twice, be fine with it. But if you have to do it more then trice, automate the process of doing it before you do it, because you might do it even more often then you initially thought.

    I started coding 30 years ago, that mantra has never been the wrong choice.

    Newbie

    47 Posts

  • #11, by afrlmeWednesday, 08. November 2017, 23:41 7 years ago
    You're talking about a Finite State Machine yes?

    Visionaire is kind of rigid - as is Lua script - when it comes to flexibility. It's a game engine specifially designed for creating point & click games aimed at artists, animators & people with little to no program knowledge. All I'm trying to say, is don't get your hopes up for creating some elaborate system out of scripts/functions as it might not be possible. Lua is certainly nowhere near as flexible as C++, C#, Java or Python for that matter.

    I'm a big fan of working outside of the limitations myself, but sometimes you have to give up the Ghost & just work with what is available/possible.

    What you are asking for is a function that probably only you would use which means that the current sole active developer of VS would basically be using up a bunch of his own time just to write & debug a function specifically just so you can save a bit of time. Did you know scripting wasn't even introduced into Visionaire until one of the updates of Visionaire 3? We're talking a while back - before I joined back in 2011 or 2012 - all people had to work with were the premade action parts & built in systems & even back then people still managed to develop & release games just fine with the engine - see Daedalic for example.

    Imperator

    7285 Posts