Showing posts with label UVG. Show all posts
Showing posts with label UVG. Show all posts

Sunday, August 18, 2019

Black Ships and Bad Hydrodynamics

I was going to make a quick fun game about boats. Treasure Island, The Odyssey, One Piece. I wasn't going to get caught up in the details of how boats work. I told myself this at the outset, and believed it. I was going to borrow liberally from other, nicer rulesets, and not worry about realism. Now I'm writing about boat hydrodynamics.

When Viking explorers found new lands, they were usually about a week's sailing away. More distant lands were reached by following a chain of smaller stops. This is because they could survive for about two weeks at sea, so one week was the point of no return1. Rather than start with existing historic boats, we can take this type of exploration as our goal, and then work out how best achieve it.

Some Rules

I haven't playtested these, they're just draft rules.

  • Every week, the crew2 rolls against mishaps. An undercrewed ship rolls with disadvantage.
  • An overburdened ship moves at half speed.
  • When there are fewer sacks3 of supplies than people, the ship is at half rations. At half rations, all ability checks are rolled at disadvantage. For each additional week at half rations, an additional die is added to the disadvantage (e.g. on two weeks of half rations, an ability check is the worst result of three dice). This assumes some kind of subsistence fishing, scavenging, rationing, etc. This doesn't kill you directly, but you're going to die.

Mishaps

  1. 1d4 sacks of supplies lost or spoiled
  2. ship damaged - move at half speed (rigging, rudder, etc.)
  3. you are lost
  4. injury among the crew
  5. disease among the crew
  6. stowaway found
  7. becalmed for 1d6 days
  8. ill omen - next mishap check at disadvantage unless the crew makes appropriate supplication

Encounters

Encounters at sea are never by surprise excepting with beasts, and evasion is down to chance (1d4 to evade: on a 1, success, on a 2, success but off-course or lost day).

  1. Global Faction
  2. Local Faction
  3. Foreign Faction
  4. Unaffiliated
  5. Wild
  6. Flotsam or sign

Exploration Sailing

Going back to "islands are a week away", we can interpret this two ways, which I will call the "dense ocean" assumption and the "sparse ocean" assumption. Given the distances and speeds involved, the classical 6-mile hex quickly becomes more hindrance than help, and instead everything is worked out in points and lines. Obviously all these assumptions are different for large ships with large crews, but I don't think those are conducive to the game I'm trying to make here. It's also worth noting that I'm explicitly fitting the geography to the type of game I want to run here, not to any kind of reality.

Visibility

A person can see d km away on a clear day at sea, where:

d = 13 h d = sqrt {13h}

and:
d is distance seen (km) and
h is the height above sea level (m).

This means:

  • A 2-meter person standing at roughly sea level can see 5 km.
  • A person standing atop a 30 m crow's nest can see 20 km.
  • In ideal conditions, smoke rises to a mixing height of 518 m, so can be seen from 82 km away.
  • A bird flying at 4000 m can see and be seen from 228 km.

The Dense Ocean

On average, there is an island one week's travel in any direction.

This means that each day of exploration, there is a 1-in-7 chance of finding an island. Call it 1-in-8 and be done with it.

The Sparse Ocean

On average, the nearest island is 1 week away.

This means that in a circle of radius one week's travel, there will be an expected two islands (start and destination). Here I will make a series of poor assumptions which allow me to simplify my calculations: Assume that the ship will sail in a straight line each day in one of eight directions, and that it will see everything there is to see in that direction. The area seen in one day is then:

A day = 1 8 π ( 1 7 r ) 2 A_day = {1} over {8} %pi ({1} over {7}r)^2

where:
Aday is the area of ocean seen in one day, and
r is the distance traveled in one week.

Then the probability of finding an island in a week is roughly:

P week = 2 × 7 ( 1 8 π ( 1 7 r ) 2 ) π r 2 = 1 28 P_week = 2 times {{7 (1 over 8 * %pi(1 over 7 r)^2)} over {%pi r^2}} = 1 over 28

and the probability of finding an island on any given day is:

P day = 1 7 × 1 28 = 1 196 P_day = {1 over 7} times {1 over 28} = 1 over 196

Exploration sailing is terrible using a sparse ocean.

What about Vikings?

The Draken Harald Hårfagre has a top speed of 14 knots or 25.928 km/hr. If the crew never rests, then the ship could travel 4356 km in a week. If they use birds to find land, then they explore a swath of ocean 4356 km x 2(228) km in one week. The probability of finding an island is then:

P week = 2 × 2 d × r π r 2 = 2 × 2 ( 228 ) × 4356 π ( 4356 ) 2 = 912 4356 π 0.0666 P_week = 2 times { {2d times r} over {%pi r^2} } = 2 times { {{2(228)} times {4356}} over{ %pi(4356)^2}} = 912 over { 4356 %pi } approx 0.0666

and

P day = 1 7 P week 0.01 P_day = 1 over 7 P_week approx 0.01

This is about twice as good odds as with worse assumptions, but still doesn't seem great. I'm sure that realistic exploration sailing had any number of other factors going for it and the math here is all wrong, but for my purposes the Dense Ocean seems more fun anyway.

How Much?

Assume a party of 5 people. We'll say that a week's supplies for one person is a sack, and in addition each person has a sack of tools and gear. So our small ship must now carry 20 sacks of weight (5 people, 10 supplies, 5 gear).

Old ships are measured in tonnage4, the number of tun-casks the ship could fit. From this random image I found, a tun cask takes four people to carry, so is equivalent to 4 sacks. Therefore our small ship is 5 tons.

How Fast?

An early limitation on ship speed is the "hull speed", where:

V hull = 1.34 L WL V_hull ~= 1.34sqrt{L_WL}

and:
Vhull is the hull speed (knots), and
LWL is the length of the ship measured at the waterline (ft).
Strictly speaking this isn't a "limitation", but I must stress that we're talking about terrible boats here.

From the tonnage, we can back-calculate the length of the ship using the Builder's Old Measurement:

T = ( L OA 3 5 b ) × b × b 2 94 T = {(L_OA - 3 over 5 b)times b times {b over 2}} over 94

where:
T is the tonnage (tons burden),
LOA is the over-all length of the ship (from stem to sternpost, ft), and
b is the beam, or width of the ship (ft)
and also using a random rule-of-thumb found on Wikipedia somewhere:

b = L OA 2 3 + 1 b = nroot{3}{ L_OA^2 }+1

(LOA and b in ft.) Finally, we must assume that, for our purposes, the waterline length is equal to the overall length. This isn't a great assumption, but it's not terrible if our boat is built more like a bathtub than a canoe.

With all of this, I wrote a quick ocatve script to generate the following table:

T (tons)LOA (ft)Vhull (knots)
19.52554.1357
212.8374.8011
315.2945.2404
417.3195.5766
519.0745.8523
620.6396.0876
722.0616.2939
823.3726.4782
924.5936.6453
1025.7396.7983

At this point, I started to think I might have lost track of where I started, so I stopped. When someone asked "how fast do boats go" on a Discord server, I just pointed them at this table from Labyrinth Lord:

Underdark-Ocean Island Generator

One more in a continuing series.

Where to get it

The Manse

What is it

Six tables, d6-d12, giving approach, material, monster, hazards, treasures, and inhabitants (1-in-6).

Sample Output

Island 1

  • Well developed. Tons of range markers, buoys, shark nets and docks. If the island is inhabited, there is a steep dock fee. If the island is uninhabited, then this place is long abandoned.
  • Island of bones and insect shells; discarded for centuries as flotsam.
  • Dark-Elf Spellcaster. Very powerful, but water burns her like acid.
  • Glass Dog. It's lonely, but every time it jumps or licks you it deals 1 damage cause it's made of glass. If you managed to catch it and bring it to the mage's guild you'll get a hefty reward.
  • Pearl & Diamond Earring. The matching pair is lost at sea. Worth a few thousand gold.
  • Uninhabited

Island 2

  • Unnaturally calm. Feeling of dread. Roll a random encounter.
  • Island of bones and insect shells; discarded for centuries as flotsam.
  • Ogre Zombie, dressed head to toe in very thick armor. There's actually 1d8+1 of them, they're just all identically dressed, so rumors only ever speak of one.
  • There is a fairy grove on this island, unsual mushroom and lichen instead of trees and grass. But the fairies still play tricks on you, steal your map, make time pass faster, etc.
  • Magic warning sign. If a creature can read any language, then reading this sign forces them to make a morale check to proceed if they aren't in combat or chasing you or something.
  • Uninhabited

Island 3

  • Filled with dark, spooky seaweed. If you fall overboard, they pull you down and drown you.
  • Standard rocky island affair. Mushroom forest and lichen bog; very verdant for a place in the underdark. Elves probably lived here once.
  • Dark-Elf Spellcaster. Very powerful, but water burns her like acid.
  • Poisonous berries and fruits, tainted fresh water. No chance for resupply.
  • Bag of a hundred silver coins. If you spend an exploration turn tapping coins, you have a 1 in 6 chance to find a fake coin that's actually gold underneath a silver paint. About 20 of them are fake.
  • Uninhabited

Notes

I like these ones, they're detailed and evocative. They're definitely tied to a setting, and they might be just specific enough that it's weird to re-use one on a second island. I also think that only 1-in-6 islands being inhabited means the inhabitants table doesn't get enough use, similar to the "exotic materials" table on other generators.


1 This is what the tour guides of The Draken Harald Hårfagre told me, but I might be misremembering.back

2 Following from UVG, a "group" check rotates throughout the crew.back

3 Sacks are another useful abstraction from UVG. A sack is: as much as one person can carry unencumbered; all of a person's prefessional gear; one unconscious human; one unit of trade goods; or enough food, water, and consumables for one person to survive for one week.back

4 These are tons burden (a volume measurement), as opposed to tons displacement (a weight measurement). As an engineer, it distresses me the number of meanings that "ton" can take, but here it is unavoidable.back

Sunday, April 7, 2019

Hapaxes in Context

My last post about Hapaxes in the Ultraviolet Grasslands was well received, even though I was not satisfied with the strength of its conclusions. Here, I attempt to add context to the hapaxes through the use of some inadvisable perl scripts.

Process

Again, I'll assume some familiarity with bash. I'm also using a pair of perl scripts I wrote which probably don't generalize well, but which were fit for purpose. If I'd planned ahead, I'd have written them both as one script.

First, we'll do some very similar things to what we did last time:

$ python3-pdf2txt.py -o UVG.txt UVG.pdf
$ cat UVG.txt |
tr A-Z a-z |
sed -E "s/\s+|['‘’]s\s+|[–—-]+/\n/g" |
sed -E 's/[][<>.,();:+?!%/©&“”"#*]//g' |
sed -e "s/^['’‘]//g" |
sed -e "s/['’‘]$//g" |
grep -Ev "^[0-9d]+$" |
sort | uniq -u > UVG.hapax
$ /bin/diff -i /usr/share/dict/words UVG.hapax |
grep ">" |
cut -d " " -f2 > UVG.hapax.new

As before, linebreaks have been added for clarity, but you'll have to escape them to use this code directly. Also note that this time we remove the possessive "s" from the ends of strings, and we split on hyphens as well as spaces.

Next, we go back to the PDF, but we extract it as XML to access the character position data:

$ python3-pdf2txt.py -t xml -o UVG.xml UVG.pdf
$ cat UVG.xml | ./xml2tsv.pl > UVG.tsv
$ cat UVG.hapax.new | ./pdfmarker.pl UVG.tsv > UVG.pdfmark

The scripts I mentioned earlier are xml2tsv.pl and pdfmarker.pl. The former (very naively) strips extraneous markup, leaving each line with a character, four coordinates, and a page number. The latter reads that tsv file (given as an argument) and locates the coordinates of each word piped to it. (As each word only appears once, this is straightforward.) It outputs these coordinates in pdfmark format, a way to annotate PDFs.

Finally, we merge the annotations back into the original PDF as highlights:

$ gs -o UVG.ann.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress UVG.pdf UVG.pdfmark

Results

This method is much pickier, in part because of the difficulty of parsing a PDF consistently. From the text file, we extracted 164 words of interest, but there are only 139 annotations in the final count. I expect that the difference is words that are represented differently between the txt and xml formats. For example, if the space between two words isn't represented by a whitespace character in the xml, it does not detect as a word boundary when we look for it. But the heuristics that build the text output may still correctly "add" the space back in. This method also considers each half of a hyphenated word separately, so they are more likely to appear multiple times or to be in the dictionary.

These numbers are smaller than before for a different reason also: I have been using the free sample version, so that I can share the results. This is 78 pages, down from 158 pages in the backer version I was using before. So while we can still get a list of the output as before:

rewatch
pusca
eskatin
ashwhite
demiwarlock
vidy
engobes
tollmistress
dejus
orangeware

We can also then go find where these words are highlighted in the PDF:

In the highlighted PDF, it's easier to see that the majority of the hapaxes are proper names and normal words that my dictionary doesn't contain, like "lunchbox" and "calcinous". There are still lots of gems though, like a sign that reads No Lones to Adventerers, Frybooters or Wagonbonds, the goddess Hazmaat, and zombastodon lair. You can take a look here:

Disclaimer & Plug

I still back Luka on Patreon, and I have backed his Kickstarter as well. The Kickstarter campaign is now in its final week, and I'm very excited for it.

The free version of the PDF (available unannotated in the Kickstarter description), is licensed under a CC By-NC-ND 4.0 license. Arguably, because all the changes I have made to it were procedural, maybe this still complies with the "NoDerivatives" part of that. But I don't actually know, so I went ahead and asked Luka and he said this was ok anyway.

Tuesday, March 19, 2019

Hapaxes in the Ultraviolet Grasslands

At the beginning of the glossary of the Ultraviolet Grasslands (UVG), Luka asks: What have I missed? What needs more details? One way to find things that might be missing is to look for hapaxes in the work. This is not a good plan, but I tried anyway.

Process

The following stuff was done in bash. I assume some familiarity with the commands, but comment on particular decisions that I made. It could be cleaned up.

First, we need the corpus as text so that we can work with it:

> python3-pdf2txt.py -o UVG.txt UVG.pdf

Then we clean up the text, and select all the words that only appear once:

> cat UVG.txt |
tr A-Z a-z |
sed -e 's/\s/\n/g' |
sed -E 's/[][<>.,();:+?!%/©&]//g' |
sed -e "s/[‘’]/'/g" |
sed -e 's/[“”"]//g' |
sed -e 's/[–—]/-/g' |
sed -e 's/[-"'\'']$//g' |
sed -e 's/^[-"'\'']//g' |
grep -Ev "^[-0-9'd]+$" |
sort | uniq -u > UVG.hapax

Line breaks have been added for clarity. Parts of this bear closer examination:

sed -e 's/[“”"]//g' |

This could be folded into the second sed statement, but it might be useful to keep but normalize double quotes for some purposes.

sed -e 's/[-"'\'']$//g' |
sed -e 's/^[-"'\'']//g' |

Quotes and hyphens at the beginning or end of a word are unlikely to carry much information, so they are stripped. This must happen after all the dash and quote characters have been "normalized".

Lots of the words that only appear once (6832 now) are not exciting. So we'll remove all the dictionary words:

> /bin/diff -i /usr/share/dict/words UVG.hapax |
grep ">" |
cut -d " " -f2 > UVG.hapax.new

Again, line breaks have been added for clarity. The full path to diff is specified because I've otherwise aliased diff to colordiff.

Results

Of the 1612 hapaxes now left, it might be interesting to see how the characters are distributed.

> cat UVG.hapax.new | fold -c1 | sort | uniq -c | sort -gr

This gives a table of character frequency:

3223
1647e
1295a
1155i
1106o
1097r
1016s
1010n
916t
877l
837-
. . .
   43
3 
38
2ô
2ç
29
27
1Ö
1ñ
1ë
1â

The most common "character" is blank, and I suspect this is related to newlines (3223=2*1612-1). The other "blank" character appears to be a space that did not get stripped out initially, or which was later re-introduced. Perhaps it is some kind of other whitespace.

The most exciting thing in this table (I think) is the high occurrence of the hyphen. This means that roughly half of the "hapaxes" are likely composite words, and worth considering separately. For example:

sub-node
six-lives
noble-pillared
mercy-is-weakness
marrow-beet
curse-maddened
six-limbed
force-glass
stock-piled
self-regenerating

Disregarding hyphens, these are all words a dictionary knows, but which Luka may be using in novel ways.

The remaining (unhyphenated) words, are a mixed bag. Take this random sampling:

pyrokinetic
skalin
psionics
dustland
irshe
replicator
10x
visec
mearls
mirodar

Many of these just show the limitations of my dictionary ("pyrokinetic", "replicator"). Some of them show the limitations of the process ("10x", "jrientsblogspotcom"). Some are ad-hoc compound words ("dustland", "malicereflective"). The rest are either made-up, proper nouns, or typos, and I don't have a way to distinguish between them. It's possible that some of these were "created" by pdf2txt, which uses tunable heuristics to decide where to draw word boundaries.

If you're interested in playing with the lists, I've uploaded them here. They are split into "hyphen" and "nohyphen", and should be alphabetical.

Disclaimer & Plug

I back Luka on Patreon at the $1/mo level, which grants me access to early drafts of his projects. The version used for this project was the most recent version available to backers, but it has not been edited.

UVG is currently running a Kickstarter for a fancy printed version with editing and more art. There's a link to a free version of the manuscript there too.