Have you ever thought that the computing speed of Vizzy is wayyyyyyyyyyy toooooooo sloooooow? That Vizzy is so much worse than KOS at doing numerical integration? Actually, there is a way to circumvent this problem, that is, recursion.

Looking back, I've never really used recursion in any language before because a loop is almost always better, but this is not the case with Vizzy. If you know how Vizzy is executed, you'll know that the execution time is almost entirely dependent on the number of instructions. What this means is that if you squeeze as many calculations into one line of code, you'll end up with a higher efficiency than if you spread the calculations over multiple lines of code. However, it is usually impractical to just write everything into one line because it would make the code impossible to understand while only incrementing the efficiency marginally.

Now the situation is completely different with Iteration because putting an iteration into one line would not affect its readability at all. How do you put an Iteration into one line? By using custom expressions. With RECURSION.

It is possible in Vizzy to have up to 97 recurrences before stack overflow (very rarely 98 depending on the program) and remember, that is all done in the time of one line of code! This means that you could speed up your calculation by almost 100 times! I've completed a calculation that ran for 34 seconds with iteration loops in just 0.45 seconds using this method. With this speed, real-time small step integrations become very practical and I'm looking forward to seeing much more accurately guided crafts.

Or maybe more games written in Vizzy.

EDIT: I just discovered that you could change both maxCallStackSize and maxInstructionsPerFrame in xml which would make this whole post pointless. : (

If you want your program to run fast, just set a high value for maxInstructionsPerFrame.


15 Comments

  • Log in to leave a comment
  • Profile image
    5,713 Bori0

    @s5ehfr9
    Thank you for the help 😁

    3.8 years ago
  • Profile image
    8,457 s5ehfr9

    @Ker0 Just find <FlightProgram/> and add maxInstructionsPerFrame='1000' between 'FlightProgram' and '/'

    +1 3.8 years ago
  • Profile image
    5,713 Bori0

    @s5ehfr9
    I'm on mobile & I really don't know where to edit that. But thanks anyway.

    3.8 years ago
  • Profile image
    8,457 s5ehfr9

    @Ker0 it is a property of FlightProgram and it should work if you add it there. If you are using overload mod, you should have it already there.

    +1 3.8 years ago
  • Profile image
    5,713 Bori0

    @s5ehfr9
    Alright, so I was looking at the game XML files(game files, user files, crafts files)
    And I didn't find maxInstructionsPerFrame using a search tool anywhere.
    If you could help me on where it might be. That'll be fine by me.
    Thanks & sorry for the bother.

    3.8 years ago
  • Profile image
    8,457 s5ehfr9

    @Ker0 yes because that number determines the total number of instructions per frame, meaning the sum of instructions in every thread

    3.8 years ago
  • Profile image
    5,713 Bori0

    What about a multi thread program does increasing maxInstructionsPerFrame fix the delay in that too?

    3.8 years ago
  • Profile image
    5,769 SelectAKey

    @CodeCaptain exactly what im doing

    4.0 years ago
  • Profile image
    5,769 SelectAKey

    @s5ehfr9 nawh im on mobile. but i took your concept to restructure my ASL and AGL hold programs. coming along well and shall be featuted in B version X-31 and mk.2 hornet

    4.0 years ago
  • Profile image
    8,457 s5ehfr9

    @SelectAKey This method can only speed up calculations so if your delay is not caused by intensive calculation this will not help. However if you can xml modify your craft it is better to just change maxInstructionsPerFrame instead.

    4.0 years ago
  • Profile image
    5,769 SelectAKey

    hmmmmm i was experiencing an issue with reaction speed so i removed the delay for pitch change. but your saying i can speed it up even more?
    hmmmm must test this for mk.2

    4.0 years ago
  • Profile image
    8,457 s5ehfr9

    @CodeCaptain My missiles don't work well when frame rate (or execution speed) is low. In fact, any vizzy program that require precision theoretically does not work well with low speed.

    It might also be something about the sensitivity of the program. If sensitivity is too high, the missile would be unstable and lose control; if too low, the missile might not hit the target. And the sensitivity might be dependent on execution speed.

    4.0 years ago
  • Profile image
    8,457 s5ehfr9

    Just found out that you could change maxCallStackSize in xml. The default is always 100 but for some reasons the actual value is always 2-3 lower than the value set in xml. @sflanker

    +1 4.0 years ago
  • Profile image
    Dev Pedro

    Most of my codes need horizontal scrolls for a reason xd

    +1 4.0 years ago
  • Profile image
    Mod sflanker

    Very informative! I have used a little recursion but only for processing lists in expressions (in which case it is essential). Definitely good to know about the stack limit. I wish that were a little higher! 98 stack frames isn't very many. Thanks for investigating this and sharing.

    +1 4.0 years ago

7 Upvotes

Log in in to upvote this post.