ottomap

command module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2024 License: AGPL-3.0 Imports: 28 Imported by: 0

README

OttoMap

OttoMap is a tool that translates TribeNet turn report files into JSON data.

A future version of the tool will convert the JSON data into a map.

WARNING OttoMap is in early development. I am breaking things and changing types almost daily.

License

OttoMap is licensed under version 3 of the GNU Affero General Public License.

OttoMap is built using packages that have different licenses. All of these packages must be used in accordance with their original licenses; including them in this application does not change their license terms to the AGPLv3.

Please see the individual packages for their license terms.

Overview

I'm planning on translating a small subset of the turn report. See the files in the domain directory to get an idea of what we're looking at.

I think that will be enough data to feed the map generator. Let me know if you think that there's something missing.

See the OTTOMAP.md file for an overview of running from command line and BUILDING.md for instructions on building the project.

Input Data

OttoMap expects all turn reports to be in text files in a single directory.

OttoMap loads all files that match the pattern "YEAR-MONTH.CLAN_ID.input.txt." YEAR and MONTH are the three-digit year and two-digit month from the "Current Turn" line of the report. CLAN_ID is the four-digit identifier for the clan (it must include the leading zero).

$ ls -1 input/*.txt

input/899-12.0138.input.txt
input/900-01.0138.input.txt
input/900-02.0138.input.txt
input/900-03.0138.input.txt
input/900-04.0138.input.txt
input/900-05.0138.input.txt

The files are created by opening the turn report (the .DOCX file), selecting all the text, and pasting it into a plain text file.

$ ls -1 input/*.docx
input/899-12.0138.Turn-Report.docx
input/900-01.0138.Turn-Report.docx
input/900-02.0138.Turn-Report.docx
input/900-03.0138.Turn-Report.docx
input/900-04.0138.Turn-Report.docx
input/900-05.0138.Turn-Report.docx

$ file input/*

input/899-12.0138.Turn-Report.docx: Microsoft Word 2007+
input/899-12.0138.input.txt:        Unicode text, UTF-8 text
input/900-01.0138.Turn-Report.docx: Microsoft Word 2007+
input/900-01.0138.input.txt:        Unicode text, UTF-8 text
input/900-02.0138.Turn-Report.docx: Microsoft Word 2007+
input/900-02.0138.input.txt:        Unicode text, UTF-8 text
input/900-03.0138.Turn-Report.docx: Microsoft Word 2007+
input/900-03.0138.input.txt:        Unicode text, UTF-8 text
input/900-04.0138.Turn-Report.docx: Microsoft Word 2007+
input/900-04.0138.input.txt:        Unicode text, UTF-8 text
input/900-05.0138.Turn-Report.docx: Microsoft Word 2007+
input/900-05.0138.input.txt:        Unicode text, UTF-8 text

Spaces, line breaks, page breaks, and section breaks are important to the parser. Please try to avoid altering them.

Grids and the Big Map

The big map is divided into 676 grids arranged in 26 columns and 26 rows. The grids use letters, not digits, for their coordinates on the big map. The grid at the top left is (A, A), top right is (A, Z), bottom left is (Z, A), and bottom right is (Z, Z).

The ID for a grid is row then column. The ID for the grid at top left is AA, top right is AZ, bottom left is ZA, and bottom right is ZZ.

Each grid has 30 columns and 21 rows. The hex at the top left is (1, 1), top right is (1, 30), bottom left is (21, 1), and bottom right is (21, 30).

The ID for a hex is two-digit column then two-digit row. The ID for the hex at the top left is 0101, top right is 3001, bottom left is 0121, and bottom right is 3021.

Hexes are "flat" on the top and even rows are shifted down. For example, hex (13, 10) has

  1. (13, 9) to the north
  2. (14, 9) to the north-east
  3. (14, 10) to the south-east
  4. (13, 11) to the south
  5. (12, 10) to the south-west
  6. (12, 9) to the north-west

In turn reports, a hex in the grid is usually displayed as "AA 1310."

You can convert grid coordinates to big map coordinates. A coordinate like "VN 0810" is "(N8, V10)." That's row N, column V on the big map, then column 8, row 10 on the grid.

You can convert also convert grid coordinates to absolute coordinates by scaling the column and row values. For our coordinate of "VN 0810," "N" is the 14th grid from the left and "V" is the 22nd grid from the top. This gives us a column of (14 - 1) * 30 + (8 - 1) = 397 and row of (22 - 1) * 21 + (10 - 1) = 450, or (397, 450) (We subtract one before multiplying because absolute coordinates start at zero, not one.)

Parsing Errors

The report processor has been updated to fail on unexpected input. I know this is annoying, but it prevents bad data from going into the map.

There are two causes for this: typos and new scenarios.

Fixing typos in the input

Typos don't happen often, but when they do, you need to fix them and restart. If you don't understand what needs to be fixed, please ask for help on the TribeNet Discord's #mapping channel.

New scenarios

This is more common than typos since TribeNet supports so many actions.

You'll usually find a new scenario in the Scouting results. I need to update the code and the test suites, so please ask for help on the TribeNet Discords #mapping-tool channel.

Adding code can take a while. In the meantime, the only work-around is to delete the new scenario from the input and restart. Results for that unit are going to be "off" until the code is fixed, but you'll be able to map out the rest of the turn.

Big Map notes

big_map_crossing

Hex Movement

The map has flat hexagons with odd columns shoved down. (I know, 0201 is SE of 0101, but 0101 is really (0, 0).)

// hexDirectionVectors defines the vectors used to determine the coordinates
// of the neighboring column based on the direction and the odd/even column
// property of the starting hex.
//
// NB: grids start at 0101 and hexes at (0,0), so "odd" and "even" are based
//     on the hex coordinates, not the grid.
var hexDirectionVectors map[string]map[string][2]int

grid1206

hexDirectionVectors["odd-column"]= {
    "N" : {+0, -1}, // ## 1206 -> (11, 05) -> (11, 04) -> ## 1205
    "NE": {+1, +0}, // ## 1206 -> (11, 05) -> (12, 05) -> ## 1306
    "SE": {+1, +1}, // ## 1206 -> (11, 05) -> (12, 06) -> ## 1307
    "S" : {+0, +1}, // ## 1206 -> (11, 05) -> (11, 06) -> ## 1207
    "SW": {-1, +1}, // ## 1206 -> (11, 05) -> (10, 06) -> ## 1107
    "NW": {-1, +0}, // ## 1206 -> (11, 05) -> (10, 05) -> ## 1106
}

grid1306

hexDirectionVectors["even-column"] = {
    "N" : {+0, -1}, // ## 1306 -> (12, 05) -> (12, 04) -> ## 1305
    "NE": {+1, -1}, // ## 1306 -> (12, 05) -> (13, 04) -> ## 1405
    "SE": {+1, +0}, // ## 1306 -> (12, 05) -> (13, 05) -> ## 1406
    "S" : {+0, +1}, // ## 1306 -> (12, 05) -> (12, 06) -> ## 1307
    "SW": {-1, +0}, // ## 1306 -> (12, 05) -> (11, 05) -> ## 1206
    "NW": {-1, -1}, // ## 1306 -> (12, 05) -> (11, 04) -> ## 1205
}

Documentation

Overview

Package main implements the ottomap application

Directories

Path Synopsis
Package authz implements insecure and untrustworthy authorization routines.
Package authz implements insecure and untrustworthy authorization routines.
Package cerrs implements constant errors.
Package cerrs implements constant errors.
Package directions defines the directions on the map.
Package directions defines the directions on the map.
Package domain defines the data types used to parse the turn reports and (in an unknowable, far away future) generate maps.
Package domain defines the data types used to parse the turn reports and (in an unknowable, far away future) generate maps.
domains
Package lbmoves implements Land Based Movement parsing and map generation.
Package lbmoves implements Land Based Movement parsing and map generation.
Package maps implements a conversion to Worldographer files.
Package maps implements a conversion to Worldographer files.
movements
Package movements implements a Pigeon parser for unit movements.
Package movements implements a Pigeon parser for unit movements.
report
Package report implements a Pigeon parser for turn reports.
Package report implements a Pigeon parser for turn reports.
scouts
Package movements implements a Pigeon parser for unit movements.
Package movements implements a Pigeon parser for unit movements.
turn_reports
Package tribe_turn implements a parser for tribe turn files.
Package tribe_turn implements a parser for tribe turn files.
turn_reports/headers
Package headers implements a Pigeon parser for turn report headers.
Package headers implements a Pigeon parser for turn report headers.
turn_reports/locations
Package locations implements a Pigeon parser for unit location.
Package locations implements a Pigeon parser for unit location.
turn_reports/movements
Package movements implements a Pigeon parser for unit movements.
Package movements implements a Pigeon parser for unit movements.
turn_reports/sections
Package sections implements parsers for lines in a report section
Package sections implements parsers for lines in a report section
units/locations
Package locations implements a Pigeon parser for unit location.
Package locations implements a Pigeon parser for unit location.
units/movements
Package movements implements a Pigeon parser for unit movements.
Package movements implements a Pigeon parser for unit movements.
Package server implements a web server for Otto.
Package server implements a web server for Otto.
Package way is a copy of Mat Ryer's way package.
Package way is a copy of Mat Ryer's way package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL