Jul 22, 2019

Pathery Map Generator

This blog post is a help document for Pathery's Map Editor's Map Generator. This document assumes you already know how to use the editor before it had BlockCode. At time of writing, the feature isn't released yet.

The above is an example of Pathery BlockCode. The upper four rows in this example are the base map, declaring a few start locations, an end, and two selector groups. The lower three rows is the block code that manipulates the map for a desired generator outcome. An example outcome of this generator is:

Lets dive into this one line at a time.

ReplacePoint 1 Rock EndOfLine
ReplacePoint [FromBlock{1}] [ToBlock{1 or more}] EndOfLine
The ReplacePoint Command looks for blocks matching the FromBlock type, and randomly replaces them with the ToBlocks. In the example above, the top right 1 selector was replaced with a rock.

(Note to self: Known bug: If a user attempts to place out more blocks then their selector FromBlock has spaces for, the page will bug out due to extra text provided in the AJAX return.)

Fill 2 Rock EndOfLine
Fill [FromBlock{1}] [ToBlock{1}] EndOfLine
The Fill Command looks for blocks matching the FromBlock type, and replaces all of them with the ToBlock's type. In the example above, the six lower rocks are from this fill command.

Empty EndOfLine
Areas without commands are fine. Above these two blocks is an example of empty space existing before a command block. If non-BlockCodes are provided before a command, they will be ignored.

ReplacePoint Start Void Void Void EndOfLine
ReplacePoint [FromBlock{1}] [ToBlock{1 or more}] EndOfLine
FromBlocks are allowed to be any map placeable block (all standard blocks and the selector BlockCode. In the above example, three of the start locations were replaced with void spots.

SurroundPoint 1 Rock EndOfLine
SurroundPoint [FromBlock{1}] [ToBlock{1}] EndOfLine
The Surround Point Command select a random FromBlock and places it's ToBlock type in the four orthogonal directions. This will replace whatever block is on those squares, pre-existing or placed by BlockCode earlier. Blocks to be placed that would be off the map are ignored instead.

(Note to self: Known bug: If a user attempts to use a FromBlock that doesn't exist, the page will bug out due to extra text provided in the AJAX return.)
The last component you need to know to create the majority of maps on Pathery is the OR and Percent BlockCode. The following image and BlockCode is an idea from 是我人 to combine both Normal and Complex into a single map. This includes OR blocks, which are equal chance options of multiple command blocks, as well as percent chance sections appearing after the last ToBlock of a command set, which gives a chance that a given command set won't fire. This also has dynamic waypoints, allowing the 1 section to have 1 or 2 waypoints, allowing the 2 section be the next waypoint (either B or C), then 3 to 5 more waypoints after that, correctly selected starting at C or D based on the previous rolls.

(Note to self: Fix wall count so that it works, allow it to softly fail, document it.)

(Note to self: Document how to view the soft errors via JS's console view, or code it into the UI to naturally view it. Document Multi ORs. Document Last % and NotLast %. Make icons for these two.)

(clicky for big)


[ToAdd: SurroundBlock, OR blocks, Percent block]

No comments: