This package (for the 2022 Build Jam Dungeon Master) allows for the creation of tile based maps that are being revealed while the user explores the map. The map consists of areas where the map is revealed while travelling and sections, that contain their own maps and are placed on top of the area map. A section can contain a section map, that is shown on the main map and an area map, that will become the main map once the player navigates into that section. You can see this with the dungeon in the sampleRPGMap.
To install the map, download the package from the community tab. Add the userRPGMap folder to the user template and place the RPGMapConfig template into your world. To get started with a running example, also place the sampleRPGMap to yourt world that contains a few objects and a dungeon. Add the sampleRPGMap as default map in the properties of rpgMapConfig and press go.
Once the game is started, press extra3 (G on the keyboard) to toggle the map on and off
The rpgMapConfig includes a sample configuration with 3 free tilesets from the internet. You can replace or add additional tilesets, provided you have the rights to use them in your creation. Sometimes the creator of the tileset requires you to give credit. Check and add appropriately. For the three configured ones, you do not seem to need to put a credit, but please check for yourself, the link to the source is in the configuration of each tileset.
The following scripts are within the package and used to configure the map behaviour:
- rpgMapAreaScript: This script has to be attached to a trigger and contains the configuration of the background map the player will see when inside the trigger
- rpgMapSectionScript: This script can be attached to any entity and can be used to configure an overlay map of the area map configured in the parent.
- rpgMapIndicatorScript: This script can be attached to any entity and places an indicator on the map. The indicator is either visible at all times or can be made visible if the entity is interacted with or collided by the player.
- rpgMapViewScript: This script is attached to the user and controls the map dynamics. It has a property to turn on saving the exploration progress of the map.
- rpgMapTileSetScript: This script is used to configure tile sets used in the game
To create a tile based map, the best thing to do is to use use a map editor for tile based maps. I have used tiled, https://www.mapeditor.org which can be used for free, but the tool is so great, that if you can afford it, please give the creator a little donation
In tiled, you configure the tilesets by adding the images after you downloaded them. You can either use the source property from rpgMapTilesetScript under rpgMapConfig, or use the image property (Crayta link) to download them. Once you have selected the tilesets you want to use, you can create a new map, define the dimensions and start placing tiles.
Please note that currently the RPG Map package only supports only one layer of tiles from the same tileset within the same rpgMapArea or rpgMapSection script, while tiled would allow you to use more than one layers and tilesets within a map. With more time I will add the support for that in the future. Once you complete your map, you can choose “Export as …” from tiled’s menu and create a .lua file from it.
Then move over to your Crayta project, create a new script, paste the contents of the .lua file into it, save it and add the script to the entity that has the rpgMapArea or rpgMapSection script attached to it. Afterwards, select the name of the script in the rpgMapArea or rpgMapSection configuration for “Tile Script”.
You could also add the tilemap in the arry property tiles with one tile index per row (and defining the width of a row in the property column), but for bigger maps, using the .lua script is really a lot easier!
As always, I’d like to hear your feedback and enhancement suggestions! Please ping me in the Crayta Discord, which I read far more regularly than this forum!