banner
Rating
Voted0

Mob Ilib

0
Mod version:1
Game version:all
The mod has been successfully tested for the absence of viruses
721.46K106.91K

Report mod

  • image
modalImage

About This Mod

## RagnarsRökare MobAILib ##

MobAILib is a library used to replace the built-in AI characters in Valheim.

The goal is to provide a set of AI types and behaviors that modelers can use to create a brighter world.

RagnarsRökare MobAILib.

MobAILib is a library for replacing AI characters built into Valheim.

The goal is to provide a number of different types of AI and behaviors that modelers can use to create brighter worlds.


How to use.

First, add a reference to MobAILib to your mod project.


RagnarsRokare.MobAI.MobManager is used to register and monitor managed mobs.

It contains a list of MobAI that can be used as the mob's "brain" and control its behavior. 

Each MobAI has its own configuration file containing its settings: WorkerAIConfig and FixerAIConfig.

They inherit from MobAIBaseConfig, which contains basic attributes:  

Awareness - general awareness. Used to calculate search range and ability to detect enemies. 

Aggressiveness - Aggressiveness determines behavior in combat and when to surrender and escape. 

Mobility - Mobility is used to determine how often and how far a mob moves. 

Intelligence - general intelligence determines how much a mob is capable of memorizing.


-LabourerAI.

Allows the character to move around and fill smelters, ovens, fireplaces, and torches. He's looking for objects on the ground and in chests.

Fighting when wounded but easily surrendered (low attack level) The FeedDuration setting is only valid if the Tameable component is attached to the player object. 


WorkerAIConfig.

  public int FeedDuration = 1000;  

  public string[] IncludedContainers = new string[] { «piece_chest_wood» }  

  public int TimeBeforeAssignmentCanBeRepeated = 120;  

  public int TimeLimitOnAssignment = 60;  


- Repair of artificial intelligence.  

If you find a damaged structure, send it for repair. Equip a 0 item in your inventory or hammer, if available, and use attack animation when repairing again. If he is wounded, he will fight aggressively (increased attack strength). 

The FeedDuration option is only valid if the Tameable component is attached to the game object. 


FixerAIConfig.

These are the default values. 

  public int PostTameFeedDuration = 1000;  

  public int TimeLimitOnAssignment = 30;  

  public string[] IncludedContainers = new string[] { 'piece_chest_wood' }  


RegisterMobAI(Type mobAIType) Used to register a custom MobAI. 

MobAIType must inherit from MobAIBase and be a class that implements IMobAIType. 

An example implementation of mobAI can be found at [GitHub](https://github.com/di98feja/RagnarsRokare/wiki))のwikiを参照。). 


RegisterMob(Character character character, string uniqueId, string mobAIName, string configAsJson)Used to register a mob with MobAI.

- character - component of Character mob.

- uniqueId - a string used to uniquely identify the mob among all other mobs.

- mobAIName is the MobAI type to be used. Available types can be found in **'MobManager.GetRegisteredMobAIs()'**.

- configAsJson - MobAI specific configuration serialized as JSON.


RegisterMob(Character character, string uniqueId, string mobAIName, object config) is used to register the mob with MobAI.

- character is a component of Character mob.

- uniqueId - a string used to uniquely identify the mob among all other mobs.

- mobAIName is the MobAI type to be used. Available types can be found in **'MobManager.GetRegisteredMobAIs()'**.

- config - MobAI specific configuration.


UnregisterMob(string uniqueId)

Used to turn off control of the mob.


IsRegisteredMob(string uniqueId)Checks whether the mob with the specified unique identifier is registered.


IsAliveMob(string uniqueId)Checks whether the mob is active according to the specified unique identifier.

Mob becomes active when his MobAI is instantiated and assigned.


Dictionary<string, MobAIBase> AliveMobAll live mobs are stored in a dictionary where UniqueId is the key. Value is the base class of MobAI and has access to CurrentAIState.


The code is available on GitHub.

This repository also has a SlaveGreylings mod that uses this library.

Under the hood, he uses (or may be misusing) Stateless State Machine (also on GitHub).  

Thank you, Stateless team.


MobAILib is under development and, like any hobby, there is a limit to the amount of time you can spend on this project, no matter how much fun you get.

Therefore, even with the feedback we will not be able to fulfill everyone's wishes. 

// Berg and Morg.


Plans for the future.

- Add more specific combat behavior that all MobAI classes can use.

- Add interface templates and strategies that allow you to choose combat behavior at run time.

- More built-in MobAI classes.

- More general behaviors.


Change log.

- Version 0.3.9.  

 Changed that the mobs control only 2D distance when moving to the target.  

 If a container is unavailable, sorters have changed their behavior to free up items they hold.


- Version 0.3.8

 Bugs fixed.


- Version 0.3.7

 Bug fixes.


- Version 0.3.6.

 Add BasicFarmingBehaviour behavior


- Version 0.3.5

 Redesigned for Valheim v0.206.5


- Version 0.3.4

Updated for Hearth&Home


-version 0.3.3

Bug fixes.


- Version 0.3.1

Backward compatibility with version 0.2  


- Version 0.3.0  

Added markers for mobs on the map  

Various stability fixes and improvements  

AI roaming is disabled by default. Works well in single-player and single-player games on private servers. Multiplayer setup required.


- Version 0.2.1.

Removed [BepInProcess ("valheim.exe")] to make it compatible with private servers.


- Version 0.2.0.  

Added a base mob attribute to control behavior. 

Requires direct visibility for containers and jobs. 

Added FeedingBehaviour and removed the need for Tameable component. 

Rebuilt the tree mechanisms. 

Some configuration values are no longer valid.


- Version 0.1.3.  

Added basic FightingBehaviour function for FixerAI and WorkerAI.  

Fixed an error when adding fuel to the fireplace without mobs.


- Version 0.1.2.  

Added ability to save custom MobAI classes


- Version 0.1.1.  

Added overload in RegisterMob to accept settings as objects


- Version 0.1.0  

Initial release

Similar Mods/Addons

Game Version *

all (MobAILib.v0310.zip-1188-0-3-10-1650306292.zip)