Vizzy is a visual programming system that you can use to automate your craft to execute a wide variety of flight-oriented tasks. The easiest way to get started is to check the stock programs by going to Load Program in the game or watch the tutorial video here:

Programs

You can create a program for your craft by opening the menu and clicking EDIT PROGRAM. This will attach the program to your craft's primary command pod however, you can attach programs to any part in your craft. This can be done by clicking on a part and then opening the Tinker Panel and clicking the "Add Flight Program" button.

Instructions

Instructions have square corners and are connected in a sequence. They are executed one after another and many have slots where you can type in parameters or where you can drop expression blocks.

Expressions

Expressions return a value. Expressions with angled edges return a boolean (true or false) and expressions with curved corners return a string, number, vector, or list. An expression is only evaluated when it is inside the parameter slot of an instruction that is executing.

If an expression returns a value of a type that does not match the expected type of the parameter slot it is in, then the value will be automatically converted to the correct type. If Vizzy cannot figure out how to convert a value, it will use a default value. For example, if an expression returns a string and the parameter slot is expecting a number, then the string will be converted to a number. If the string cannot be converted to a number, then a default value of 0 will be used.

Events

Events are orange blocks that initiate execution at the appropriate time and are the starting point for a series of instructions. The most common event is the On Start event, which is where programs typically start.

Variables

Variables allow you to store a value that can be retrieved and processed later.

Custom Instructions and Expressions

You can create your own instructions and expressions in Vizzy. This is very similar to writing functions in other programming languages.

Program Execution

When a program starts, it checks to see if there are any On Start event blocks in the program and if there are it will create a new (artificial) thread to start executing the attached instructions, one at a time. Before executing an instruction, it will first evaluate all expression blocks inserted into the parameter slots of the instruction to determine the values to be used to execute the instruction.

If the craft encounters another event that has a corresponding event block in the program then it will create a new thread to execute the instructions attached to that event block. A program can have multiple threads running at once, however these threads are not true background threads and they all run on the game's main thread. To simulate simultaneous execution of threads, the game will alternate between threads each game frame. The program will execute at most 25 instructions per game frame. This number can be configured by XML-modifying the FlightProgram modifier's maxInstructionsPerFrame attribute. There is no limit to the number of expressions that can be evaluated in a single frame.

It is advised to place a Wait 0 Seconds at the end of loops as it is often a good place for a thread to pause execution for that game frame and give a chance to other threads in the program to execute.

Funk

The new FUNK expression was introduced in version 0.9.700. It parses and evaluates a text-based expression and returns the result as a number. There are several properties that are accessible from the FUNK expression, you can find more information about the FUNK expression here.


Comments

  • Log in to leave a comment
  • Profile image
    100 SDNS

    Is it possible to make accurate ballistic missiles with this program?

    +4 2 months ago
  • Profile image

    Need help with toggle switches...So, idk if its possible or not, but I am trying to find out if I can use a toggle switch to control lighting WITHOUT the toggle switch being attached to an AG. Am I mistaken? Or is this not really possible??
    I am a mobile player and I'm trying to free up as much screen space as possible so I can more easily control my craft without constantly having to release the joystick to turn the AG menu on, select or deselect the desired AG, and close the AG menu before being able to regain control over the joystick (roll/pitch)

    4 months ago
  • Profile image
    0 abed51

    Please can anyone tell me the proper tutorial source to learn Vizzy programming. I never used Scratch. But i am pretty much familiar with C, C++. I can understand some of Vizzy block. But without basic Block, most of the block are like came from Framework. Is there any source to learn all this, and how to apply those?

    +2 7 months ago
  • Profile image

    Got a question.
    Once i activate a vizzy, it works,but when i try it again it doesn't.
    Pls help me. This is engine related. And done on a (multi functional screen)-(or something). Also i am on mobile. But vizzy is still the same in both places.

    +4 11 months ago
  • Profile image
    134 mreed2

    To close the loop on this question:

    The answer to the question "Can this be done?" is "No, it isn't possible to access the properties of a part via FUNK if the only thing that you have is its part ID, and there is no other way to access the maximum or current thrust of a single engine via Vizzy, with a few caveats".

    If the part has a unique name, and that name contains no spaces, then you can access the properties of that part via Funk using the syntax "<part_name>", a period, and then one of the entries found on this page: https://wnp78.github.io/JunoXml/PartModifierScriptProperties

    So, "MageEngine.RocketEngine.MaximumThrust" works, as long as there is only one engine on the craft named "MageEngine". If there are two, it will still work, but it'll only return data on one (likely the one that was placed first, but I didn't ask). If the part name contains spaces it can't be accessed via this method at all.

    If there is only one engine on a stage, then you can access information about the engine via the GUI controls (Expressions / Performance). In addition, current stage performance data can be access via FUNK (via "FlightData.*").

    To address my use case (detecting burn out when using parallel staging), it was pointed out that an engine that has no fuel no longer contributes to FlightData.MaxActiveEngineThrustUnscaled, so if this number drops then it is safe to assume that some engines have burned out. While this is less than an ideal solution (you can't detect when SRB's start to tail-off using this method, although you could monitor FlightData.CurrentEngineThrustUnscaled, but then you have to worry about throttling of liquid fueled engines...) it is what it is.

    +3 1.2 years ago
  • Profile image
    134 mreed2

    As you wish, I'll post this question to Discord. Given that nobody has shared a rocket that uses this functionality, I don't have much hope of getting help, but I'll post it.

    +1 1.2 years ago
  • Profile image
    134 mreed2

    Now that I'm back at my desktop, I can try your suggestion:

    0.FlightProgram.Tmp = Mage_Engine.2.RocketEngine.MaximumThrust

    returns a syntax error.

    v:Tmp = Mage_Engine.2.RocketEngine.MaximumThrust

    Doesn't produce an error, but it also doesn't set Tmp to anything (Tmp retains the same value as before the funk statement).

    v:Tmp = *.2.RocketEngine.MaximumThrust

    Returns the error "Unary operator not supported: Multiply".

    I re-iterate that it appears to me (as a developer myself) that a prefix (like "p:") is required to access the parts search functionality. That's based on the fact that the parser is interpreting "*." as an attempt to multiply, and it shouldn't (given the syntax given described in the linked webpage).

    +2 1.2 years ago
  • Profile image
    Dev Pedro

    @mreed2 these comments are not the best place for feedback and help, I strongly recommend joining the JCS discord server, there is a channel dedicated to Vizzy and Funk. Here is a list of various discord servers, JCS is the first

    1.2 years ago
  • Profile image
    134 mreed2

    I'm not trying to set anything, at least not as part of the funk expression. The funk expression in the programming environment returns a value, right? I've seen lots of examples of people, for example using something like this (with far more complex expression)

    Set variable MyVar to funk(join("cosh(", OtherVar, ")")

    I want to do the same thing, except I want to set MyVar to the maximum thrust of the engine with an ID #2.

    At this point, I'm getting the impression that this impossible. If that's the case, I guess that's that. But it seems an very odd and arbitrary limitation.

    To clarify: I'm asking for you to confirm that this statement is true: "It is not possible to set a variable in the graphical programming environment to the maximum thrust of a single arbitrary engine (identified by its unique part ID)"

    Or to provide an example of the a statement that performs this task (assuming the engine is named "Mage Engine", the ID is "2", and the variable is "MyVar").

    Edited to add: Sorry for the double post -- the website retains the text of a new post after submission.

    +1 1.2 years ago
  • Profile image
    Dev Pedro

    @mreed2 the documentation clearly says, as you stated, get, not set. To set things you have to pass the variable to the input controllers using [PartRunningTheProgram].FlightProgram.[VariableName]

    1.2 years ago
  • Profile image
    134 mreed2

    The web page you listed is... Well, it appears to be outright wrong.

    At the bottom of the page, it says: "How awesome! Then it gets even more complex. You can get parameters from different parts in the crafts using the following format: [PartSelector].ModifierSelector[.Data][.PropertySelector].

    Ok, so I can write a Vizzy program, use the FUNK operator to set a variable to "Mage Engine.2.RocketEngine.MaximumThrust"? Nope, that's a syntax error.

    How about "*.2.RocketEngine.MaximumThrust"? Nope, still a syntax error.

    How about "Mage.2.RocketEngine.MaximumThrust"? Hey, that returns a 0, that's progress, right?

    Well... How about "sdkdk.2.RocketEngine.MaximumThrust"? That also returns a 0, so no go.

    How about ".2.RocketEngine.MaximumThrust"? Back to a syntax error.

    Well, maybe if I rename the engine to "MageEngine"? Nope, "MageEngine.2.RocketEngine.MaximumThrust" returns a 0. So does "abs(Mage_Engine.2.RocketEngine.MaximumThrust)"

    And yes, I've verified by looking at the XML file that the part with ID="2" is, indeed, a Mage Engine, named originally "Mage Engine" and then later changed to "Mage_Engine".

    The syntax given on the web page is obviously completely incorrect. I suspect that a prefix is required (like with "v:" to access variables) is required, but not mentioned on the web page.

    Help?

    For context: I'm trying to iterate over all the parts on the craft, find the active engines, and check their thrust levels (current / maximum) to determine which engines are producing the expected amount of thrust and which ones are not. When some / all of the engines aren't producing the expected amount of thrust I'll trigger a staging event. The goal is to support automatic staging when you one engine that is active over multiple stages (for example, a space shuttle). There are probably other ways to do it, but... This way should work.

    +1 1.2 years ago
  • Profile image
    Dev Pedro

    @flight2023 thanks for the reminder! It should be fixed now

    1.2 years ago
  • Profile image

    why ? https://wnp78.github.io/Sr2Xml/
    There isn't a GitHub Pages site here.

    1.2 years ago
  • Profile image

    Idk@Divoulos

    1.6 years ago
  • Profile image

    How do you make it to repeat commands indefinitely?

    +2 1.6 years ago
  • Profile image

    Do you know how?

    +1 1.7 years ago
  • Profile image

    Anyone know how to make it where you enable a activation stage it enables code for the vizzy?

    +1 1.7 years ago
  • Profile image
    559 N1ghtH4wk

    how to use the "if" program in vizzy

    +1 2.2 years ago
  • Profile image

    @ghk25012426 what?

    2.3 years ago
  • Profile image

    @DareDevilSpaceAgency

    2.3 years ago
  • Profile image

    TimeWarp doens't work

    +1 2.5 years ago
  • Profile image
    75 getrice

    @KellyNyanbinary No worries! Thank you so much!

    2.6 years ago
  • Profile image

    It’s somewhere in appdata. I forgot. Sorry @getrice

    2.6 years ago
  • Profile image
    75 getrice

    @KellyNyanbinary Thank you! One last thing, where would I find the craft file in the directory?

    2.6 years ago
  • Profile image

    You can view it in the craft XML file but it’s formatted horribly @getrice

    2.6 years ago
  • Log in to see more comments

45 Upvotes

Log in in to upvote this post.
0 MAxoid
726 MercerAerospace
21.0k Rafaele
4,711 MisatoKatsuragi
Mod SupremeDorian
5,184 Thebapi
1,159 YaMomzBox420
15.5k Hylo
4,792 DragonTech
7,441 Hannah1212
1,092 PointBreak
13.7k Vedhaspace
22.6k Rizkyman
129 Remedy31
14.4k ChuckNotChunk
Mod InfinityTechnology
7,793 SmurfResearchX
7,034 AQUILA
600 Kleesmilie
358 zeropol
8,399 General98Ishaan
51.8k DASX
6,816 Yoon
157 AxeAerospace
1,576 DARO
723 Ardee
345 Astrospace
13.6k FalconAero
Dev Pedro
2,610 Brixxter
1,326 CaveatEmperor
3,823 GrizzlitnCFSP
244 analyzer1
30 orangePHdeaf
15 SpaceISRO
15 wpppwpqp
246 Veny
1,024 ZATG
0 ZimpelRaum
15 Spiritsoul
1,682 TomKerbal
15 Amishman