Page 1 of 7 123 ... LastLast
Results 1 to 10 of 62

Thread: An attempt at mapping using economics.

  1. #1
      Redrobes is offline
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,763
    Blog Entries
    4

    Info An attempt at mapping using economics.

    This is probably going to be a big thread for me and I have been putting off starting it but, well, theres been a number of posts in the last few days so now is as good a time as any.

    I have had an idea for a very long time to try to make a map using character economics. I mentioned it in this thread and in there I said it was an old idea. So this has been rattling about in my head for a few years now.

    The idea is to make a program that auto generates a map by monitoring a continuous simulation of the everyday life of characters in a fantasy village or town. The basic premise is that we randomize some stats for some characters - and these stats will be nothing like D&D or game stats - and then let them loose. They will do stuff to satisfy their needs and desires one of which is greed so that they attempt to maximize their wealth. So its like running SimCity in full auto mode but in fantasy.

    I know of lots of people who have made auto generating mappers and some auto city mappers but these fall into several camps. One is the pure random approach and the other is fractal or L-system. Now I am not saying that any of these systems is a bad one but I personally have no faith that they will encode the complexity of human (or non human) behavior. We don't build random cities. They are grown.

    Theres been many people who post up generators for characters and I have even seen one which tracked a persons state, got them married, had some kids and died. So that it generated a full town listing of all characters will spouses, brothers, children, parents and a full obituary. So thats not so different from what I have in mind.

    The key thing tho is that I don't know of anyone yet who has tried to plot the map of that village of tracked people.

    I mentioned in that thread a while back that its a very ambitious project and a very hard program to code up. For about a month now I have been scribbling making notes and drawing a lot of tables, boxes and arrows and I think I have whittled it down to something that I can code.

    I have for a while been hacking it out. I took GeoTerSys and gutted it and reinstalled a new set of commands. Then set about writing up the tables of stats, items, world, and transactions. I have been coding for some days now and not got to run it and produce a single pixels worth of map yet but I can dump the status and get about 10 screen full's of stats and I made the very first transition tree search the other day. So I *think* it might be possible that this is still a goer. But I am not entirely sure I have to say.

    The program is another of my closed source things - sorry - but I will be dishing out betas (with maybe some small limitations) to anyone who wants to have a go. I don't really know where this will end up. Maybe it works real well and maybe it falls flat. I may use it to model other non fantasy mapping too cos I am programming it as an engine so we change rules and items and we simulate something else. So I just don't know.

    So where am I with it. Whats the dirt ? Well I have scribbled out what I think is the minimum set of stats, needs and so on to get one human into a base map and start working on it. Oh I should also say that you do in fact have to enter a base map. That consists of just a 4 color bitmap showing where the trees, ground, rock, and river are. The idea is that the map it produces will fit into that layout so you can take a bit of your world region and just blat down the basic resources available and then let it grow a city on top of it.

    So far a human will wander around and never die of starvation or thirst but would like less of each. He does not die from lack of sleep or exposure but will really want to prevent being subject to them. He will have basic skills in everything a peasant might do and carry basic tools like an axe, a hammer, and also have some grain on him for planting. He starts with no money, no house, no land, no quantifiable possessions of any type.

    Then he can move to water and drink, chop down a tree into logs, plant some grain, bash up some rock or rest on the ground. These things I call transactions and will satisfy some thirst, hunger and rest or increases his wealth in the case of the logs which are worth more (to him) than trees or aggregate being worth more than rock in the ground.

    The idea is that he must satisfy his needs and then optimize his desires by looking at the supply and demand of all item types from his point of view (which might be different from the next man in which case there is scope to trade).

    Once I have him drinking, planting corn and eating, I am hoping that he will build a log cabin, a house or a shack or something. His choice on what and where he builds it might be beneficial to him or a detriment. As he moves about it will track the paths he is laying down and I hope from the choices that people make and the paths they use to get about it will eventually generate a map.

    It will also generate a full list of characters with stats like some of the other programs out there, but, it will also have their skills, their bio, history, their current state and even their future desires. And it should all make sense. I.e. We will know that Bob cuts trees and sells them to Jim the blacksmith and we will know for what price and how often. We will know how much tax is required to keep the village operating, who owns and has inherited all the buildings. It will have a kind of newspaper of notable events like major burglaries, scandals, devastation, invasions and so on.

    The output map might be quite simple and used as a basis for a more sophisticated renderer such as something that POVray or a 3D app or virtual tour might be able to use. My intention is that it will take the base maps out of GeoTerSys (tho its designed to be a breeze to put these in manually) and then, aside from writing a bitmap of the village, write out a set of files so that ViewingDale can move around and access all the extra info about the people on the map. But neither of those apps will be required for it to be extremely useful.

    Yeah its a tough programming exercise and I am not saying that I will be capable of actually making it happen. But I have started on it and ill post about its progress right here ! But I reserve the right to quit on it and not look like a ninny, OK ?

  2. #2
      Crayons is offline
    Guild Adept Crayons's Avatar
    Join Date
    Jun 2010
    Location
    UK
    Posts
    309

    Default

    Cripes!!
    That sounds, sounds... incredible! I'd definitely love to see results from this, even try your beta stuff? I'm pretty sure now that I can't write this sort of thing myself but I've studied physics and electronics and I've spent most of my life looking at pure logic (of the electroinic kind) so I can analyse stuff. If I can help in that area, let me know!
    You've obviously considered the complexity of this rather seriously. How deep into commodities and skills are you going to go? Are you going to allow external economic stimuli or natural disasters or.. or... crikey.
    If it ever get's far enough to need a 3D guy, definitely let me know!
    Very best of luck!
    --
    "I do not know whether I was then a man dreaming I was a butterfly, or whether I am now a butterfly dreaming I am a man"

    My Finished Stuff
    ............. Some of my 3D Stuff (POVRay)

  3. #3
      tilt is offline
    Community Leader Facebook Connected tilt's Avatar
    Join Date
    May 2010
    Location
    Trelleborg, Sweden
    Posts
    4,657
    Blog Entries
    2

    Default

    wow - that sounds awesome ... and that could be legen.... wait for it.. .dary
    I'm very impressed of you even thinking of making such a complex program - really cool ... and I so got a vision of "settlers" when I read your text, always love those cute little graphics of the people going around doing their jobs. So WHEN you get it all to work - add cute graphics - then we can just sit an watch a city build it self
    Really looking forward to seing how it progress... and dump some screens and stuff once in a while
    regs tilt
    :: My art on Deviant Art :: My mapping blog tilts fantasy maps :: My work Catapult - Perry & Gehrke - EasyTruckIT ::
    :: Finished Maps :: WIP Cartographia - Breakwater -Market -Lands of Twilight -Battle City :: Competion maps Iron Giant ::
    :: FREE Tiles - Compasses :: Other Taking a commision - Copyright & Creative Commons ::
    Works under CC licence unless mentioned otherwise

  4. #4
      Ramah is offline
    Guild Expert Ramah's Avatar
    Join Date
    Mar 2009
    Location
    Nottinghamshire
    Posts
    1,326
    Blog Entries
    3

    Default

    Good luck with this. Sounds very intriguing and I'm looking forward to watching it progress.
    Royal: I'm very sorry for your loss, your mother was a terribly attractive woman.


    My Cartographer's Guild maps: Finished Maps


    More maps viewable at my DeviantArt page: Ramah-Palmer DeviantArt

  5. #5
      Talroth is offline
    Guild Journeyer
    Join Date
    May 2008
    Location
    PEI, Canada
    Posts
    213

    Default

    I'm very interested in what you are planning to use for developing this system. I would love to see you keep a development journal for everyone to read and maybe share ideas. Have you picked a language or any packages to work with yet?


    I'm thinking a system that takes a rough, low res height map + tile data and then generated refined grids only in areas your AI actually uses may be a good path. This could allow you to do fairly decent sized regions without needing the entire high-res data set to work with, so you save yourself some hard drive space. (Especially useful if you want to save milestones of your simulation so you can go back and nudge things later.)

    Also consider how often you actually update a given AI entity. If an AI has their home, their fields, production levels, and trade agreements, then you can basically freeze the majority of their AI and let the program focus on the trade alone. Pathing between their usual routes doesn't need to be updated, just stored for density factor. (If too many other AI attempt to use the existing paths, then it may trigger an upgrade to the road, or force other AIs to move away/find new roads.) Focus on the 'settler' AI, and keep a list of established AI and only go back to them when they reach given thresholds of wealth/resources.

    If you get too detailed too quickly, then you run into the "Dwarf Fortress" problem, where the system can bog down with only a few hundred agents running around. Abstractions are key.

  6. #6
      Redrobes is offline
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,763
    Blog Entries
    4

    Default

    @crayons: Glad your interested. Your post was one of the set that made me think "Aw heck I just gotta start this". You said that you had the rendering of your city fairly well under control but you lacked the shape and road system of the town which is the bit I am hoping to generate.

    @tilt: Sure ill put in some real basic pics in a mo if you like but there not much to look at.

    @Ramah: Thanks

    @Talroth: Ill be keeping my dev journal right here - its gonna be a big thread I think. I was initially thinking of developing it in Perl cos its all text and stats stuff but I know that when we get a lot of action then it could slow down and I thought that better prevent that now. So its all in C++. As said the guts of it is taken from my GTS app which is an experimental terreain generator. That was done for multi processor but I have already decided that this one is going to be single threaded.

    So far I input a 2D base map which is just some color. I might be able to add the height map in later but for now I was thinking that we will just assume it will be all flat and not worry about gradients. If we get a cliff then ok I think I need to worry about it but for now getting a dude to take a drink and eat something is the first priority.

    In terms of update rate I was thinking that one unit of time would be about 1/100th of a day or about 15 mins. In that time he could do something moderately substantial without being too fine. He might only be moving one square so if we need him to get to some trees, chop them and get back across the map he might end up getting hungry again. The unit of time is flexible and I will have to see how fast this runs.

    I see what your saying about the pathing. I was thinking of assigning a role to a character so that once he settled into a role then he would be fixed. Like a blacksmith doesn't get a midlife crisis and want to start being a builder or whatever. Maybe I could recheck it just now and again. Once their role is fixed down then what your suggesting about not calculating the AI any more sounds like a good idea. One to think about.

    I have a 'path' value for all the map squares so that as people walk over them it climbs up a bit and then every turn it drops a teeny bit. I was thinking if a cart rolls over it then it goes up faster. Character when moving from place to place are going to calculate their cost to move as a loss of earnings based on their personal turnover. So moving a long way costs a lot if the character is making a lot of money. In that case I am hoping he will then see the sense in buying stuff from people close to him at a higher price than he could get it himself if he didnt have to move but not if he has to move to get it. Then the 'path' factor for the squares he moves over biases the costs so that roads are cheaper then rough terrain. Again this is all speculative so I hope that works out.

    I haven't heard of Dwarf Fortress - as you can tell I haven't done one of these before and it sounds like you have some experience so I will take what you say with some gravitas. I can see exactly what you mean tho in that when I have a big map and hundreds of characters then it will slow down. I am not aiming for a real time thing where we need to keep a game frame rate up. If I could calculate a years worth of map time in an hour then Id be happy. That would be 365 * 100 iterations per 3600 seconds tho. So 10 per sec sounds ok and that would imply that I should be able to get a few hundred or more characters in play.

    I'm starting out with a 32x32 bitmap and the aim is to work with something like 512x512. Since each square contains quite a bit of info I think I could render the 512 squares into something larger with good detail. I would like enough res so that when it plops down houses and streets then it gives enough shape to them that we can render them out with some nice 3D or use the thatching scripts I developed.

    Currently, when it saves the bitmap it will expand the squares to 9x9 pixels and mark on where the characters are too. So here is a pretty numpty picture showing my starting test patch of ground with trees, mud, rock and freshwater plus one guy standing at 10,10.

    An attempt at mapping using economics.-testpic1.png

  7. #7
      Redrobes is offline
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,763
    Blog Entries
    4

    Default

    Crayons was mentioning how deep the skills and items and disasters etc its going to run. Well firstly there are skills and I am saying that each race comes with 1 level in many skills. Humans start with 1 in farming, building, capentry, lumberjack, etc right up getting a 1 in blacksmith basic and miller. We would say these are unskilled tasks or semi-skilled. All the fine blacksmith work needs to be done by someone who gets a blacksmith advanced skill which you gain when you have say 100 pts in basic. So after a smith makes a easy cheap stuff like cartwheel hubs or whatever then the system adds one basic point. When he gets 100 it gives him 1 pt in advanced and he can start to make weapons or armour etc.

    Goblins and other races will also have skills but not farming etc. I don't know what but they will be different.

    Races have needs and desires of which the basic one is health. You must try to stay healthy. So no suicides in my land. You need to satisfy health before starting the next need and it goes down the list till you run out of needs and then your on to desired of which you can do in any order. Your character stats determine which biases to apply so that some people desire some things more than others. Wealth is a basic desire but there will also be piety, sex, destruction, battle etc.

    People have items of which I can keep adding them. At the mo I am getting stuck with money. I would like for every trade to be done with money cos bartering is difficult to program since there will be some excess wealth on one side of the transaction or the other. The trouble is unless there is a mint there is no coin. Even if I said all money was abstract then who starts with some in order to buy something. Money must come from a central bank done with a mint - like a royal mint. Money is issued which drives up inflation and production of wealth drives down inflation. So I dunno - help ? Maybe I need to give everybody some abstract coin and inflate it across the board. So you have a gp in your pocket but lo, someone generates loads of wealth so now everyone has 2gps in their pocket without doing anything because inflation has gone down, your gp is worth twice as much. Or the price of everything just halved and you keep the same amount of gps in your pocket. Odd ? Possibly - anyone study economics ? I'm not used to a closed small system - esp one without a mint or a central bank.

    Anyway, for now if noone trades then MrNewOnTheBlock has to chop some trees into logs and build a cabin, plant some seed and raise crops and drink from the stream to get his needs sorted out. Then he can worry about how much money he wants and whether theres any hot chicks to oggle at and marry or gods to worship or whatever. Were not there yet tho so no need for money at this premature stage.

    Because Goblins have a different set of needs and desired, one of them I think will be the need for chaos which will be driven by the amount of ordered wealth he can see. So if I model a goblin village and run it in then they will see all those nice neat houses worth a fortune and try to destroy them. Then the people will hopefully see that goblins cost money and fight them or pay for protection. So yes, I think invasions and disasters are on the cards. I think thievery and other evils of the world will add to the mix as well. We may get public hangings for reoffending thieves.... Or maybe it will drive some able fighting soldier types to become bounty hunters and then maybe even a sheriff or some kind of structured law enforcement will arise out of it.

    One of the things I am particularly keen to model is the idea of working for somebody where a cut of your profits go to your employer. I am keen to see how this affects the dynamics of a society. Another one which would be interesting but I think can wait is the idea of a global welfare, social services and tax system. At what point does it become desirable to have these in a village or town.

    Lots of ideas but gotta get that single man to drink first. He spawns healthy but thirsty and hungry and those two trump shelter at mo.

  8. #8
    Community Leader Facebook Connected Steel General's Avatar
    Join Date
    Jun 2008
    Location
    Ft. Wayne, IN
    Posts
    9,464

    Default

    This sounds like quite the interesting project, good luck with it!
    My Finished Maps | My Challenge Maps | Ghoraja Juun, my largely stagnated campaign setting.

    Unless otherwise stated by me in the post, all work is licensed under a Creative Commons Attribution-Noncommercial 3.0 United States License.



  9. #9
      Jaxilon is offline
    Community Leader Gracious Donor Jaxilon's Avatar
    Join Date
    Nov 2009
    Location
    Arizona
    Posts
    3,914

    Default

    Yes, quite interesting. It does sound a bit like Dwarf Fortress only you are going at it from a different direction and interest. Still, you might be interested in checking it out. It's an Ascii game but you can get some graphic sprites to work on it. It generates a random map similar to what you have there only uses the ascii character set to indicate rivers, minerals etc. Dwarves have interests and jobs you can assign the jobs but you kind of want them to become good at something so you don't do it too much. Anyway, it might be worth looking at as I believe you can get the source code as well.

    As mentioned already, this is an interesting project. It will be fun to keep watch.
    “When it’s over and you look in the mirror, did you do the best that you were capable of? If so, the score does not matter. But if you find that you did your best you were capable of, you will find it to your liking.” -John Wooden

    * Rivengard * My Finished Maps * My Challenge Maps * My deviantArt

  10. #10
      Redrobes is offline
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,763
    Blog Entries
    4

    Default

    Ah I see Dwarf Fortress is not a type of issue but a specific package. I have been looking at it and indeed it is somewhat along the same lines. I think where they want it to be *is* the same thing except that they haven't got there. Here is a link to their dev list:

    http://www.bay12games.com/dwarves/dev.html

    Now unless I am mistaken almost all of that is not complete. Am I reading that right ? So if that is the case then they have not got it such that people will plant crops, harvest them, possibly eat them or mill them and cook into bread. So these are the things that I would like to tackle first. I'm not getting the idea from their write up that they are using economics as well. For instance does the price of crops or bread drop when there is a surplus of them ? Also I can see more similarities where you get henchmen. This I would like to model but not in the same way. It looks like you get them somehow in their game whereas I would like for people to hire henchmen because they are cheap and offer services in the same way that people will trade for goods and they will use a paranoia or neurotics desire factor and they wealth sum to drive their need for more protection. So yeah, certainly parallels but I don't know enough about what they are doing to see whether its the same thing. It seems subtly different to me based on the things they are concentrating on. It seems like they are going at it from the point of view of a game whereas I am looking to make the map and list of people in it. I don't want it to be like a game. I would like it so that you enter the base map in and then let it rip for a few hours and come back to see a fully populated built up city with all the professions and people listed for it. Practically no user input at all. Then you can RPG in it to your hearts content afterward.

    Anyone played it a lot ? Can anyone summarize if it does indeed have people planting, growing, farming, building etc ?

Page 1 of 7 123 ... LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •