Interaction Systems

Within Hex World I devised various systems for different types of interactions. These interaction helped distinguish between different behaviours for objects such as world tiles, items, or the player.

Step On Receiver and Sender – The first system I devised was the step on receiver and sender scripts.  This was implemented very early in development while I was still experimenting with the concept. This system allowed for a step on receiver interface to be inherited by classes so that unique behaviour could be defined. While objects in the world can use a step on sender script which fires a ray down to check for objects directly below them, and then attempting to send messages if you object has the step on receiver interface. This allowed me to define a series of unique behaviour for world tiles.

Link to page explaining world tiles development

Early in the development of the game, while I was still testing the concept, I tested this form of interaction out by creating a jump pad tile which launched the player into the air. Here is a video of this early concept testing.

World Effects –  World effects are what I use to define interactions that directly influence other objects. For example in the video below bombs explode and cause craters in the terrain, this effect is not done through damage and hit packages, but by an explosion effect that is created. This works by having these tile types inherit an effect receiver interface. Once it has this interface as a part of its class object it can define what effects it reacts to and what it does when it reacts.

Switches Senders and Receivers – This form of interaction has signals being sent from one object to other objects that have switch receiver interfaces. For example mine world tiles and world shifters inherit the switch receiver interface. This lets me wire them up to specific switches which can then activate them. Meaning there interfaces allow them to define unique behaviour when triggered by a switch. At the start of the video below is a demonstration of a switch tile triggering a mine tile.

Hit Senders and Receivers – This form of interaction is slightly more complicated than the prior forms. This form of interaction is all about dealing damage to objects. There are 3 parts to this system.

Attribute Interface – The attribute interface is what allows for unique behaviours to be defined for different objects when hit. However this interface is not used to identify that the object can be hit, unlike prior methods of interaction explained above.

Attribute Script – The attribute class is the primary marker that indicates that this object can be damaged. This attribute class has a series of fixed functions that work with the attribute interface. There are also a series of variables that can be set through this script, including setting damage types that an object is immune to. Below are the public variables that can be set through the Unity inspector.


Hit Sender – The hit sender is a singleton that manages the distribution of hit packages. Any other script that push a hit packet to the sender and then the sender will determine what that hit packet came into contacted with and then send signal through the objects attribute class.

Below is a video of spike tiles damaging a tree through hit packets. The tree also demonstrates unique behaviour on being hit by shaking and creating particles, and on death when it drops a log.

The code for the interaction systems can be downloaded from the code listing page under the Hex World project files. These files are located within Assets >> Scripts >> interaction and Assets >> Scripting >> Attributes.