Making link parameters modulatable

Captain's Log: Stardate 77374.0

Today I decided to knuckle down and work on a tricky problem that I've been putting off with modulators: allowing modulators to affect spring parameters (like stiffness).

The think that makes this tricky is that springs are represented by a generic "Link" class, which is also used to represent the connection between modulators and their targets. There's an interface called "Linkable" which entity classes use to make it so that links can use them as endpoints.

So, if we're going to have modulators drive spring parameters, then the Link class needs to be Linkable. Which... is a recursive relationship. This introduces a ton of headaches.

Fortunately, many of these headaches can be sidestepped by introducing an invariant, which is that while Links are Linkable, a Link CANNOT link to another Link. It can only be linked to a non-Link entity. This means that while the relationship is recursive, it's limited to a single layer of recursion, so there are no cycles (the main issue) but also saves us from having to try to write our own recursion on the GPU, which is a really bad idea for performance.

(Actually there is a bit more complexity here that I'm glossing over. But the main invariant is just that there's no true recursion, just this single flat layer.)

This is similar to the constraint I mentioned a while back about modulators modulating modulators. Only one layer of recursion will be supported, which allows the GPU code to be written without any real recursion (just a single flat inlined recursive layer).


© 2024 Anukari LLC, All Rights Reserved
Contact Us|Legal