Basic Map - helpme 2022

This adds an ascii map to a given room which can be viewed with the map command. You can easily alter it to add special characters, room colors etc. The map shown is dynamically generated on use, and supports all compass directions and up/down. Other directions are ignored.

If you don’t expect the map to be updated frequently, you could choose to save the calculated map as a .ndb value on the room and render that instead of running mapping calculations anew each time.

An example map:


| | | | | | -[-]–[-] [-] | / | | | /| -[-]–[-]


Adding the MapDisplayCmdSet to the default character cmdset will add the map command.

Specifically, in mygame/commands/default_cmdsets.py:

… from evennia.contrib.grid.ingame_map_display import MapDisplayCmdSet # <—

class CharacterCmdset(default_cmds.Character_CmdSet):

… def at_cmdset_creation(self):

… self.add(MapDisplayCmdSet) # <—

Then reload to make the new commands available.

Additional Settings:

In order to change your default map size, you can add to mygame/server/settings.py:


This changes the default map width/height. 2-5 for most clients is sensible.

If you don’t want the player to be able to specify the size of the map, ignore any arguments passed into the Map command.

class evennia.contrib.grid.ingame_map_display.ingame_map_display.Map(caller, size=2, location=None)[source]

Bases: object

__init__(caller, size=2, location=None)[source]

Initializes the map.

  • caller (object) – Any object, though generally a puppeted character.

  • size (int) – The seed size of the map, which will be multiplied to get the final grid size.

  • location (object) – The location at the map’s center (will default to caller.location if none provided).


Create the empty grid for the map based on the configured size


list – The created grid, a list of lists.


Get the exit name as a compass direction if possible


ex (Exit) – The current exit being mapped.


string – The exit name as a compass direction or an empty string.

update_pos(room, exit_name)[source]

Update the position pointer.

  • room (Room) – The current location.

  • exit_name (str) – The name of the exit to to use in this room. This must be a valid compass direction, or an error will be raised.


KeyError – If providing a non-compass exit name.


Checks if the given room has already been drawn or not


room (Room) – Room to check.


bool – Whether or not the room has been drawn.

draw_room_on_map(room, max_distance)[source]

Draw the room and its exits on the map recursively

  • room (Room) – The room to draw out.

  • max_distance (int) – How extensive the map is.


Draw a given room’s exit paths


room (Room) – The room to draw exits of.


Draw the map starting from a given room and add it to the cache of mapped rooms


room (Room) – The room to render.

render_room(room, x, y, p1='[', p2=']', here=None)[source]

Draw a given room with ascii characters

  • room (Room) – The room to render.

  • x (int) – The x-value of the room on the grid (horizontally, east/west).

  • y (int) – The y-value of the room on the grid (vertically, north/south).

  • p1 (str) – The first character of the 3-character room depiction.

  • p2 (str) – The last character of the 3-character room depiction.

  • here (str) – Defaults to none, a special character depicting the room.


Set the starting location on the grid based on the maximum width and length


room (Room) – The room to begin with.


Create and show the map, piecing it all together in the end


debug (bool) – Whether or not to return the time taken to build the map.

class evennia.contrib.grid.ingame_map_display.ingame_map_display.CmdMap(**kwargs)[source]

Bases: evennia.commands.default.muxcommand.MuxCommand

Check the local map around you.

Usage: map (optional size)

key = 'map'

This is the hook function that actually does all the work. It is called by the cmdhandler right after self.parser() finishes, and so has access to all the variables defined therein.

aliases = []
help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'map', 'no_prefix': ' ', 'tags': '', 'text': '\n Check the local map around you.\n\n Usage: map (optional size)\n '}
class evennia.contrib.grid.ingame_map_display.ingame_map_display.MapDisplayCmdSet(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

The map command.


Hook method - this should be overloaded in the inheriting class, and should take care of populating the cmdset by use of self.add().

path = 'evennia.contrib.grid.ingame_map_display.ingame_map_display.MapDisplayCmdSet'