Hintergrund Z-index / Scene-Dimensions

  • #20, by sebastianMonday, 06. November 2017, 00:47 3 years ago
    could also be this: 

    ActiveAnimations[t].AnimationCurrentPosition = {x=something, y=something} 


    its late. going to bed now. 

    Thread Captain

    2340 Posts

  • #21, by rhavin grobertMonday, 06. November 2017, 00:55 3 years ago

    Did the trick. I hope someone is currently updating the documentation.


    47 Posts

  • #22, by afrlmeMonday, 06. November 2017, 01:06 3 years ago
    It's ActiveAnimations["name of animation"].AnimationCurrentPosition = {x = 500, y = 500}

    I have no idea what you are doing or why you are making it more complicated than it needs to be. The to() function is a tweening function. You can transition/fade between current value & a target value over a specified amount of time with it. The delay value & easing is optional. The data structure fields you want to modify with it need to be number types (integer, float or point).

    You could have probably achieved whatever you are trying to do with a few lines of code without needing to type out a bunch of complicated tables & equations. I don't understand the logic behind your logic.


    6862 Posts

  • #23, by rhavin grobertMonday, 06. November 2017, 10:34 3 years ago
    You could have probably achieved whatever you are trying to do with a few lines of code without needing to type out a bunch of complicated tables & equations. I don't understand the logic behind your logic.

    What I want is:
    Tiled background that moves, consisting of 3 tiles alternating the first two and sometimes putting in the 3rd.

    Your free to optimize the code if you think you can do it less complicated, this is just my 3rd week in lua:



    47 Posts

  • #24, by afrlmeMonday, 06. November 2017, 13:57 3 years ago
    Ok I downloaded the ved & resource files you shared. Without going into anything to do with the script, here's a few things I noticed...

    1. you have set the default game resolution to 1920x1200 (why you've set it as that I don't know). 1920x1080 is the most common HD resolution & it has an aspect ratio of 16:9 which is the most common aspect ratio for monitors. 1920x1200 has an aspect ratio of 16:10 which tends to be used on wider monitors & is less common. I highly recommend using 1920x1080 if you are wanting to make a fullhd game.

    2. All scene backgrounds need to be the same size as the default game resolution or higher. Bearing in mind that scenes that contain backgrounds larger than the default game resolution will automatically become srollable scenes. The scene background you have used is 2220x800 which is fine width wise but is incorrect height wise seeing as you have specified 1920x1200 as your default game resolution.

    I'm just going to share this old nugget of information... learn to walk before you run mate. Why jump straight into the deep end with scripting if you haven't learned the basics of the editor yet? Also why are you using self in your script? I don't believe it's a very common thing to use in Lua script as Lua is more of an extension based scripting language rather than a true object oriented programming language. We just use it to allow people to push past the limitations enforced by the game engine.

    & to answer your other question: no, I'm not currently updating the documentation. The sctipting documentation is fine & it's not easy to document Lua shorthand because each table/field can be accessed in multiple ways. Simon on the other hand has been working on a Lua doc thing with examples of shorthand & various other things which can be found here.


    6862 Posts

  • #25, by rhavin grobertMonday, 06. November 2017, 14:44 3 years ago
    Most graphic files I created have resolutions four times the actual images posted here, so scaling everything to the platform used comes later, this is just coding tools.

    Of course I use an OO-approach everywhere. And Lua is ok for that. I'd prefer C++ or Java when it comes to classes, but the few things I already know abou lua is that:

    (quoting StackOverflow) "Lua is fully capable of prototype-based object-oriented programming similar to JavaScript."

    So why shoulnt I use a Leatherman over a club if I have one?

    That backgound class will be used in at least 10 different scenes, 6 for an underground railway train and at least 4 for the party going thru the tunnel, which will - unless the player has fulfilled certain quests - end him up walking to nowhere in an endless maze of random created scenes - which he can of course exit everywhere to just do somethin else first.

    I learn by certain tasks and I dont need to learn A before B and C unless they depend on A. In this scene, the task is:

    6 waggon train, moving reusable background consisting of 3 tiles in a certain pattern.

    The background is just an arbitrary black image. I still hope that someone would aknoledge the wiseness in making it possible to just specify the scene size without having a background, but it will be an easy workaroung to create one black file in the end, even though I find this highly useless knowing that there will be no single pixel of it on screen in the end.


    47 Posts

  • #26, by afrlmeMonday, 06. November 2017, 15:41 3 years ago
    A transparent png or webp file would also do the trick. The player background is black by default.

    Lua script while ok, is not the fastest scripting language out there which is why it's recommended you access data directly via the data structure fields. Direct paths instead of tons of variables/tables is better optimization wise.

    Lua script doesn't have a traditional class based approach, there's no need to define the class type beforehand like with other programming/scripting languages. If you create a variable you can overwrite it any time with different data regardless of the type of data it is.

    As for writing complicated scripts, there isn't anyone that does that better than Daedalic. I swear half the scripts they write are padded out just to make it look like the scripters job is more complicated than it is - not that you will get to see said scripts. I personally favor simplicity & compactness over bulkiness. The less lines, letters & numbers I have to type, the better.

    An example of over complicating it would be the version of the Deponia sliding interface script I shared on the wiki. It contains a lot of lines of code & it turns out Daedalic didn't even use scripting for their slide out interfaces, which I found really amusing. I wrote it before Simon implemented the to() tweening function. These days with the to() function I can create a sliding interface script with fallback measures with 5-10 lines of Lua script.

    What I want to know is, did you actually look at the editor for an in-editor solution first? There's actually 3 action parts you could have used. Two involve offsetting scene object positions & the third allows you to increment/decrement an animation by x pixels.

    Also, so you know. Animations are self contained loops. You can insert action parts &/or script into individual animation frames. So let's say for example that you have an animation that contains a single frame, is set to infinite loop & has a delay of 20ms. This means that any actions you specify inside of the animation frame will be executed once every 20ms. 16ms is the lowest value you can realistically use as 16.6/16.7ms approx. equals 60fps.

    The to() tween function would work just fine also. You would just have to use pause action parts & create a loop with the jump to x action part.

    My point is that there are so many different ways you can achieve the end goal with Visionaire Studio. There's not one set in stone method, which is one of the things I like about Visionaire Studio.

    Quick tip: regarding tiling, I highly recommend creating them the same width/height as the scene. That way you can just listen out for when the animation/image is -width total & then move it back to the right hand side of the scene.


    6862 Posts

  • #27, by rhavin grobertMonday, 06. November 2017, 15:49 3 years ago
    I'm not sure if I understand correctly what you mean. My goal was:

    - 3 tiles
    - One of them is the even tile (without colum)
    - The other one it the odd tile (with colum)
    - The third one is a special tile with a lit colum that should appear randomly so the background doesnt look lik a simple loop

    It will be dependent on the scene if the background is moving or static (train stopped or scene in the tunnel outside the train)

    So the programmer approach was: lets build a nice background class that I can reuse and tell it what should happen in the actual scene.

    How could I archive this with the editor?

    BTW, I think I choose jpeg bcause it was the smallest filesize in the end. Coming from AtariST-times, I still dont like to waste bytes grin 


    47 Posts

  • #28, by afrlmeMonday, 06. November 2017, 16:10 3 years ago
    jpg doesn't always display correctly with Visionaire Studio. Png is the recommended format for lossless. Webp for better optimization - even webp lossless is approx 1/3 to 50% smaller than png.

    I wasn't talking about your goal. I was talking about Lua script & the editor in general.


    6862 Posts

  • #29, by sebastianMonday, 06. November 2017, 17:10 3 years ago
    Its a great script for reusage in many scenarios. The object oriented approach is fine, but for VS and the current usecase maybe a bit "overkill". But you are right: why use a club if you have a leatherman...

    In case of reusage: keep in mind that the animation names need to be unique. When you use "tunnel0a" for example in more than one scene, the engine cant decide which one you mean. So maybe you should consider limiting the animations you want to start to the current scene.

    kind regards

    Thread Captain

    2340 Posts

Write post