Friday, July 22, 2011

Settlement attributes

After almost finishing the shopkeeper code for selling and buying stuff yesterday (more tests need to be done and there are a few item generation bugs) I used the time before breakfast to implement a new settlement attribute. The idea here is that in the end each settlement will be described by a set of attributes that modifies its general apearance, the way it works and the way how the inhabitants might act.

Currently I only have two settlement attributes:

  • alignment, which currently only modifies the helpfulness of it inhabitants but at a later point will be used to generate a random set of laws for the settlement influencing what you can do and what you can't, how serious punishment will be and so on;
  • wealth, which influences the amount of items in shops, priced being offered when selling and buying and the individual wealth carried by beings.
I guess there are a lot more interesting attributes that might be used for a settlement. I would love to hear your ideas? What would be additional attributes, how could they be named and what effects should they have?


  1. Would religion work as an attribute? For example if they are religious enough they'd have a central temple with altars where most of the towns people would gather, clothed in robes for prayer/worship.

    On a kind of related note, I found a metropolis(very cool) but there was a 1-2 second lag every step I took, i'm guessing this is due to costly pathfinding of the NPC's, I had to flee the city after about a 1/5th into exploring because the lag was getting to me. Do you plan to optimise the pathfinding at some point?

  2. Religion sounds very good :-)

    Concerning path finding: The algorithm already is pretty optimized A* stuff but I guess that there are too many beings with too much room to move around and all simulate a basic daily routine (getting up, leaving their homes, getting back, etc.). Currently my idea is to (a) reduce maps a bit in size and add more homes without real content (e.g. just stone blocks) as I believe that this will both help to enhance speed and make it easier to find the interesting houses in a settlement. That's a topic for another post ;-)

  3. I'm sure you've thought of it or will, but settlements belonging to other races. If you're human, an orc settlement could basically be a hostile dungeon.

    Level of crime. I'm sure some settlements will have cutpurses, but some might even have a full-blown mafia for you to clean up. Or join.

    Athens v. Sparta. Some cities may be militant and a real boon to fighters, whereas others might be just a bunch of philosophers, priests, or mages that only sell books and robes.

  4. Would the idea of trade between settlements fall under this attribute?

    Maybe the settlement's primary imports/exports and maybe even their trade agreements with neighbouring settlements.. Something like that :)

  5. Oppression or freedom: Some settlements sould be heavilly policed, well ordered. On the other extreme are those that are more anarchic.

    Age of settlemet: Older settlements would have more stone buildings, a larger cemetery

    It would also be good if there could be unique features in towns such as statues, oracles, inns etc. And I think wealth should effect the buildings in a settlement too.

    Axes high!

  6. Some really interesting ideas here. A well oiled set of town attributes should give nice diverse range of towns even when randomly generated.

    For the most organic results, I think you should focus on the real roots of what makes a town what it is. Some of the ideas above (crime for example) I would see as affects of other attributes, rather than as attributes in their own right.

    Age of Settlement, Oppression/Anarchy (I want to call it order but that clearly has it's own meaning in these circles) and Piety are all great examples of independent, root attributes that lead on to social effects.

    I think wealth as a single attribute could be slightly limiting. A huge amount of a real town's social makeup is driven not by average wealth, but by the gap between rich and poor. Perhaps you could add a wealth distribution attribute.

    A low value would make the wealth of each individual very close to the town's 'wealth' attribute. As in life, this would lead to lower crime, very few beggars and a happier, more community spirited populace.

    A high value would make the individuals wealth vary widely from the town's 'wealth attribute'. You would have pockets of wealthy houses (perhaps gated communities) and slum type areas. Crime and begging would be rampant, the populace would be on edge, unfriendly, jealous, exploitative and distrustful.

    Culture as an attribute could be interesting too. A more cultured town would be more ethnically diverse and (borrowing from Bennett's comment) would tend toward philosophers, priests, or mages as inhabitants.

    Better still, these effects could be derived from a combination of the age of the settlement and it's wealth. So a town that is new and wealthy would be crass and tasteless whereas one that had matured with it's wealth would be more cultured and refined.

    It's a really interesting topic!

  7. How about a xenophobia attribute to determine hostility to other races/species? You could weight it so, for example, orcs would be very likely hostile to everyone else or make it random, maybe even base it on intelligence.

  8. Holy shit those are amazing ideas! Can't wait to see them implemented. :o

  9. The attribute system for towns will go a long way in establishing an interesting set of random locations, quite promising.

    Sentience - a measure of how 'advanced' the inhabitants are, ranging from frogmen and other barely civilized beings all the way to humans etc. This would essentially affect the type of buildings (dung huts or even untamed caves, holes being the most primitive) the type of quests offered, possibility of barter/trade and technological limits for items (only wood, leather/pets and stone for instance)

    habitat - chosen from above/below ground, underwater, treetop, caves, mountain etc. (obviously depending on what is available from map placement and what race will inhabit it) these categories would radically alter the way the town looks and the type of constructed features present.

    militarism - the range of this attribute would affect the amount of fortifications/military buildings on site, how well armed the general population is, how many weapons are sold in shops, the amount of guards and warriors there are, how skilled at fighting the general population is.

    government - who has power over the settlement at the moment ? (opening up a plethora of gameplay and quest opportunities)

    king/queen, council members, the elder, vassals, tyrant, slavers, bandits, malevolent/benevolent spellcaster, invading force (oppressive orc battalion e.g.), foreign entity (beholder mindcontrolling the whole village or a dragon, demon e.g.), revolution (they are rebels from the main faction), warden (its a prison colony), military outpost, gypsy settlement etc.

    I warmly offer these suggestions in the hopes to avoid the godawful cliche of there being a square box with a village elder of whatever-race-have-you. -That- should not be the extent of randomness. Any of the above suggestions and/or the combinations thereof would add -true- and interesting variety to random settlements.

  10. The attributes of a city should be related to the area it's in - no one should find a rich, happy city in the middle of a dangerous desert. In general, there should be well-populated, civilised areas with rich, lawful towns, and distant dangerous less populated areas with some chaotic settlements (but bigger and tougher dungeons to explore).

  11. Wow,

    when you thought randomly generated dungeons were cool... randomly generated settlements with such attributes system... my mind. It is blown!

  12. I'm liking obscenelygreen's disparate wealth attribute, slums and beggars is oh so ADOM like in charm.

    TB: I hope you will open up some discussion on A* optimization as there is a couple of links i'd like to share on the subject for your consideration. I wouldn't like to sacrifice what you have already, it's just too awesome to truncate.

  13. I remember an older blog where you mentioned that the character's fame would influence the other NPCs that he met.

    It would be great to combine this with the settlement attributes so that villagers are more helpful and the town has more wealth if the character has completed quests for the residents.

    As an example, say you are given a quest by the head of the village to slay a raider lord in the nearby area (hmm, sounds a bit familiar). The reward would be increased friendliness from the villagers and reduced prices and better items in shops.

  14. Remember that no man is an island, and neither is a city. What I mean is that independent city-states is fun, but in a real world, these cities would be organized in higher-level groups, such as baronies and kingdoms.

    A logical way one can implement this, is to generate a template set of attributes defining a kingdom (or barony or empire etc.), and cities in that kingdom inherit these attributes, but with randomly generated divergences from this template.

    Of course, some attributes are more likely to vary within the same kingdom than others. Size of the cities, for instance tend to vary a lot, while race might vary less within the same kingdom.

  15. Language. For cities with just a single race, that race's language would obvious. But I imagine there would also be some cosmopolitan cities with a multitude of different races, and in those cases it would be interesting if it was possible for different languages to dominate.

    Industry. What the city's main industry is. So, for instance: agriculture, timber, mining, smithing, education, mercenary work, etc. This would influence the likelihood of finding different skill trainers, different types of item being on sale, different buildings being present, and so on.

  16. First comment, just wanted to say, love all the attention JADE is getting. Haven't tried it yet, waiting for the first build that's considered "playable", but my brother had a lot of fun with JADE 0.1.0!

    I'd like the alignment for a settlement to be based on the average alignment of all of the people living there, so it could change over time. For instance, a Chaotic Evil priest with high charisma travels to a neutral town, and as he converts villagers to his religion, the alignment of the town starts to shift towards chaotic.

    I would also like to see the alignment of the town separate from the alignment of the government. For example, you visit a town and discover this:
    Government Alignment = Lawful Evil
    Population Alignment = Chaotic Good

    Looks like revolution is in the air!

  17. Building off of several previous comments, you might consider Literacy as a variable, with higher Literacy resulting in more signs that could be 'l'ooked at for directions in town. Or chopped up to make arrows. Or whatever.

    As for making the maps smaller to reduce lag, you might also consider having several smaller maps make up the one city, such that there would be different sections into which one could travel. This might create some difficulty in getting lost / being unable to exit to the overworld without finding a city gate instead of a path to another neighborhood, but it could compartmentalize and reduce the strain from pathfinding AI while maintaining the vast size of a Metropolis. If a city were big enough (I don't know the scale), you might consider even having it take up multiple tiles on the overworld map.

    Building of off Bennett and EbbeLockert, the mention of Athens & Sparta makes me think of city-states and their colonies as another alternative to kingdoms, baronies, etc. Some other variable covered above (or a combination of lawfulness and alignment and comparative wealth, or something) could even then be used to determine a colony's loyalty to their mother city. It's dry reading, but Thucydides's history of the Peloponnesian war covers exactly those sorts of conflicts between city-states. And the idea that JADE might someday have that stuff happening in the background is just... awesome.

  18. About rho's idea of language: I remember a MUD years ago where you could get skill in different languages. If a character (not necessarily a NPC, even a PC!) talked in a language different from yours, the message would be garbled in proportion to your skill.

    E.g., John says in Elvish: "I hate ratling food".

    A player with 100% skill in Elvish would see

    John says in Elvish: "I hate ratling food".

    A player with 75% skill in Elvish would see:

    John says in Elvish: "I womble ratling food".

    A player with 25% skill in Elvish would see:

    John says in Elvish: "Lungle womble wamba food".

    A player with 0% skill in Elvish would see:

    John says in Elvish: "Lungle womble wamba mungle".

    In this MUD, words were changed to randomly generated meaningless words, but it could also be interesting to try working with characters instead of words.

    Maybe it's not as fit for a single-player game but it would be nice to see some kind of variation of this in JADE.

  19. I think it would be cool if the level of nobility or wealth was generated high enough that a city might be composed mainly of a large, multiple level castle/temple.

    Another attribute that would be interesting would be port towns offering ferrys to other civilizations/dungeons/areas

    Also lots of random events such as cities having catacombs/sewers infested by thieves/mutants/goblins that sneak up to town at night rob, kidnap, break into buildings at night and players are recruited to clear out sewers

    Also another attribute could be the distribution of races in a village i.e. 75% human, 20% dwarf, 3% gnome, 2% other

    not really an attribute i dont think but I want floating cities :)

  20. - if it is a 'crafters'' town full of workshops, (mining town too?) or if it's importing goods thus has to be rich (from trade for example, think about ships, ports and also 'caravans', I mean, they don't really need to be working, just be there)

  21. Hm, I'd say:

    Every measure of town might need a secondary value of "variance", i.e. how far can the individual inhabitants differ. For example, a human town with zero racial variance will be inhabited solely by humans, a town with small variance will have some people of other races, then we get ghettoes and minority parts of town, until at the high end the town becomes a hotchpotch of races and you wouldn't know that it was originally a human town except for some features like the architecture of prominent buildings.

    The same way with religion: low variance gives you a theocracy or almost-theocracy while a high one gets you a multicultural settlement.

    For wealth, this would be essentially the wealth distribution already mentioned.

    Similarly for alignment, a lawful town with small alignment variance would have no crime since everyone would be lawful, but as the variance gets higher, you get criminals and eventually a full-fledged mafia (mafia would THRIVE in a lawful community where people are opposed to violence)

    So, what other attributes there could be? A fun one would be the degree of magic, essentially how much "fantasy" the settlement is. 0 would be a completely mundane place like a farming village. Nobody uses magic, there's nothing weird there, no haunted houses, etc. Everything just like in our world. As the magic level rises, you get more weird stuff, more wizards, necromancers having fun at a local cemetery, buildings disregarding the normal architectonical rules (for example having top floors significantly larger than bottom ones), eventually going for floating buildings or islands, water flowing upwards, having the mayor be a ghost without anyone batting an eye, having different seasons in different parts of town at the same time etc.

  22. What about random event towns as well? Ones being plagued by pestilence or a random werewolf stealing lil babies? Encounters with pestilence citizens would make you sick until the town was cured....