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.
Here are some common ways to use SimArena:
For detailed setup instructions and code examples, check out the specific documentation pages related to each component.
For configuration examples, check out our README
file on GitHub. Alternatively, explore the configurations
folder in the project for more examples.
Create simple simulations to test different AI brain behaviors:
Use SimArena to balance game mechanics:
Develop and test new AI behaviors:
For academic projects and learning:
// Create a simulation with a randomly generated map
var simulation = new Simulation(width: 20, height: 20);
// Create the objective and tracker
var objective = new DeathmatchObjective(SimulationObjective.TeamDeathmatch, 2, 10);
var tracker = new DeathmatchTracker(objective);
simulation.SetObjectiveTracker(tracker);
// Create agents with brains
var (x1, y1) = Brain.GetRandomWalkableLocation(simulation.Map);
var brain1 = new RandomBrain(simulation.Map, team: 0);
var agent1 = new Agent(x1, y1, brain1, "Agent Red");
brain1.SetAgent(agent1);
var (x2, y2) = Brain.GetRandomWalkableLocation(simulation.Map);
var brain2 = new TacticalBrain(simulation.Map, team: 1);
var agent2 = new Agent(x2, y2, brain2, "Agent Blue");
brain2.SetAgent(agent2);
// Add agents to the simulation
simulation.AddAgent(agent1);
simulation.AddAgent(agent2);
// Run the simulation
while (!simulation.IsGameOver)
{
simulation.Update(deltaTime: 1.0f);
}
Console.WriteLine($"Game Over! Winner: Team {simulation.WinningTeam}");
// Load the configuration
var config = GameConfiguration.LoadFromJson("configurations/team_deathmatch.json");
// Create the simulation
var simulation = new SimulationWithConfiguration(config);
// Run the simulation
while (!simulation.IsGameOver)
{
simulation.Update(deltaTime: 1.0f);
}
Console.WriteLine($"Simulation '{config.Name}' completed! Winner: Team {simulation.WinningTeam}");
Once you’ve got the basics working, explore further documentation: