Skip to content
Matthew edited this page Feb 1, 2019 · 1 revision

Creating a New Map Using the RedMew Framework

To add a new map and make it available to everyone that wants to use RedMew, make a Pull Request on github to request adding your map to the repository.

Starting From Scratch

Maps are added into /map_gen/maps/ and each map can have an associated sub-directory inside maps.

Step 1

If you're not experienced with git, it's advised to read up on how git works first or ask someone else to help out. To get your change into the repository, you need to fork the repository and eventually make your Pull Request from there. Clone the fork to your local environment and get your favorite IDE or Editor ready.

Step 2

The map_gen/maps/your_scenario_file.lua file will be the entry point for your map and will be loaded via map_selection.lua.

Addendum on modules: If you want to add more than 1 entity or terrain module to a map there are special considerations:

  1. Entity modules must be added before terrain modules.

  2. Multiple modules of the same type should be acted on all at once as a table.

To illustrate both concepts at once:

-- Your module tables can be created anywhere in the map file, though usually near the top.
local entity_modules = {
    require "map_gen.entity.loot_items",
    require "map_gen.entity.mines",
    require "map_gen.entity.deathworld",
    require "map_gen.entity.glitter_ores",
}

local terrain_modules = {
    require "map_gen.terrain.tris_chunk_grid",
}

-- Applying the modules should be done immediately before the "return map" line,
-- after all other modifications to "map" have been made.

map = b.apply_entities(shape, entity_modules) -- applying entities first as a table
for _, m in pairs(terrain_modules) do -- applying terrain modules second as a table
    map = b.overlay_tile_land(map, m)
end

return map -- return map immediately after applying entities and terrain modules
Clone this wiki locally