#map #game #story #validation #detail #mission2teegarden-b #teegarden

bin+lib mission2teegarden-b-map

Private implementation detail of mission2teegarden-b

3 releases (breaking)

0.2.0 Jul 14, 2023
0.1.0 Jul 13, 2023
0.0.0 Jul 2, 2023

#19 in #story

AGPL-3.0-or-later

44KB
807 lines

This crate allows you to create maps/levels for Mission to Teegarden b. It can be used instead of the game binary mission2teegarden-b. Every feature provided by this crate is also provided by the game itself. The only benefits is that this crate is much smaller.

Mapeditor

Mission to Teegarden b allow creating custom maps, by using the Tiled Map editor. This does include support for available instructions and story.

Limitaions

There exist some conditions and limitation how the map is structured:

  • The map must be finite.
  • All layers must be finite.
  • No custom Tileset can be used. So only the Tilesets available at Github (BaseTiles.tsx, ObjectTiles.tsx, Player.tsx) can be used.
  • All layers must be a Tile layer.
  • The 1. Layer must only use Tiles from the BaseTiles set.
  • The 2. Layer must only use Tiles from the ObjectTiles set.
  • The 3. Layer must only use Tiles from the Player set.
  • If a field at layer 1. is not set Grass is used as default.
  • If player i have a start position. All player <i must also have a start position.
  • At least player 1 must have a start position.
  • If a global goal was not set, each player (which have a start position), must have a player goal.

Available Instructions

Available instruction can be added, by adding a "Custom properties" with type int to the Map. The properties must be named like the fields of the AvailableCards struct. If no properties for an instruction is set, 0 is used as default. Keep in mind that the player can only use 12 cards in total.

Story

An optional story can be added by creating a map property called story from type string As decoding the toml format is used. Currently, only story elements before and after the level are supported.

Take a look at this example story:

[[pre_level]]
text = "hi, I am the captain ..."
profil = "Captain"
background = "OuterSpace"

[[pre_level]]
text = "now it is you turn!"

[[after_level]]
text = "You have mastered the challenge!"
profil = "Captain"

The story exist out two lists pre_level and after_level, both are optional. Each list include zero or more Speechs. The Speechs from pre_level are shown before the level starts. The ones from after_level are show, after the level was finish successfully. A Speech exist out of a text, a profilpicture and a background. The last two are optional. profil defined the picture, which is show left from the text. All variants of Character can be used for this. If profil is not set, no picture will be shown. background define the background with is show above the text. All variants of Background can be used for this. If background is not set, the level will be shown.

For more informations see the Story struct.

Map validation

The map can be validated by using the game or this crate, by exectuing one of the following commands.

mission2teegarden-b validate-map <FILE>
mission2teegarden-b-map validate <FILE>

Map export

Map exporting works similary to validation:

mission2teegarden-b export-map <FILE>
mission2teegarden-b-map export <FILE>

Executing one of the commands creates a file with the same basename as the original file and the extension .m2tb_map inside the current working directory. Since the map format is not stable yet and can not be editet after exporting, it is strongly recommanded to keep the original .tmx file

Play Map

To play a map start the game and navigate to Play -> Import Level.

Alternatvie the command line interface can be used:

mission2teegarden-b play [FILE]

Dependencies

~10MB
~176K SLoC