useful design's picture

Alastair (@usefuldesign)

Groups

  • Vuo Founder

Compositions

1 year ago
useful design's picture

I'm working with a similar constraint in my issues of understanding how to loop in Vuo ATM. Check out this simple comp I made to shuffle list values (attached). It includes a debugging method using the Console Window node and others. It allows you to see the events and values inside a loop, something show events or tooltips will not show you.

The thread was here: Problem with Process List — I need neighbour values in the list during the iteration.

useful design's picture

Thanks for taking the time to respond, Magneson. It was your earlier suggestion to use the more appropriate Build List node that got me arriving a a solution. I'd forgotten that Build List was one of the main three looping nodes (and when I typed List, cycle through list and Process List are the first two, but build is down at no 12 and I missed it repeatedly).

Having said that the strangeness of outputs I was getting from a combination of Cycle Through list and Process List was pretty weird using a console window to look inside the loop in the hope of debugging my concept. Just got very confusing not knowing what was happening with events inside the loop which are not shown with "Show Events" Maybe we need a "Show Events inside Loops" preference or button which blinks them in a different colour?

My issues were to do with operating data that updates, so loops that operate on last state of the list, that's a bit more complex than building a list from scratch, especially if you are referencing more of the data than at the current index, hence the need to use the count number and add one to it to get some of my values, including wrapping the values that exceed list length.

When I get a chance I'll finish the composition and post it, was just an exercise I hoped I could do easily in Vuo.

Thanks for the tips on searching the Library using initials too.

I get the push vs pull dynamics, and the advantages that offers for computational optimisation. It does present some tricky issue though especially if you have some data updating every frame and other data updating, say, once every second. We need to make sure extra events don't sneak into the Build List loop and upset the order of items returning to the Build List node which will corrupt the build and make for very confusing outputs.

I'm still not confident with getting that right from the start with lots of debugging and demo coding.

Live and learn :-)

useful design's picture

+= means take it's existing value and add what is to the right of the operator to it.

e.g... n += 1

same as n = n+1

a1_v += a1_a

<=>   a1_v = a1_v + a1_a

is that what you were asking about?

useful design's picture

Thanks Jaymie your first solution is elegant.

The purpose of this exercise wasn't so much to find the optimal way to do this item shuffling task, but for me to generalise solutions for referencing any item in a list at any given time in a loop, or in secondary list, while looping through a list of point data.

I actually have two lists to solve for. The reason for dividing my data into two lists was to do with the composition I'm making explained in the third post, the data is position, speed and acceleration values for a group of cars going around a circulate track. Cars are to autonomously adjust their acceleration based on a set of rules. Position and velocity need to be calculated per frame, but acculturation doesn't and adds some realism too I thought to do twice a second (avoids me working out how to put a time stamp and test that before I change acceleration too). I guess I'm not really saving much CPU energy, but seemed smart to seperate the calculation for acceleration.

Here's my build list solution, it's pretty simple in the end, but had to learn about extra events sneaking into Build and Process loops and how to keep them under control with extra Hold Value/List nodes.

useful design's picture

Didn't realise Build List outputs a number as well as an event for each item counted in input list. So this version removes my Count node for simplification. Still struggling to work with multiple lists which influence each other (two way).

Pages