Jump to content

NPC AI Schedule Package Algorithm


Recommended Posts

The question is about algorithms. I want my dock workers to go from docks to stores with special animation and then return with no animation. And it i should be their schedule for all work day. From 9 to 18.

The Goal: Making NPCs randomly choose which of the 4 stores (interior cells) to enter and then return to the point in the docks can be solved in several ways. The question is, which ones?

I have outlined the following algorithm. Here I need the expertise of those who have worked with AI packages and can say whether this algorithm works or not.

 

The algorithm is as follows:

For each marker (one marker for each of the four interior cells), we make an AI package. It has the following conditions: 25% GetRandomCount; > 10 from the marker in the cell; working time from 9 to 18.

Thus, each package gets a 25% chance of being selected, then resets when the character reaches the marker, being less than 10 meters from it, and the package will ALWAYS be selected between 9 and 18 o'clock in the day (see why it is needed further). Well, it is clear that these packages actual only for weekdays!

When the package resets (the character reaches the marker), the character immediately receives a classic package to return to point A, that is, to the marker in the docks. This package also has the following conditions: > 10 from marker A; working time from 9 to 18.

That is, after dropping one of the 4 packages, the character always receives this package, returns to the docks, and there again selects one of the 4 packages and again goes to the marker to the inner cell until the time reaches 18 hours.

Do I understand the logic of the game engine correctly?


I often observed during testing that specifying the meterage from the marker can lead to a crash if the marker is in another cell, especially in the interior cell. The crash occurs if the character is subjected to the evp function when he is not in the interior cell, and the packet specifies that he must be at least N meters from the object in the interior cell.
That is why my question about the algorithm/architecture of the packets is not at all idle.

Thanks anyone for help in this intricate question.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...