Skip to content

02 User Defined Map

Lavi22 edited this page Sep 8, 2019 · 1 revision

If you want to create a custom level map, you may use the factory we made and put it under lab/game_scripts/factories/ then create a level under lab/game_scripts/levels/. We will give an example of creating a user-defined map level below.

Example

Level Script

-- practice_map.lua
local factory = require 'factories.practice_factory' -- include the factory we made
local texture_sets = require 'themes.texture_sets'

return factory.createLevelApi{
    episodeLengthSeconds = 20,
    pickups = {L = 'lemon_reward', A = 'apple_reward', S='strawberry_reward'},
    camera = {250, -100, 900},
    texture_set = texture_sets.TETRIS,
    map_entities = [[
  ***********
  *     P   *
  *  S   AS *
  * S     L *
  *  A P  LA*
  *  LA    A*
  * SS   S  *
  *    P    *
  ***********
    ]],
    var_entities = [[
***************
***B*******B***
***ABBBBBBBA***
****AAAAAAA****
***************
****AAAAAAA****
***ABBBBBBBA***
***B*******B***
***************
]]
}

Map

There are two variables for defining a map.

map_entities:
Decides position of pickup items, walls (*), and spawn points(S). We can define the symbols for the pickup items we want.

var_entities:
Decides the variation of the floor and the wall of the level.

Pickup Items

Please go to here for the detailed settings.
The variable, classname, is the name of the pickup items; and the variable, quantity, is the reward value of the object.

Texture Set

Please go to here for the detailed settings.
There are plenty of texture set:
MISHMASH, MINESWEEPER, TETRIS, GO, etc. Most of them have more than one kind of wall or floor. DMLab will automatically iterate to the next texture when seeing a different character in the var_entities. I am not very sure how they sort the characters and pair the textures.

Among the texture sets, CUSTOMIZABLE_FLOORS and CAPTURE_THE_FLAG are a little bit different. They have assigned some character to represent the specific texture.

Clone this wiki locally