Right now, we have a bunch of if/else in the loop method. Right now, all of this has to be executed in sequence, meaning that we can't take advantage of parallelism to speed up our code.
Of course, the code is great as-is! Simplifying isn't a choice that we needed to make until we started bumping up against performance limits.
The first step towards fixing this is hammering into a more "pure" format.
For example,
This code only uses simple ButtonNode. We can make this better by using a ToggleNode (and fixing the weirdness of scaleUp/scaleDown)-- then, it'd just be
input.registerInput("precisionDriving", new IfNode(
new ToggleNode(new ButtonNode("b")), //if it's toggled on, then
new StaticValueNode(0.1), //return 0.1
new StaticValueNode(1f) //otherwise (if toggled off) return 1
));
input.registerInput("dashing", new IfNode(
new ToggleNode(new ButtonNode("x")), //if it's toggled on, then
new StaticValueNode(1f), //return 1
new StaticValueNode(0.6f) //otherwise (if toggled off) return 0.6
));
Relates to #27.
Right now, we have a bunch of
if
/else
in the loop method. Right now, all of this has to be executed in sequence, meaning that we can't take advantage of parallelism to speed up our code.Of course, the code is great as-is! Simplifying isn't a choice that we needed to make until we started bumping up against performance limits.
The first step towards fixing this is hammering into a more "pure" format.
For example,![image](https://user-images.githubusercontent.com/26300854/150368596-f9ff1226-ef02-49b1-8f37-66a8632143cb.png)
ToggleNode
(and fixing the weirdness of scaleUp/scaleDown)-- then, it'd just be