Module: Demiurge::Tmx
- Defined in:
- lib/demiurge/tmx.rb,
lib/demiurge/tmx.rb
Overview
This entire file feels like a plugin waiting to happen. Putting it into Demiurge and monkeypatching seems slightly weird and "off". There's nothing wrong with having TiledLocation in Demiurge, and we do. But TMX, specifically, has a lot of format-specific stuff that doesn't seem to belong in core Demiurge. That's part of why it's off by itself in a separate file. If we were to support a second tilemap format, that would definitely seem to belong in a plugin. It's not clear what makes TMX different other than it being the first supported map format. The only thing keeping this from being the "demiurge-tmx" gem is that I feel like the code is already diced too finely into gems for its current level of maturity.
Demiurge::Tmx is the module for Tmx internals. This includes Tmx parsing, caching and general encapsulation.
TMX support here includes basic/normal TMX support for products of the Tiled map editor (see "http://mapeditor.org" and "http://docs.mapeditor.org/en/latest/reference/tmx-map-format/") and more complex tiled map support for formats based on the ManaSource game engine, including variants like Source of Tales, Land of Fire, The Mana World and others. For more information on the ManaSource mapping format, see "http://doc.manasource.org/mapping.html".
In general, Tiled and "raw" TMX try to be all things to all games. If you can use a tile editor for it, Tiled would like to do that for you. ManaSource is a more specialized engine and introduces new concepts like named "Fringe" layers to make it clear how a humanoid sprite walks through the map, named "Collision" layers for walkability and swimmability, known-format "objects" for things like doors, warps, NPCs, NPC waypoints and monster spawns. Not all of that will be duplicated in Demiurge, but support for such things belongs in the ManaSource-specific TMX parsing code.
In the long run, it's very likely that there will be other TMX "dialects" like ManaSource's. Indeed, Demiurge might eventually specify its own TMX dialect to support non-ManaSource features like procedural map generation. My intention is to add them in the same way - they may be requested in the Demiurge World files in the DSL, and they will be an additional parsing pass on the result of "basic" TMX parsing.
Defined Under Namespace
Classes: TmxCache, TmxLocation