Check out some youtube videos of work I’ve been doing in Lumberyard using Script Canvas and Behavior Trees. Over the course of the examples, I’m working out how to construct and code dynamic slices, avoiding any hard-coded references to other entities.
There are 4 machines on the left of the screen, their color determines what kind of box they will produce, each machine has input and output spaces. The red, yellow and blue machines take white boxes as inputs and the green machine takes blue boxes as an input. On the far right is a storage area with mostly white boxes. The AI bots are supposed to keep the machines somewhat evenly supplied with inputs.
This example is my first attempt at nested entities, navigation, behavior trees and communicating between spawned entities. The machines have a script canvas graph as well as a behavior tree that signals and times production when inputs are available. The input and output boxes are the only dynamic slice on this map and the AI do not communicate with each other.
The AI bots weren’t supposed to grab another’s box, overfill machines, run away with or throw boxes, but they did that too.
In this video I demonstrate a player-controlled character that has a camera and weapon as child entities. The weapon spawns a projectile. The player entity also loads a UI canvas to display health and score. Two spawners placed on the island spawn monsters (the ferocious cubes) that have a chance to spawn health pickups when the monsters are hit by a projectile. The player’s health is shown in the upper left corner. The number of monsters killed is shown in the upper center of the screen. I have it scripted so the player’s health declines steadily and I tuned the drop rate of the health pickup to 17.5% to ensure a short game round.
Each of the entities, including dynamic slices, has its own Script Canvas graph. This worked well in keeping the graphs simple. In the player’s graph, I grab references to its children by requesting a tag that only that entity’s child should have. This is a design that is working very well for me in multiple areas; In a child’s graph I request the parent’s ID and turn it into a string to append to a generic tag, which is then added to the child. The parent can then request an entity tagged with its own ID+genericTag and be sure the reference is to its own child. I use ID+tag outside of the context of children, as well, to reference a specific entity (in a general way).
Playing with the force component: