SimArena Documentation

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.


Project maintained by arbyun Hosted on GitHub Pages — Theme by mattgraham

Creating Custom Maps

This guide covers how to create custom maps and map templates for SimArena.

Index

Creating Map Templates

Map templates are the recommended way to create reusable map configurations. They’re stored as JSON files in the templates/maps/ directory.

Basic Template Structure

{
  "TemplateId": "my_custom_map",
  "Name": "My Custom Map",
  "Description": "A custom map for specific scenarios",
  "Version": "1.0",
  "Tags": ["custom", "scenario"],
  "MapConfiguration": {
    // Map configuration goes here
  }
}

Template Properties

Map Configuration Types

1. Simple Maps

Perfect for open combat scenarios:

{
  "MapConfiguration": 
  {
    "Type": "Simple",
    "Width": 40,
    "Height": 40
  }
}

2. Procedural Maps with Random Rooms

For dynamic, room-based combat:

{
  "MapConfiguration": 
  {
    "Type": "ProcGen",
    "StrategyType": "RandomRooms",
    "Width": 50,
    "Height": 30,
    "MaxRooms": 20,
    "RoomMaxWidth": 6,
    "RoomMaxHeight": 4
  }
}

The available strategy types are:

More can be implemented by implementing the IMapCreationStrategy<Map> interface and registering it with the polymorphic JSON serialization system.

3. File-Based Maps

For completely custom layouts:

{
  "MapConfiguration": 
  {
    "Type": "File",
    "FilePath": "maps/my_custom_map.txt",
    "Width": 25,
    "Height": 25
  }
}

Creating File-Based Maps

File-based maps use text files to define custom layouts. They use structured directives in plain text files to define walls, doors, spacing, and offsets. These maps will then be parsed and translated into playable maps through an instance of FileBasedMapCreationStrategy<TMap>.

Supported Directives

Each line in the map file must begin with a # followed by a keyword. Empty lines and comments (//) are ignored.

Layout & Initialization

Map Features

Example Map File Content

#wallrect (0,0) (35,4)
#door (35,3)
#wallrect (34,0) (39,6)
#door (34,3)

Notes

Using Custom Maps

In Game Configurations

Reference your custom map template:

{
  "Name": "Custom Battle",
  "MapTemplate": {
    "TemplatePath": "my_custom_map"
  },
  "RealtimeMode": false,
  "Objective": {
    "Type": "DeathmatchObjective",
    "ObjectiveType": "TeamDeathmatch",
    "TeamCount": 2,
    "KillsToWin": 5
  }
}

With Overrides

Customize template properties:

{
  "Name": "Large Custom Battle",
  "MapTemplate": {
    "TemplatePath": "office_building",
    "Overrides": {
      "Width": 80,
      "Height": 60,
      "MaxRooms": 40,
      "RoomMaxWidth": 10,
      "RoomMaxHeight": 8
    }
  }
}

Helpful Guidelines

Map Size Recommendations

Room Configuration Guidelines

For RandomRooms maps:

Advanced Techniques

Conditional Map Selection

Use tags to select appropriate maps:

var urbanMaps = templateManager.GetMapTemplatesByTag("urban");
var selectedMap = urbanMaps.First();

Dynamic Map Modification

Modify maps at runtime:

var map = mapConfiguration.CreateMap();
// Add dynamic obstacles
map.SetCellProperties(x, y, false, false); // Make cell impassable

Custom Map Strategies

Implement IMapCreationStrategy<Map> for custom generation algorithms:

public class CustomMapStrategy : IMapCreationStrategy<Map>
{
    public Map CreateMap()
    {
        // Custom map generation logic
        return new Map(width, height);
    }
}