Browsing articles in "Code"

Ship and Boat Name Generator

Jan 28, 2014
Comments Off on Ship and Boat Name Generator

Well, I was. Decided it was time to whip up a new generator. I’ve been meaning to do one for boats and ships. The original intention was to do something chaotic. Instead, I ended up with around 85000 unique ship names from the mostly modern age. The names range from small boats, yachts, and ships. Some names are older, most are quite modern. The generator is available here.

Someday in the future I might do what I originally intended. Until then, time to slack once again.

Comments Off on Ship and Boat Name Generator

Another Dozen Countries for the City Name Generator

Sep 18, 2013
Comments Off on Another Dozen Countries for the City Name Generator

I rolled out a new edition of the City Name Generator with a dozen new countries included in the database. The new countries are: Sri Lanka, Sudan, Syria, Tanzania, Tunisia, Uganda, Ukraine, Uzbekistan, the West Bank, Yemen, Zambia, and Zimbabwe. A fair number of the new entries are not in English. Instead, I continue to increase the number of city names spelled in the native tongue.

The most common request for the City Name Generator is for Country X. If I am missing a country you’d like to see included, send me a comment and I’ll see what I can do. If the data I have available doesn’t include at least a thousand locations, I’m not likely to include it. Find me an awesome data source for that country and I’ll do my best to make it happen.

The majority of my data sets are from a public United States entity. Those data sources are biased toward Americanized names for many locales. Which leads to the second complaint — these names are not part of my country. Often the names are small villages and towns. I think the smaller names are the most interesting given than most people can easily look at a large scale map and find the bigger cities. These complaints are often accurate — the americanized name variant is unlikely to match native names and are apt to cross across the bounds of modern countries into other neighboring countries. Ignore what doesn’t fit or let me know why it is in error.

The city and town name generator is one of the best available today for actual town and village names around the world. I strive to make it the best.

Comments Off on Another Dozen Countries for the City Name Generator

Some Pseudo Math for Dominance in the Social Network Dungeon Experiment

Aug 7, 2013
Comments Off on Some Pseudo Math for Dominance in the Social Network Dungeon Experiment

I’m a full fledged old school gamer so I haven’t used much of the newer mechanisms for encounter balancing. Still, the underlying math attempts to approximate an a metric for dominance levels of creature groups in a constrained environment.

The Challenge Rating (CR)

This is fuzzy math to determine how one creature may measure up against either another average party level and/or another creature. I stumbled on Kaww’s post describing Vorpal Tribble’s approach for determining CR of a creature on the fly.

#1. Divide creature’s average HP by 4.5 to 6.5.
4.5 for 5 HD or lower, 5 for 6-10 HD, 5.5 for 11-15 HD, 6 for 16-20 HD., 6.5 for 20-25 HD.

#2. Add 1 for each five points above 10 its AC is, subtracting 1 for every 5 below.

#3. Add 1 for each special attack (+2 to +5 or more if its got a decent number of spells in its spell-like abilities).

#4. Add 1 for each quality unless you deem it worthy of more. Add 1 for each resistance and 10 points of DR it has, and 2 for each immunity. Subtract 1 for each vulnerability.

#5. Add 1 for every two bonus feats it has.

#6. Divide total by 3. This should be its rough CR

I have a couple of issues with this. The first (#1) is the segmentation of the average HP calculation. While dividing by HD might be more elegant, simplicity is key so I will just use the average in the middle of 5.5.

Most of the games I play use descending not ascending AC so just invert #2. #3 is judgement call so to automate it, I’ll just use the raw number of special attacks. #4 will just use the number of special abilities. Designating one ability over another is complicated so roughly speaking they will just all be the same. My systems of choice have no feats so it will just be ignored. Others may choose to include it.

The simplified calculation is:

CR = (HP / 5.5) + 1 * (#Special Attacks) + 1 * (#Special Abilities)

This ignores AC for now. I will need to source a table that gives some indicator of descending to ascending armor class comparisons. Given the descending nature, I think one bonus CR per 3 points of AC below 10 (9) would work reasonably at first glance. So we could add:

CR += abs(10 – AC) % 3

Then divide it all by 3 per the original calculation.

CR /= 3

Apply this on a per creature basis then average for the group of creatures. This will give a baseline CR for the group. So now there is a rough CR for the creature(s) as a group. Couple that with the number appearing and you can begin to resolve the CR relationship.

CR is Non-Linear

Based on the explanations I’ve read, CR is a non-linear relationship. There is little explanation that determines how 1n CR = 2 CR(n-2) or 1n CR = 4 CR (n-4). There is probably an obvious calculation this non math guy is missing.

My buddy, Keith, came to rescue with a simple approximation

#Appearing * (CR^2) = Dominance Level (DL)

Dominance Level is similar to encounter level in some contexts. Both break down at the extreme of disparate levels. As a rough approximation, it allows for large numbers of lower level creatures to exist within the space of a far more dominant monster.

It is not a perfect metric as Keith explains:

For the moment, though, I would suggest when considering dominance use an exponential-based relationship. The square of the HD would be dead easy, but in D&D 3.x the CR is perhaps a better measure, and one creature of CR n is roughly equated to four creatures of CR n-4 (and two creatures of CR n-2).

By this math 8 CR 3 creatures might be considered roughly equivalent Dominance to a single CR 9 creature (and nowhere near the dominance of a CR 24 creature, 8*3=24 notwithstanding).

Squaring and adding, on the other hand, would give 8*3*3 = 72, while a single CR 9 creature would be 1*9*9 = 81… not so far off, really. For even lower-level creatures you might see 9 CR 1 = 9*1*1 = 9 vs. a single CR 3 = 1*3*3 = 9.

I’m not sure which works better. Nine CR 1 creatures against a single CR 7 creature can be a kind of even fight in the right circumstances (focused fire has some happy effects), but it’ll be touch and go and the CR 1 guys can expect a lot of casualties, possibly TPK. This suggests to me that a lower-CR creature could effectively hold dominance (the single CR 3 creature might be enough to balance them ‘socially’ — equal Dominance score). They could probably beat him if it came to a fight, but would it be worth the trouble and the possibly (likely) casualties?

Dominance Level

DL is not the end-all-be-all metric. It is one of many drivers within a simulated social network driven dungeon. The overall relationships including friendship will determine if one group tries to overtake another. On one hand, if you used it without consequence, the dominant groups would overrun the dungeon. However, those same groups are aligned with other groups or perhaps co-exist so they have no desire to overrun less powerful creatures wholesale.

Comments Off on Some Pseudo Math for Dominance in the Social Network Dungeon Experiment

Affiliation Graphs for Dungeon Stocking — Raw, Random Thoughts

Jul 31, 2013
Comments Off on Affiliation Graphs for Dungeon Stocking — Raw, Random Thoughts

Random thoughts come with random generators. Early in the week, I was cleaning up a bunch of files from prior programs at work and a good part of it was relationship graph code that was targeted at a program which ended prematurely. Arriving at home, I decided to do a functional check of various random generators. One of those was the monster stocker. As I was testing and looking at the raw output, it struck me that rather than having to manually figure out how the monsters fit in a dungeon it would be cool to build up a relationship model. Keith over at In My Campaign has written about Node Based Megadungeon Design. He also happens to be on G+ so I tossed the idea at him last night. His input is intermixed with my own thoughts and I’ve tried to designate his insight appropriately.

Generating random affiliations is a complicated problem. Ad hoc language is easy to describe verbally — the bugbears in areas #2, #7, and #9 have subjugated the kobolds in #3, #5 and #6. Coding that is significantly more difficult. However, if you simplify the relationship into a few definable terms, one can begin to construct the nature of the affiliations between groups. From there, you begin to place those creatures in actual locations in the dungeon. For now, I am going to ignore physical space and just consider building up a rational model of the creatures within a dungeon.

Step 1 – Plausible Population

Assuming a map is available and general metric of the power rank of the creatures, it is simple enough to generate random population of plausible creatures. For simplicity, I will start with a single level dungeon with a single entrance into the world. Say 30 rooms with about 2/3rds of them populated with one creature or another. Just generating 20 creatures is unlikely to be an interesting population. Instead, pick out your random table of choice and do 3-6 times that number of creatures. Massive list, right?

Make it more interesting. Add in a fractional percentage of higher level creatures. Say we did 3X the number of rooms to start. Add in 1/2X creatures from the next level of power. 1/4 from the 2+ the starting point and perhaps 1/8th from 3+. So we end up with a starting population of 90 plausible rank 1 creatures, 15 rank 2, 7 rank 3, and 3 rank 4+. All told, there are 115 possible creatures for a mere 30 rooms of which only 20 will be actively occupied.

Step 2 – Density

Now we have a major pile of creatures that need to be pruned downwards. Nothing gets culled at this stage. Instead, the target population is evaluated for occurrence of the same beasts. This should not be a simple count of Creature Y showed up Z times. Evaluation should consider the number of creatures that could plausibly appear for each room / encounter. So if kobolds show up 3 times in the initial population but 12 of them can occur each time, the kobold density metric is 3*12=36 rather than 3. Thirty six creatures vs a singular purple worm that showed up from one of the upper level tables is significantly different.

Sum up the total creatures plausible then calculate possible density (total # / total possible). The value is between 0 and 1. Honestly, its slightly above 0 and 1 should hopefully never show up in a rational random table.

Step 3 – Segmentation

Next up, divide the population into two groups — actors and outliers. The actors are the top 10% (or whatever cutoff you choose) of the density metric. The rest are not dominant players in the dungeon but may be present. The group of creatures with the highest density is the starting target of the “lair” monster. Assign every creature an appropriate boolean actor flag.

Step 4 – Starting Relationships

Initial seeding of group dynamics can take many forms. Keith suggested a seeding metric based on alignment, Friendship. I considered one based on hit dice, Dominance. For alignment, depending on your preference, you either have 3 or 9 different models. On the ease of use stand point, use Law/Neutral/Chaos. Those with the same alignment get a 1 for friendship, 0 for one step removed and a -1 for opposing views. Granularity for the 9 could be added but I’m keeping the idea as simple as possible.

For Dominance, just look at HD vs HD at a group level. Nine 1-HD creatures can be treated at the 9 HD metric vs something with 3 HD. This is a rough metric; certainly not useful for with something with special abilities and/or other powers. I think a better metric might be using XP per creature as the relationship value.

Both Friendship and and Dominance are a 1-to-1 relationship. Every creature has a friendship and dominance model to every other one.

Next Steps

I’m out of time for the evening. This is a rough, raw look at how I’d begin to assemble a population in code. The outliers of the population need more significant relationships to the actors. Then cycle the “life” of the dungeon a few times to erode/enhance friendship and dominance. Sprinkle in a few more relationship metrics. Rinse, repeat, or deviate. I cannot predict where the idea is going to flow.

Comments Off on Affiliation Graphs for Dungeon Stocking — Raw, Random Thoughts

City Name Generator Update

Jan 17, 2013
Comments Off on City Name Generator Update

Yesterday, I was informed that I’d broken the entries for Wales within the City Name Generator. While I restored the data for Wales, the vast majority of them can be found under England. A mere 130 entries from the original generator data set is not that interesting. Hat tip to James L. for letting me know.

While I was fixing that, I imported a few new countries:

Papau (New Guinea)
Saudi Arabia

The database now contains slightly over 2 million names.

Comments Off on City Name Generator Update

Half Cocked Idea — Automated Living Dungeon

Jan 8, 2013
Comments Off on Half Cocked Idea — Automated Living Dungeon

I’ve been pondering relationship modeling and database elements for a few months. On the long, slow drive home this evening, it drifted further afield into the concept of a truly living dungeon ecosystem. The concept of a changing dungeon environment has been around for decades. The locale is not static — adventures and the denizens are constantly changing. So why not toss together some code and shift things about in a mega dungeon setting? Certainly not a novel idea but it would be fun to try.

Start with an open sourced set of maps and perhaps initial stocking. Then completely rethink how monsters, treasure, and such are distributed. My first cut would be encode rooms not as just a specific location but as something with volume / square footage. Groups of rooms should form zones that are easily controlled or should be utilized as a thematic region. Zones could easily span levels if the entry/exit points are contained within them. Dungeon levels are artifacts of system design. They generally contain a specific level of creature / difficulty. While that could be modeled as a concept, I believe an intelligent stocking / disruption model would serve the same goal.

Monsters details would need to grow beyond simple statistics. The region of influence they could potentially control and the desire to do so are interesting starting points. Further, other creatures they tolerate, manipulate or seek to eradicate are far more complicated factors. A group of ogres can dominate the kobolds near an entrance but are afraid of the beholder. If they have a slave or three, how do they utilize them to defend the space they control or increase their status within the dungeon?

Monsters also have metrics for desire. Perhaps they just want to control an area or grab the loot the adventurers might otherwise get. The relationships with other denizens will drive what do on a daily basis. Fear, greed, survival, etc. might all influence what they undertake. Does the desire for treasure lead them to try to overcome something else?

Treasure and traps would be constantly changing elements. If a minotaur steals treasure from a group of adventurers, he’d would control more loot enticing the greedy residents to attack him. Monsters could use traps as deterrents to enter the zone they control or as warning systems. More intelligent creatures would employ more traps but would have to do so at the expense of other activities.

When no one is around, the dungeon would continue to evolve. Based on some fixed time scale, the creatures would continue to live. They might attack others, build stuff, or undertake other activities necessary for daily life. Every action would result in changes within the dungeon which would be reflected in the current state.

An interesting concept but adventurers are the ultimate disruptive force. Why not enable game masters to enter events such as the death of creatures, stealing of loot, disabling of traps. The changes would then cause a reaction throughout the dungeon. The propagation would then be available to others or the same GM to utilize.

The base map would be unlikely to change. Everything else would need to be available as a download in PDF form. Likely in small chunks such as a couple of levels. Coding it would be damn fun. I’m dubious as to the usefulness. Probably best left as a half-cocked idea than a major effort with no consumers.

Comments Off on Half Cocked Idea — Automated Living Dungeon

By Request: 1E AD&D Character Attributes

Jan 4, 2013
Comments Off on By Request: 1E AD&D Character Attributes

Greetings! I want to thank you for your online AD&D generators. I particularly like the one that spits out a whole pdf of treasure results, that’s a great idea! I have a request if you’re looking for a project: a pdf generator for AD&D ability scores, Method IV (i.e. roll 12 complete sets of 3d6 in order, and choose one). That would rock. – Alex

Well Alex, you get part of the request. MethodIV is now available as a utility along with the 3 other methods. I have not made it direct to PDF yet. Still, you can use the PrintPDF button at the bottom of the results to create a PDF like all of my generators.

Hopefully that serves your immediate needs.

Comments Off on By Request: 1E AD&D Character Attributes