Page 5 of 7 FirstFirst 1234567 LastLast
Results 41 to 50 of 62

Thread: An attempt at mapping using economics.

  1. #41
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    Default

    I have another movie. This one has houses preventing the non owner from being able to pass through it. Also the houses cant initially be built on a path. I have added some more code where fields also now partially prevent access and that crops now grow in two stages. One where the farmer can increase growth rate then it goes into a phase where they cant. It forces them to replant a new square instead of standing on it tending it to completion. I added some code but had to take it out again but I will recode it differently such that houses decay and can be upkept again. In this way, houses that are not visited by the owner decay. That may be the case when the area is so built up that he cannot get to his house. This is how I would like to guarantee access to all houses. I am also now counting the access to all materials so that characters bias what they are doing based on the ability to get at more of the stuff. Therefore they are prepared to lose common stuff for rare stuff or want stuff they don't own more. This, of course, is in preparation for trading which I see as essential to the cause here.

    I like this movie because at the end it has some nice paths to the resources on the map. In a sense, some intelligent order has come out of the economics - something I am hoping that we will see more and more of, else this whole program is pointless. What were seeing as the intelligence is merely the optimization that comes from minimizing the expenditure of effort so I have something right there, Tho you will see people bouncing between two squares which is clearly wrong so I will have to look into why thats happening.

    Anim6a

    I thought id include a pic of the anim if left to continue until the trees almost depleted. Now that its built loads of houses they are in sort of streets or at least blocks of built up areas. This is why I need to ruin some of the houses so that we can form new streets. You can see now that the streets are well worn but they don't form any kind of sensible structure since there's no reason to go to and from all of these houses. Eventually I think this will sort itself out.
    Attached Images Attached Images
    Last edited by Redrobes; 09-28-2010 at 03:14 PM.

  2. #42

    Default

    It's definitely taking shape! Great stuff yet again!
    I think you're right that things will start to gel more when the economics settles in.
    How are you structuring the concept of accumulated "wealth" per individual? At the moment it appears that they all just build houses and this is fine if your 10 Andys represents more than that. If not then the housing price would be at rock bottom by the time of this end screenshot! You have a lot of very poor Andys!
    I'm not sure building decay is necessarily the right mechanism for creating space for roads. I would suggest that the buildings would not be built in the first place? Keep it at one building per Andy and have different sizes (wealth) perhaps? In other words have 2 sheds by all means, but make them joined together and cost exponentially more?
    Other things to throw into the melting pot? You've probably thought of these already?
    What does a "community" usually build early on? A church? A marketplace? A community hall? A pub? People are a sociable bunch so you could consider building in such things. People also need leisure time and meet each other... a certain amount of "need" should be doing these things. Visiting other people's houses, going to the community building and so on.
    I'm also thinking that to support this your Andys should choose a "proffession" rather than be Jacks (of all Trades!) which sets up your trade system. (This doesn't necessarily negate trade between two stonemasons, they just specialise in different types of rock, no need to model that just put that sort of trade as lower "need" perhaps.) Trade requires "meeting" at one or the others house or market, which means that people can't be out all day chopping trees, they also have to sell... and that's what shopping hours/market days are all about. I've worked in shops (jewellers as a matter of fact = rocks!), you can spend a lot of time doing nothing waiting for someone to buy something.
    What criteria are used to decide where to build a house? Once someone's profession becomes, say, lumberjack, and all his other needs are bought then he wants to be close to the forest and "the shops"/market, he no longer needs to be near the stone field or any other raw source of "commodities"...
    You also probably need to stick in some "logical thinking" - once a road becomes established enough and long enough then building next to it is far more logical.
    Many towns are created just because the road was there and a commodity was there. I was brought up in just such a town, built on the old roman Watling Street (A5) and a good spot for clay and therefore a pottery...that's a theory anyway! A fair amount of your building "boom" seems to be "infill"?
    Anyway, like I said, I'm just throwing in ideas here!
    Keep it going!
    --
    "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. #43
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    Default

    Cheers Crayons, Accumulated wealth: Yes its true that as Andy, Bob, Charlie, Dave, Eathan, Fred etc all build more and more houses their sense of house value drops. Its a symptom of the fact that there are no more transactions built into the system at this point. They cant go on to build a castle or whatever. When I add more and add more consumable transactions - like drinking beer etc then their wealth will get depreciated over time.

    Right now all these people act alone with almost no person to person interaction. All the interaction is that one person can path beat and another can move easier across the map using that path and also when they build a house or plant crops then other people now cant use that square. But trade is the key to getting professions. All people at mo must be Jacks of all trades cos each man is an island. When they trade and their skills get adjusted by their successes of transactions then I think they will fall into roles. When a farmer can grow crops faster than the lumberjack he will have more crops and value them less till he sells them then the amount of crops he has will fall, he values them more and will grow some more. I.e. he will stick at being a farmer and Mr lumberjack will not grow anything but trade logs for food instead. In an ideal world - i.e. the target here - we want to add 3 people to the map and after a while one will be the farmer, one the lumberjack and the other the stone mason. Each will stick by their own resource and go off and barter for the missing ones. So we want the amount that a good farmer can grow, a good mason can produce bricks and a good lumberjack can produce timber to be all about the same wealth creating rate. At the start tho, everybody must be a farmer to satisfy their hunger and later on the chaos of the initial conditions will sort them into groups. It may also make people bunch up. Since two similar farmers standing next to each other would equalize their resources by trade. It may be tho that anyone else buying harvest will go to the one with the more harvest to get it cheaper and thus that farmer will be the one to get more (different -> valuable) resources. I don't know how that's going to pan out.

    I will definitely add the transaction to extend an existing house so that it will be worth more with less cost than to start a new one. That is key to getting streets. Your right in that at present its all like infill. When a person has enough materials to make a house they look at the closest square that they can satisfy a house build from where they are not from the most ideal point.

    I have the mill and smithy next on the build list but at mo no transactions to make one. But those will grind harvest into flour and the smithy will make what I am calling mechanical items like cart axles etc. It will be cool to turn planks into a boat and go fishing.

    I would like to have shops too of course. The first will be a bakery taking flour from the mill and turning into bread. It would be better for people to buy bread than scavenge. Bread will go off after a few days but I am hoping that I can tune the costs so that people would prefer bread. Once its selling lots of bread then the mill will have a consumer of flour and thus keep the farmers all going. We need a similar sink of mech items to keep the smithy going. So maybe ill make carts out of them or that to upkeep the mill or something complicated requires nails or other thing all lumped under mech grade 1.

    So with all that laid out. Do you have any ideas how I could bias the choice of a house build position ? It has to be done using numbers I have right now at the point of the build not a speculative AI thing about where you might think there is best chance of limiting the travel to and from the house. For example I could keep a long term weighted average of all the positions he has been so that its keeping a constant center of gravity type position of his routes and try to put the house as close to that as possible. That kind of thing ?

    Yeah, this is where it all gets interesting cos most of the engine code is in there and we can mess about with all the tweaking to see what happens.

  4. #44
    Guild Journeyer
    Join Date
    May 2008
    Location
    PEI, Canada
    Posts
    213

    Default

    Write your AI as priority preferences. That is when looking to fill a 'food desire', the AI first looks for a source/supply of bread, then failing that will fall back to looking for other supplies.

    If you don't already then you may also want to keep a 'supply list', rather than any kind of method that looks at the world map first for resources. That way the AI can quickly skim a list to see if something exists before it makes a choice on if it wants to go after that, or fall back on other options, rather than scanning the entire map.

  5. #45
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    Default

    I have something in mind for the bread priority. What I have is a need that must be satisfied so he will look at all the items he can eat whether he cariies them or not and if nothing then there is the path of planting crops and waiting till they harvest and then eating that. So he could do that, carry harvest, buy harvest from someone or maybe he can carry bread or buy it (or if he happens to be the baker maybe he can bake some). So in all cases he has a quantity of need to to be full up to get to 100% and the amount he is missing is the amount of value he will get if he eats. There is also his personal turnover which is the average amount of value he is making per round. So if he must plant the crops and wait then it might take 10 turns before he can eat so if he is completely destitute then no problem, he will just wait because 10 x 0 = 0. But if he is a tradesman or whatever making money then it will cost a lot to wait that long before he can get back to work again. Its the cost of his loss of earnings that's more costly than the food itself. So I am hoping that different people of different wealth will eat different things. I will make it so that eating a little bit of harvest only raises your full up amount by a bit so he needs to spend a few rounds eating whereas bread will do much more in one turn.

    Your right tho in that I may have to implement a min level of standard of living so that if he is used to eating bread or his daily turnover is > x then he just doesn't consider eating harvest any more and we will let the value for money drive the max he can do.

    I keep a supply list but I generate it per round per person so in a sense its one full scan per turn. I divide up all items into real ones and potential (virtual) ones. The real ones are all the things he can get access to whether he owns, he can pick up or buy. Potential are all the ones where if he does X then it generates Y so Y is potentially available. Like a shack if you have the amount of bricks and timber to do it with. I group all similar items together so he also knows the maximum amount of the stuff that he can get hold of at a push. I.e. if there are 200 trees on the map then there are 200 log transactions and 200 plank transactions from the logs. So working out if there are enough planks to make a shack is known. I refer to the list a lot but it is dumped at the end of the character turn - so not as efficient as it could be. My issue tho is that people will reevaluate the markets per turn so items he might have been able to trade with last round might be off limits this round. Also as everyone moves about the costs involved in obtaining all the items changes. I accept that this isn't going to scale well tho.

  6. #46
    Guild Journeyer
    Join Date
    May 2008
    Location
    PEI, Canada
    Posts
    213

    Default

    Well, why drop the list at the end of the round? Just build and edit it as things are processed.

    You may even want to try going with having a list/array of the types of resources your AI can use, and then having that list point to different kinds of structures to better sort out where the actual resources are. (Such as a quad tree or similar.) This way your AI actors can not only have quick and easy access to what resources are available, but the general location.

    You could also sort some resources with a more complex data structure that will keep two lists, a primary and secondary source. Bakeries will be the primary source for most AI to buy bread from, and they will usually seek a baker first to buy bread from, rather than seeing if "random-dude-on-street-22" has any bread to sell.

  7. #47
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    Default

    I have an item list per person built dynamically and also an item stats list which is populated once and contains all the static stuff about items. For example whether they are portable, whether you need to own the square to put one down, whether you get to own the square if you do, the set value of the item before personal preferences applied, that sort of thing. I can see what you mean and its a neat idea. This list could point to all the locations of the items for which it relates. I dig that. I can see how the quad tree would help too and that modifying the list is more efficient than building a new one. All of your points are spot on but solve a performance issue but I am more interested in getting the basic algo right than getting it going a lot faster. I guess if this were a games AI then I would need to do all of these things.

    I am programming it based on programming convenience which is more lame than a true games engine I would agree but I need to get even more complexity in there yet and I would worry that keeping bugs out of the quad tree and getting the maintenance of the list exactly correct would be hard. Its iterative so if there are any rounding errors or slight miscalculations then they would build up over time quite fast. By dumping the list and rebuilding it I can ignore any incidental inaccuracies. My GeoTerSys uses a maintained set of parameters and these did gain and lose the most trivial amounts of stuff and it would kill it dead after thousands of iterations so I thought to avoid all that again.

    At mo I am making a list of all items then looking at generating the potential item list by looking at all the transactions and seeing if they are possible. Your method is undoubtedly faster in that you would start by looking at the transactions and then looking at seeing if you have the necessary items from the maintained list.

    When I build the list of accessible items when I see them I make a note of the location of the item. When I generate the potential item I make a note of the real item which is cheapest for that transaction and call it the key item. That is the item that I try to solve getting first if I choose that transaction. I.e. all items, both real and potential have a location specifier. When I choose a transaction I review the item list required but this time I have pointers to all the items on the system where they are located which was generated at the time to know if the transaction was possible and then see if I own and hold them. If not then I move to collect it or I have booleans marked to show I need to trade. So in short, I know what I have to do to satisfy this transaction if I choose it. Then its just a case of working out which transactions make for the best profit over loss. Then thats my choice and I go move, trade, or do the transaction as required.

    You have probably isolated the point in my app so far that will be the critical performance block but for now I can live with less performance than a game might demand if it makes for simpler data structures. Id rather look through a simple list than traverse a quad tree and rather bin and start a new list than manage the maintenance of an iterative one. Do you see ? I understand you might take issue with that idea if you come from a game engine designer perspective and I would agree with you. I may rewrite the app when I know exactly what I need to do to solve it - then I think I would concentrate on getting it quicker. Perhaps then this economics based engine might be pretty useful to games designers or in a situation where it needs to be a lot bigger. Maybe that might be interesting to super computer type analysis of a very large data set completely outside of RPG maps.

  8. #48
    Guild Journeyer
    Join Date
    May 2008
    Location
    PEI, Canada
    Posts
    213

    Default

    Don't mind me, I'm just throwing out ideas on how I would tackle problems. They might be useful later, or to someone else that comes along and tries a similar simulation. (Actually a lot of this might be useful to me for my Norse inspired adventure/farm simulator I'm working on.)

  9. #49
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    Default

    Your points are excellent. I particularly like the one about collecting the items of a type under one grouping instead of in the one central bin of items. Usually I know what I am looking for at the point of search so a lot of my loops have the search_type == item_type kind of thing in it. If I looked in the right list then I could avoid all that so it was a great point and would speed it up for little change in the app.

    Do you have any links to your farm sim ? Are you planning on using AI or economics to drive that or some other mechanism ?

  10. #50
    Guild Journeyer
    Join Date
    May 2008
    Location
    PEI, Canada
    Posts
    213

    Default

    My sim is being built as a portfolio game, and is still in the early stages. It is going to be a layered goal based AI for most actors, while the player gets control over one family in the settlement. So, no links or anything yet, I'm still picking away at some of the core mechanics as there are a lot of little chunks I need to work away at. (Things like the tiling of the map for LOD, and procedural generation of building designs. It is going to be a free placement/movement map with a hex/triangle based height map for terrain.)

Page 5 of 7 FirstFirst 1234567 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
  •