WM calculating non-picked routes

Hello World Machine community.
I am using World Machine 3028, Standard build 64 bit. I started playing around with the macro and as an experiment decided to create a terrain generation macro for a mod I’m creating. The macro can take a height input and optionally layout input and turn it into different types of terrain, such as canyons or mountains. Each one of these types of terrain has its own group of nodes and the idea is that WM will only calculate the group chosen by a dropdown box that feeds into a router.

All input goes through the router with the exception of one input that influences the route picker at the end, but nothing connects in the middle, so WM should ONLY be calculating the nodes that connect to the correct route as far as I can tell. However it calculates every single node in the macro regardless of what I do. As a new user of the forum, I believe I cannot upload images or files, so here is a simplified text diagram:

               [Params, including     ]
               [Terrain Type Parameter] ------\
                      |                        \
                      |         [TerrainType1]  \
[Macro Input] ---- [Router] ---{              }  [Route Picker] ----- [Macro Output]

Of course there is a lot more to it than that, but the point is that instead of building TerrainType1 when I choose option 1 or TerrainType2 when I choose option 2, it just builds everything in the macro, causing it to take forever.

Is this a bug or am I just using/understanding it wrong?

Hi there,

That’s a great idea for a macro, and what you want should definitely work. I wrote out a detailed message guide for this kind of processing, and then I realized that there indeed IS a bug.

But first, I just want to clarify how this does (and does NOT) work, to help others trying to do the same thing as well.

To elaborate, here’s a setup much like you describe. The bottom route has been chosen by providing a “1” to the router, and as expected, World Machine is not processing the unselected branch 0 that depends on the router:

However, any devices that are NOT connected to the router will still build. This means that you might end up building a lot of devices that don’t get used if you do this in a naive way:

You can see that the basic noise and thermal weathering are still built since they do not depend on input from the router.

The way around this should be to encase each route path into its own macro. Macro inputs can be either optional or required, and they are intended to do short-circuit processing. If an input marked as required is not provided, the macro should automatically fail to build. This should prevent all of the internal devices from building on routes that aren’t chosen.

However, apparently the short-circuit behavior went awry somewhere. I’ll try to get a bugfix out ASAP for this! Thanks for bringing it to my attention.