SimArena is a powerful toolkit for creating, configuring, and running simulations with multiple agents in various scenarios. It provides a robust foundation for AI research and development, with support for custom objectives, brains, weapons, and maps.
Entities are objects that exist within the game world. They can be used to represent anything from a player, a building, a tree or even a piece of furniture. They have their own position and orientation on the map.
Agents are the main actors in SimArena. The main difference between agents and entities is that agents have an AI system (see brain) which allows them to make decisions based on their surroundings.
To create a new entity, you can use the Entity
class.
var entity = new Entity(1, 1);
This will create a new entity at position (1, 1). You can then add it to the simulation using the AddEntity
method.
simulation.AddEntity(entity);
To create a new agent, you can use the Agent
class.
var agent = new Agent(1, 1, new RandomBrain());
This will create a new agent at position (1, 1) with a random brain. You can then add it to the simulation using the AddAgent
method.
simulation.AddAgent(agent);
You can extend the Entity
class to create your own custom entities.
For example, you could create a Tree
entity that has a health value and a method to damage it:
public class Tree : Entity
{
public int Health { get; private set; }
public Tree(int x, int y, int health) : base(x, y)
{
Health = health;
}
public void Damage(int amount)
{
Health -= amount;
}
}
You can then add it to the simulation like any other entity.
var tree = new Tree(1, 1, 100);
simulation.AddEntity(tree);
You can then get the tree from the simulation and damage it in another part of your code.
var tree = simulation.GetEntity<Tree>(guid);
tree.Damage(10);