Other NPC Managers
In this guide, we will go through the rest of the NPC manager components that we haven't addressed in previous guides.
1. NPC Territory Manager
Find the NPC Territory Manager component attached to the NPC.ResourceExtension child object of the tutorial_npc_manager. This component is responsible for expanding the faction's territory in the map by creating new building centers (buildings with a Border component).
- Building Centers: Potential list of building center prefabs that a NPC faction can use to expand its territory. Here we can assign the building with the Border component, the tutorial_town_center but we need to set its regulator data so that it can be created by the NPC faction.
- Expand On Demand: Can other NPC components request to expand faction territory?
- *Target Territory Ratio: Minimum and Maximum target ratio of the map's territory to control. This component will actively attempt to at least control the minimum ratio and will not exceed the maximum ratio.
- Expand Delay Range (in seconds): Delay before the NPC faction considers expanding.
- Expand Reload Range (in seconds): How often does the NPC faction check whether to expand or not?
2. NPC Capacity Resource Manager
Find the NPC Capacity Resource Manager component attached to the NPC.ResourceExtension child object of the tutorial_npc_manager. This component is responsible for creating faction entities that allow to increase the capacity of a certain resource type. Here we will make this component work with the population type so that it is able to create tutorial_house instance (which increase population capacity). You can have as many instances of this component as you need to handle different capacity resource types.
- Capacity Resource: Capacity resource type to be monitored by this component. Assign to population. Here, you can have different resources based on the faction type of the NPC faction.
- Faction Entities: List of potential faction entities (units and buildings) that can increase the capacity resource. Assign the tutorial_house building here.
- Auto Create: Allow this component to automatically create faction entities to increase the resource capacity?
- Reload Range: How often does the NPC faction attempt to monitor the capacity resource to update it and reach its capacity goal?
- Target Capacity Range: Target resource capacity range that the NPC faction will aim to reach as long as this component is active.
- Min Free Amount: When the free amount of the capacity resource reaches this value, this component will attempt to create the faction entities that can raise the capacity.
Now whenever, the population resource hits maximum capacity, this component will force the NPC faction to create a new instance of the tutorial_house building to increase the capacity.
4. NPC Event Publisher
Attached to the NPC.Event child object of the tutorial_npc_manager, the NPC Event Publisher is a component that allows other NPC managers to subscribe and listen to NPC related events. This component does not have any inspector fields.
5. NPC Entity Component Tracker
Attached to the NPC.EntityComponent child object of the tutorial_npc_manager, the NPC Entity Component Tracker is a component that provides other NPC components with tracker data types for entity components. It has not inspector fields.
Download Files
You can download the results of this tutorial here.