I’ll answer your questions in reverse as it’ll be clearer that way.
Do the colors mean anything?
Yes. The color of a cube represents a specific object type in code and allows me to visually determine which object I’m tinkering with. The color of the connections represent the object at the opposing end of the connection. For example, if the red cube is connected to the green cube, then a line is created that is red at the green cube, and green at the red cube. This helps the player determine what connection they’re following in game, which will be very important later on.
Could the visual effects also be applied recursively?
Yes, and in-fact, they originally were. I might, bring it back, depending on how things begin to look once I start testing multi-effects. I’ve already implemented the code to support infinitely many effects per game object, but I have not tested the actual application of more than one yet.
Could you explain a little bit about the recursive physical effects?
To begin, game effects in my game define how the health, power, defense, and many other statistics of an object, change within an interaction, and each game effect is responsible for defining how it applies physical and, if any are involved, visual effects.
So for a simple example, let’s say we create a new effect called simply “Reduction Effect”, and we want this effect to limit the power output of any connected red cubes by 50%. The effect would apply it’s power reduction to any directly connected red cubes.
Now the recursion comes into play to expand on this. Let’s say that when a red cube is connected to a white cube, the white cube gets an automatic power boost of 20%, no effects required. Let’s also say that the current connection tree is Green → Red → White.
With this, let’s define some variables to display the impact:
To visualize the impact, let’s say the connection tree is simply Green → Red → White. Because of the recursive application of the effects, the state of each cube after application is:
-
Green Cube
-
Power: 100%
-
Red Cube
-
Power: 50%
-
White Cube
-
Power: 110%
So instead of the white cube getting the entirety of it’s 20% boost in power from the red cube, it only gets half of that due to the reduction effect the green cube has on the red one.
This applies all the way through the connection tree, no matter how far down it goes. The recursion stops once it gets back to the initiating game object, so it can lead to some pretty interesting results. For example, if the tree is:
-
Green Cube 1
-
Red Cube 1
-
White Cube 1
-
Blue Cube 1
-
Green Cube 1
-
Red Cube 2
-
White Cube 2
This series is allowed, and technically creates a circular reference. However, it is safeguarded by the fact that the application stops once it returns to the origin. If a circular reference is detected, the effect is instead applied beginning with the last object in the circular reference, while retaining the first object as the starting point, which allows the entirety of the desired output to be achieved.
Note: The concept of circular connections may not be supported in the final product, but it isn’t off the table yet.