Artificial intelligence in old games… This is not the ability of the computer to communicate with the player on an equal footing, but rather… creating an imitation of meaningful actions of characters or environment. Let’s look at some examples.
Patrolling (moving along a certain trajectory)
We need the character (snail, teacher or student) to move along a certain trajectory. Our actions:
- Set patrol points (NavigationPoint – PatrolPoint). For example, 4 pieces – at the corners of an imaginary rectangle.
- Point each patrol point to the next patrol point.
Свойства – PatrolPoint – NextPatrol = The_name_of_the_nextpatrol_point.
The names of all objects can be found here: Properties – Object – Name
For example, your patrol points have the following names: PatrolPoint11, PatrolPoint12, PatrolPoint13, PatrolPoint14.
For PatrolPoint11, we specify the following PatrolPoint12, for PatrolPoint12 – PatrolPoint13, for PatrolPoint14 – PatrolPoint11.
- Put the character as close as possible to one of the patrol points. For example, take a snail (OrangeSnail).
- In the properties of the snail , we set:
patrol – bLoopPath = True (move endlessly along the specified trajectory)
PatrolPoints – firstPatrolPointObjectName – the name of the nearest patrol point, for example: PatrolPoint11.
PatrolPoints – bGoToClosestPatrolPoint = True
You can experiment with the type of patrol (patrol – ePatrolType). By default it is PATROLTYPE_PATROL_POINTS (patrolling at patrol points). But here you need to be careful, because if the parameters are set incorrectly, then the character either stands still or gets stuck in corners and walls.