LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Snowflake: A game written in LabVIEW to celebrate winter and VI scripting from ExpressionFlow

Highlighted

Many years ago, LabVIEW user Tomi Malia created an amusing game in LabVIEW: Items from the palettes falling like snowflakes that you had to catch in a box (a LabVIEW class constant). The trick was that the whole thing was done using scripting -- live movement of nodes on the block diagram of a not-running VI. It was a fun demonstration of scripting.

 

Tomi posted this VI in his ExpressionFlow blog. The blog is still a good read, but his earliest posts were lost. You can read an archived copy of Tomi's original blog post archived in the WaybackMachine: http://web.archive.org/web/20130907112901/http://expressionflow.com/2007/12/. But that archive copy doesn't include the VI. Even if it did, the VI was written at a time when scripting was not a public feature, so the block diagram was password protected.

 

Tomi, now a Senior Engineer at JKI, has given me a copy of the VI with the password removed and given me permission to re-post it. The whole game is just a single standalone VI -- and it *almost* fits on a single screen. ;-) The VI is saved in LabVIEW 2009. In light of the winter weather across the USA recently, I thought people might be looking for a bit of LabVIEW cheer to keep them warm. Use the left & right arrow keys to play. You can post your high scores here. Enjoy!

 

-- Aristos Queue

PS: If you have never heard of the WaybackMachine, it is a marvelous organization that archives our digital history, recording websites that go dark so that information is not lost. They are a non-profit supported by donations. Please consider financially supporting their effort.

Message 1 of 9
(2,360 Views)

Modal VIs + Run When Opened = Hang + cursing + using Win7 taskbar to try to save VIs + this

 

Crash Report.png

0 Kudos
Message 2 of 9
(2,321 Views)

@Darin.K wrote:

Modal VIs + Run When Opened = Hang + cursing + using Win7 taskbar to try to save VIs + this


Modal VIs + Run When Opened + Hang + Abort VI = peace & tranquility (usually)

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 3 of 9
(2,303 Views)

Tried a similar VI, no luck opening it though.  As usual I nuke LV with task manager and hope for recovery to clean up most of the mess.

Message 4 of 9
(2,282 Views)

Really? I tested this in every version of LabVIEW from 2010 to 2013. Works fine for me -- no hang, and exits gracefully when you close the window.

0 Kudos
Message 5 of 9
(2,257 Views)

Not quite as well behaved if:

  • Place snowflake.vi on new BD
  • Ctrl+Dbl click (Open BD)
  • Run
  • Close FP with Windows X

The event case doesn't handle FP Close too well but, Unless you've queued up a bajilion Key repeats the FP should respond.

 

Unchecking the Defer FP updates on th key down key repeat event makes the game much more playable (at least the class object is now controlable) but It slows down and behaves oddly at >200 pts By 230 pts you learn to watch the score since the redraw rates don't clear the objects you caught in a timely manner (once the score registers just ignore that object) @ 300 pts the game crashedSmiley Sad  LabVIEW died

Always maintain an accurate count of deployed mousetraps.
0 Kudos
Message 6 of 9
(2,240 Views)

I used to joke that the forums are effective at stopping VIs from being posted and not so good at stopping spam.  This VI managed to cost me more time and code then all of the spam messages put together.... Smiley Frustrated

 

I believe the common courtesy is to not post VIs which are set to run when opened.  At least distribute a project, or at the very least make a note of it.  I was curious to see the code, but I would not have touched the run button with a ten foot pole had I seen it.

Message 7 of 9
(2,226 Views)

Is the hang caused by the greedy loop at the beginning? The loop polling the start button has no wait.

0 Kudos
Message 8 of 9
(2,212 Views)

Essentially the object spawning loop outPaces the object destruction by a geometric ratio. eventually there are so many object motions to calculate and move that the ui thr ead locks up bad. it could probably be saved by limiting the spawned objects to a reasonable number and  reusing expired objects rather than leaking them .  a undo stack of old default 9 would probably help too.

Always maintain an accurate count of deployed mousetraps.
0 Kudos
Message 9 of 9
(2,191 Views)