Choosing The Most Recommended Environment Inputs

I’ve commonly encounter programmers choosing inputs that led to very slow AI learning. In this tutorial, I will show you the most recommended inputs so that you can get the best out of this library.

Relative Magnitude Over Magnitude

Relative magnitude means that the magnitude is the result from subtracting / dividing between two magnitudes. For example:

local relativeMagnitude = magnitude1 - magnitude2

local distance = position1 - position2

local rotationDifference = rotation1 - rotation2

local rotationValueNeededToFaceTheEnemy = math.tanh(distanceX / distanceZ) - currentRotationY

local healthChangedAmount = maxHealth - currentHealth

local healthRatio = currentHealth / maxHealth

Meanwhile magnitude is the value from zero. For example:

local position = primaryPart.Position

local rotation = primaryPart.Rotation

These two values can effect our neural networks very differently. Below, I will describe what will happens if you choose one of these values.

Relative Magnitude


Directional Equivalents

Directional equivalents means that the values provides the same information in terms of direction. For example, let’s say if we have these three values:

These can be represented as:

local rotationY = math.tanh(distanceX / distanceZ)

Because rotationY contains those two values, distanceX and distanceZ can be removed. However, if you want the distance for rotationY, then you need to calculate the distance using both distance X and Z.

Using redundant values will cause the learning to slow down as the neural network will have to find the connection between these values that already exists.


So you have to keep these two in mind:

Once you master those two, you can start seeing your AI learn much more faster.

That’s all for today!