How to quit multiple actions.

  • #10, by afrlmeTuesday, 07. July 2015, 16:49 9 years ago
    local r = Scenes["VytahPanel"].SceneValues["speed"].Int
    local p = Scenes["VytahPanel"].SceneValues["space"].Int
    local act = Scenes["VytahPanel"].SceneActions[ p .. r ]
    
    startAction(action)
    

    ... if you are breaking a "string" to add data via a variable then the .. have to go at the beginning & end of the new data...
    local action = getObject("Scenes[VytahPanel].SceneActions[" .. p .. r .. "]")
    


    P.S: I do not recommend using certain / common words for variable names as some of them might already be exclusively linked to the VS engine or to the Lua language itself. action or Action, Text, Type, etc. etc.

    Imperator

    7278 Posts


  • #11, by ke4Tuesday, 07. July 2015, 17:06 9 years ago
    Oh.. yeah i didn't know how to do concatenation in lua so i just googled it something.

    Good point, i'll try to avoid those names for variables. Also i delete the whole line and used just:

    startAction("Scenes[VytahPanel].SceneActions[" .. p .. r .. "]")
    


    Thanks Lee!

    A few quick questions if you don't mind:

    Is it ok to use space in the names of scenes? eg "Scenes[Vytah Panel]

    I used ( with resuliton 1920x1080 ) way borders somewhere at Y 1150 because i need to hide character's feet. won't it cause problems?

    In all 63 actions there is a loop with Move object (closing and opening door) In the matter of optimization is this better than using animations?

    Key Killer

    810 Posts

  • #12, by afrlmeTuesday, 07. July 2015, 18:46 9 years ago
    1. sure but it's recommended (since the dinosaur ages) to close gaps with _underscores_and-dashes. It's something that used to be required (many many years ago) as a safety measure while coding websites & probably for some of the older script languages.

    2. Sorry, I don't understand what you are asking here.

    3. Again, don't understand. Is it some kind of sliding door? If it's a sliding door instead of the conventional door that swings open / closed, then sure it's better move the object sprite or better yet, create it as a single framed animation & move that instead with the to() tween function. The less images & animation frames you use the smoother / faster your game should run.

    I wrote an article in the wiki a few months back listing / detailing various methods for optimizing games for VS. This included: webp conversion. Using the tweening functions to move images / animations when possible instead of using pure animation. Creating multiple versions of the same animation with varying frame amounts, which could be played based on a setting in your menu that allows player to determine graphic / fx quality of game (good for low spec machines) & so on.

    http://wiki.visionaire-tracker.net/wiki/Game_Optimization

    Imperator

    7278 Posts

  • #13, by ke4Tuesday, 07. July 2015, 19:07 9 years ago
    I meant that the whole way area is out of the screen its 1920x1080
    so the edge of the screen is at pixel 1080, but the way borders for the area start at pixel 1150 and thus ouf of the screen.

    With the last thing i meant what's bigger "exhaustion" ( really can't find the word for it ) for the system. If you remember the "man on the ledge" scene i was making. There was a several move object actions ( background, the ledge + the fisheye effect and balance pointer and window animations ) and it's lagging... I'm sliding the doors with the move object action and it's already not completely smooth. So in this case i don't care how much the scene will have MB, but i need to make it run smoothly.

    In other words, what's faster? Calculate the move object or just play the animation? I already export everything in .webp and delete every odd frame from animations. i'll check the article for sure, because i need to optimalaze as much as possible. ( My PC is pretty weak )

    Key Killer

    810 Posts

  • #14, by afrlmeTuesday, 07. July 2015, 19:17 9 years ago
    sliding requires less cpu / memory than playing an animation. The fisheye effect for me seems to work, but returns an error to the log constantly. Shader stuff requires a fair bit of memory I think - especially the shaderEffects of which the fisheye effect could be classed under.

    If I remember correctly, you used some kind of animation or long winded method for setting up the mini-game, no? If I knew how you set it up fully, then maybe I could make some suggestions to make it run a bit smoother. It could just be that your machine isn't powerful enough to run everything on the scene all at once? 2D is a bigger memory hog than 3D, which is why 2D animation artists tend to use significantly less frames than in 3D animations.

    As for your way border question: no, it's not an issue. I extend way borders outside of the background a lot of the time - so character can walk through doors etc & out of the scene or for hiding character behind an entrance in the next scene & so on.

    Imperator

    7278 Posts

  • #15, by ke4Tuesday, 07. July 2015, 19:28 9 years ago
    That's good then, i never did it before but it's actually really useful to extend the borders.

    The thing is that i love mini-games, so there are many of them in the game grin

    The ledge: You need to keep the balance and every 5 seconds you do a step forward.

    1 Layer: Background
    2 Layer: The ledge
    The layers are moving by move object ( 2 layers for parallax )
    Balance pointer which is constantly updated ( it changes first/last frame on key input and it's animation loop )
    And window animation ( can't be moved by visionaire, it changes perspetive, it plays after each 5 seconds 20 frames animation )
    And the fisheye... ( which is pretty cool!)

    Key Killer

    810 Posts

  • #16, by ke4Thursday, 09. July 2015, 15:50 9 years ago
    Do you think that there is something to do to make it run faster?

    Key Killer

    810 Posts

  • #17, by afrlmeThursday, 09. July 2015, 16:12 9 years ago
    I would replace the animated balance bar thing for a single animation frame & use Lua to plot width of bar to a percentage & then position the marker based on the percentage.

    Convert all images to webP quality setting 10 if you haven't already done so.

    Make fisheye effect optional. Lower end machines don't seem to like openGL shader too much. My last laptop had various issues trying to run some test effects I was sent before VS 4 came out.

    If the window animation is quite large (I mean the image size & file size per frame) then consider removing a few frames if possible. Can always make an animation look smoother with less frames by entering manual delay values for each frame.

    Imperator

    7278 Posts

  • #18, by ke4Thursday, 09. July 2015, 17:58 9 years ago
    Yeah okay thanks, all sounds promising & already converted all to .webp :-)
    I'll see how that balance thing..sounds more complicated. In this time it's 150 frames, first at the start, last at the end of the progress bar. It's easy to control the whole thing like that, because i only show the frame of a int value which gets -1 on left arrow and +1 on the right. Each frame has about 8 kb.

    Key Killer

    810 Posts

  • #19, by afrlmeThursday, 09. July 2015, 18:49 9 years ago
    The thing with the percentage method is that once you've written the function for calculating the position based on the percentage it's a simple as calling that function & including a value &/or a boolean state to determine if it should move to the left or right.

    Imperator

    7278 Posts

  • #20, by ke4Thursday, 09. July 2015, 20:26 9 years ago
    I'll look into that, atleast i can try & eventually i can just use what i've already done.

    Can you please just shortly explaine what do you mean by percentage position?

    Key Killer

    810 Posts