diff --git a/doc/Baking-the-world.md b/doc/Baking-the-world.md index c41c6cc..a2f3739 100644 --- a/doc/Baking-the-world.md +++ b/doc/Baking-the-world.md @@ -16,7 +16,7 @@ But, before going there, to summarise the proving stage. The inputs are: -1. A raster height map (although this could be randomly generated using any one of many fractal algorithms) - this probably uses ideas from [tessellated multi-layer height map](../../2013/07/tessellated-multi-layer-height-map.html); +1. A raster height map (although this could be randomly generated using any one of many fractal algorithms) - this probably uses ideas from [tessellated multi-layer height map](https://blog.journeyman.cc/2013/07/tessellated-multi-layer-height-map.html); 1. Optionally, a raster rainfall map at 1km resolution (although my personal preference is that this should be generated procedurally from the height map). The outputs are @@ -26,7 +26,7 @@ 1. A database of settlers and their settlements, such that the settlements have x,y co-ordinates; 1. A vector road map. - In this sense, the 'biome map' is just the end state of a [Microworld](../../2014/08/modelling-settlement-with-cellular.html) run. The 'biomes' include things like 'forest', 'scrub', 'heath', 'pasture', but they may also include human settlement, and even settlement by different cultural groups. + In this sense, the 'biome map' is just the end state of a [Microworld](https://blog.journeyman.cc/2014/08/modelling-settlement-with-cellular.html) run. The 'biomes' include things like 'forest', 'scrub', 'heath', 'pasture', but they may also include human settlement, and even settlement by different cultural groups. This gives us all we need to vegetate and furnish the world. When rendering each square metre we have diff --git a/doc/The-spread-of-knowledge-in-a-large-game-world.md b/doc/The-spread-of-knowledge-in-a-large-game-world.md index 40e842b..937da44 100644 --- a/doc/The-spread-of-knowledge-in-a-large-game-world.md +++ b/doc/The-spread-of-knowledge-in-a-large-game-world.md @@ -27,24 +27,46 @@ _This version of this essay has been adapted to use the code in `the-great-game. Obviously, news is more valuable if the people involved are important or notorious: the significance of a story is probably the product of the significance of the people concerned. - So a news item becomes a tuple + So a news item becomes a map with keys similar to - `(days-old nth-hand significance action (actors))` + [:verb :actor :other :location :nth-hand :time-stamp] + + The [exact keys for each verb are specified here](the-great-game.gossip.news-items.html#var-news-topics). for example - `(54 2 10 'killed '(fred joe))` + {:verb :kill, + :actor {:id :fred :name "Fred"}, + :other {:id :joe :name "Joe"}, + :location [{45467 78613} :hanshua :plateau], + :nth-hand 3, + :time-stamp 17946463} - meaning 'I spoke to a man who'd spoken to a man who said he saw notorious fred kill well-liked joe on 54 days ago'. Obviously, the non-player character must be able to construct a natural language sentence from the tuple when speaking within the hearing of a player character, but there's no need for a non-player character to produce a natural language sentence for another non-player character to parse; instead they can just exchange tuples. + meaning 'I spoke to a man who'd spoken to a man who said he saw fred kill joe at the game time represented by the time stamp 17946463, at the coordinates {45467 78613} in Hans'hua on the Plateau'. Obviously, the non-player character must be able to construct a natural language sentence from the tuple when speaking within the hearing of a player character, but there's no need for a non-player character to produce a natural language sentence for another non-player character to parse; instead they can just exchange tuples. But if we're exchanging knowledge between agents, then agents must have a means of representing knowledge. This knowledge is an association between subjects and sets of statement, such that when the agent learns the statement - `(54 2 10 'killed '(fred joe))` + {:verb :kill, + :actor {:id :fred :name "Fred"}, + :other {:id :joe :name "Joe"}, + :location [{45467 78613} :hanshua :plateau], + :nth-hand 3, + :time-stamp 17946463} it adds this statement (with the 2 incremented to 3) to the set of statements it knows about fred and also to the set of statements it knows about joe. It's possible that the receiving agent could then challenge for further statements about fred and/or joe, the automated equivalent of a 'who's joe?' question. There could be feedback in this. Fred's and joe's significance scores could be incremented for each character to whom the statement is passed on, increasing the likeliness that fred, at least, would feature in more news stories in future. There needs also to be some means of managing how the non-player character's attitude to the subjects of the statement are affected. For example, If fred kills joe, and the character (say bill) receiving the news feels positively towards joe, then bill's attitude to fred should become sharply more hostile. If bill feels neutral about joe, then bill's attitude to fred should still become a bit more hostile, since killing people is on the whole a bad thing. But it bill feels very hostile towards joe, then bill's attitude to fred should become more friendly. +But also, the added knowledge is *degraded*. If the recipient isn't from Hans'hua, the exact location isn't meaningful to them, for example. If the recipient isn't interested in Joe, precisely who was killed may be forgotten. So what is stored could become: + + {:verb :kill, + :actor {:id :fred :name "Fred"}, + :location [:hanshua :plateau], + :nth-hand 4, + :time-stamp 17946463} + +The timestamp could also be degraded, or lost altother - although how exactly this is represnted I'm not certain. Someone interested in the incident may remember 'it was exactly 17 days ago', whereas someone else may remember that it was 'this month, I think'. + Obviously the rate of decay, and the degree of randomness, of the news-passing algorithm would need to be tuned, but this schema seems to me to describe a system with the following features: * Non-player characters can respond to questions about significant things which happen in the world - without it all having to be scripted diff --git a/doc/economy.md b/doc/economy.md index 45ed00a..15111dc 100644 --- a/doc/economy.md +++ b/doc/economy.md @@ -1,6 +1,6 @@ # Game world economy -Broadly this essay extends ideas presented in [Populating a game world](https://blog.journeyman.cc/2013/07/populating-game-world.html), q.v. +Broadly this essay extends ideas presented in [Populating a game world](Populating-a-game-world.html), q.v. ## Primary producers diff --git a/doc/intro.md b/doc/intro.md index 3c67ed7..3ae3526 100644 --- a/doc/intro.md +++ b/doc/intro.md @@ -19,7 +19,7 @@ that I need to be able to use it to tell stories, in order to create initial threads of narrative from which players can start their exploration. Note that, by 'conflict', here, I explicitly do not mean 'killing people', -or even 'killing non-player characters'. I have [written extensively](https://blog.journeyman.cc/2015/02/voice-acting-considered-harmful.html) +or even 'killing non-player characters'. I have [written extensively](Voice-acting-considered-harmful.html) about the problem in many current video games that all too often the only way of interacting with non-player characters is to kill them. Killing people should be one of the potential ways of resolving conflicts, because @@ -32,18 +32,18 @@ repertoire of speech. ## Previous essays that are relevant -* [The spread of knowledge in a large game world](https://blog.journeyman.cc/2008/04/the-spread-of-knowledge-in-large-game.html) (2008) discusses what individual non-player characters know, and how to model dynamic updates to their knowledge; +* [The spread of knowledge in a large game world](The-spread-of-knowledge-in-a-large-game-world.html) (2008) discusses what individual non-player characters know, and how to model dynamic updates to their knowledge; * [Settling a game world](https://blog.journeyman.cc/2009/12/settling-game-world.html) (2009) gives rough outline of ideas about creating the environment, including modelling things like soil fertility, local building materials, and consequently local architecture; * [Tessellated multi-layer height map](https://blog.journeyman.cc/2013/07/tessellated-multi-layer-height-map.html) (2013) gives ideas for how a designed geography for a very large world could be stored relatively economically; * [Genetic Buildings](https://blog.journeyman.cc/2013/07/genetic-buildings.html) (2013) sketches algorithms which would allow procedurally-generated buildings to be site-appropriate, broadly variable and reproducable; -* [Populating a game world](https://blog.journeyman.cc/2013/07/populating-game-world.html) (2013) provides outline algorithms for how a world can be populated, and how organic mixes of trades and crafts can be modelled; +* [Populating a game world](Populating-a-game-world.html) (2013) provides outline algorithms for how a world can be populated, and how organic mixes of trades and crafts can be modelled; * [Modelling the change from rural to urban](https://blog.journeyman.cc/2013/07/modelling-change-from-rural-to-urban.html) (2013) describes the idea of procedurally modelling settlements, but it is grid-based and not particularly satisfactory and has largely been superceded in my thinking; -* [Of pigeons, and long distance messaging in a game world]() (2013) builds on ideas about flows of information; +* [Of pigeons, and long distance messaging in a game world](https://blog.journeyman.cc/2013/10/of-pigeons-and-long-distance-messaging.html) (2013) builds on ideas about flows of information; * [Modelling rural to urban, take two](https://blog.journeyman.cc/2013/10/modelling-rural-to-urban-take-two.html) (2013) revisited the idea of modelling organic settlement structures, trying to find algorithms which would naturally produce more persuasive settlement models, including further ideas on the procedural generation of buildings; * [More on modelling rivers](https://blog.journeyman.cc/2014/09/more-on-modelling-rivers.html) (2014) talks about modelling hydrology, with implications for soil fertility; * [Modelling settlement with cellular automata](https://blog.journeyman.cc/2014/08/modelling-settlement-with-cellular.html) (2014) talks about successful implementation of algorithms to model vegetative environment, human settlement and the impact of human settlement on the environment; * [Voice acting considered harmful](https://blog.journeyman.cc/2015/02/voice-acting-considered-harmful.html) (2015) outlines the ideas behind full speech interaction with non-player characters, and modelling what those non-player characters should be able to speak about; -* [Baking the world](https://blog.journeyman.cc/2019/05/baking-world.html) (2019) an outline of the overall process of creating a world. +* [Baking the world](Baking-the-world.html) (2019) an outline of the overall process of creating a world. ## Organic and emergent game-play @@ -183,8 +183,8 @@ easy: So each agent is assigned - by the dreaded random number generator - one top level goal when they are instantiated. I don't think it's necessary to model change of top level goals, although of course that does happen in real life; -however, although each agent has one top level goal, they will have lower l -evel 'stretch goals' also taken from this list: so at each decision point in +however, although each agent has one top level goal, they will have lower +level 'stretch goals' also taken from this list: so at each decision point in an agent's planning loop, if base level needs are satisfied and progress on the top level goal is blocked, actions should be chosen which progress one of the lower goals. Indeed, it's possible that all agents could have all @@ -379,4 +379,4 @@ Each game day, every habitual traveller within the 'local' gossip bubble exchanges some items of gossip with the nearest innkeeper to their current location. In the second and third gossip bubbles, it's probably only more favoured gossip agents who do this. See -[The spread of knowledge in a large game world](https://blog.journeyman.cc/2008/04/the-spread-of-knowledge-in-large-game.html) +[The spread of knowledge in a large game world](The-spread-of-knowledge-in-a-large-game-world.html) diff --git a/doc/modelling_trading_cost_and_risk.md b/doc/modelling_trading_cost_and_risk.md index 3574d5b..78ae9dd 100644 --- a/doc/modelling_trading_cost_and_risk.md +++ b/doc/modelling_trading_cost_and_risk.md @@ -2,7 +2,7 @@ In a dynamic pre-firearms world with many small states and contested regions, trade is not going to be straightforward. Not only will different routes have different physical characteristics - more or less mountainous, more or fewer unbridged river crossings - they will also have different political characteristics: more of less taxed, more or less effectively policed. -Raids by outlaws are expected to be part of the game economy. News of raids are the sort of things which may propagate through the [[gossip]] system. So are changes in taxation regime. Obviously, knowledge items can affect merchants' trading strategy; in existing prototype code, individual merchants already each keep their own cache of known historical prices, and exchange historical price data with one another; and use this price data to select trades to make. +Raids by outlaws are expected to be part of the game economy. News of raids are the sort of things which may propagate through the [gossip](the-great-game.gossip.gossip.html) system. So are changes in taxation regime. Obviously, knowledge items can affect merchants' trading strategy; in existing prototype code, individual merchants already each keep their own cache of known historical prices, and exchange historical price data with one another; and use this price data to select trades to make. So: to what extent is it worth modelling the spread of knowledge of trade cost and risk? diff --git a/docs/codox/Baking-the-world.html b/docs/codox/Baking-the-world.html index 5924b7f..c588bd8 100644 --- a/docs/codox/Baking-the-world.html +++ b/docs/codox/Baking-the-world.html @@ -10,7 +10,7 @@

Then, when the landscape has developed - the areas of forest, scrub, open meadow, moorland, savanah and desert are determined, the rivers plotted, the settlers moved in, their trades determined and their settlements allocated, the roadways which link settlements routed, river crossings and ports defined - the proving process ends, and the world is turned over to the plot-writers, quest builders and designers, for a process we can see as analogous to kneading.

But, before going there, to summarise the proving stage. The inputs are:

    -
  1. A raster height map (although this could be randomly generated using any one of many fractal algorithms) - this probably uses ideas from tessellated multi-layer height map;
  2. +
  3. A raster height map (although this could be randomly generated using any one of many fractal algorithms) - this probably uses ideas from tessellated multi-layer height map;
  4. Optionally, a raster rainfall map at 1km resolution (although my personal preference is that this should be generated procedurally from the height map).

The outputs are

@@ -20,7 +20,7 @@
  • A database of settlers and their settlements, such that the settlements have x,y co-ordinates;
  • A vector road map.
  • -

    In this sense, the ‘biome map’ is just the end state of a Microworld run. The ‘biomes’ include things like ‘forest’, ‘scrub’, ‘heath’, ‘pasture’, but they may also include human settlement, and even settlement by different cultural groups.

    +

    In this sense, the ‘biome map’ is just the end state of a Microworld run. The ‘biomes’ include things like ‘forest’, ‘scrub’, ‘heath’, ‘pasture’, but they may also include human settlement, and even settlement by different cultural groups.

    This gives us all we need to vegetate and furnish the world. When rendering each square metre we have

    1. The x,y coordinates, obviously;
    2. diff --git a/docs/codox/The-spread-of-knowledge-in-a-large-game-world.html b/docs/codox/The-spread-of-knowledge-in-a-large-game-world.html index df5c42d..9dd26f5 100644 --- a/docs/codox/The-spread-of-knowledge-in-a-large-game-world.html +++ b/docs/codox/The-spread-of-knowledge-in-a-large-game-world.html @@ -18,15 +18,37 @@
    3. Plot events, flagged as events by the game designer
    4. Obviously, news is more valuable if the people involved are important or notorious: the significance of a story is probably the product of the significance of the people concerned.

      -

      So a news item becomes a tuple

      -

      (days-old nth-hand significance action (actors))

      +

      So a news item becomes a map with keys similar to

      +
      [:verb :actor :other :location :nth-hand :time-stamp]
      +
      +

      The exact keys for each verb are specified here.

      for example

      -

      (54 2 10 'killed '(fred joe))

      -

      meaning ‘I spoke to a man who’d spoken to a man who said he saw notorious fred kill well-liked joe on 54 days ago’. Obviously, the non-player character must be able to construct a natural language sentence from the tuple when speaking within the hearing of a player character, but there’s no need for a non-player character to produce a natural language sentence for another non-player character to parse; instead they can just exchange tuples.

      +
       {:verb :kill,
      + :actor {:id :fred :name "Fred"},
      + :other {:id :joe :name "Joe"},
      + :location [{45467 78613} :hanshua :plateau],
      + :nth-hand 3,
      + :time-stamp 17946463}
      +
      +

      meaning ‘I spoke to a man who’d spoken to a man who said he saw fred kill joe at the game time represented by the time stamp 17946463, at the coordinates {45467 78613} in Hans’hua on the Plateau’. Obviously, the non-player character must be able to construct a natural language sentence from the tuple when speaking within the hearing of a player character, but there’s no need for a non-player character to produce a natural language sentence for another non-player character to parse; instead they can just exchange tuples.

      But if we’re exchanging knowledge between agents, then agents must have a means of representing knowledge. This knowledge is an association between subjects and sets of statement, such that when the agent learns the statement

      -

      (54 2 10 'killed '(fred joe))

      +
       {:verb :kill,
      + :actor {:id :fred :name "Fred"},
      + :other {:id :joe :name "Joe"},
      + :location [{45467 78613} :hanshua :plateau],
      + :nth-hand 3,
      + :time-stamp 17946463}
      +

      it adds this statement (with the 2 incremented to 3) to the set of statements it knows about fred and also to the set of statements it knows about joe. It’s possible that the receiving agent could then challenge for further statements about fred and/or joe, the automated equivalent of a ‘who’s joe?’ question.

      There could be feedback in this. Fred’s and joe’s significance scores could be incremented for each character to whom the statement is passed on, increasing the likeliness that fred, at least, would feature in more news stories in future. There needs also to be some means of managing how the non-player character’s attitude to the subjects of the statement are affected. For example, If fred kills joe, and the character (say bill) receiving the news feels positively towards joe, then bill’s attitude to fred should become sharply more hostile. If bill feels neutral about joe, then bill’s attitude to fred should still become a bit more hostile, since killing people is on the whole a bad thing. But it bill feels very hostile towards joe, then bill’s attitude to fred should become more friendly.

      +

      But also, the added knowledge is degraded. If the recipient isn’t from Hans’hua, the exact location isn’t meaningful to them, for example. If the recipient isn’t interested in Joe, precisely who was killed may be forgotten. So what is stored could become:

      +
       {:verb :kill,
      + :actor {:id :fred :name "Fred"},
      + :location [:hanshua :plateau],
      + :nth-hand 4,
      + :time-stamp 17946463}
      +
      +

      The timestamp could also be degraded, or lost altother - although how exactly this is represnted I’m not certain. Someone interested in the incident may remember ‘it was exactly 17 days ago’, whereas someone else may remember that it was ‘this month, I think’.

      Obviously the rate of decay, and the degree of randomness, of the news-passing algorithm would need to be tuned, but this schema seems to me to describe a system with the following features:

    -

    So each agent is assigned - by the dreaded random number generator - one top level goal when they are instantiated. I don’t think it’s necessary to model change of top level goals, although of course that does happen in real life; however, although each agent has one top level goal, they will have lower l evel ‘stretch goals’ also taken from this list: so at each decision point in an agent’s planning loop, if base level needs are satisfied and progress on the top level goal is blocked, actions should be chosen which progress one of the lower goals. Indeed, it’s possible that all agents could have all goals, but randomly ordered.

    +

    So each agent is assigned - by the dreaded random number generator - one top level goal when they are instantiated. I don’t think it’s necessary to model change of top level goals, although of course that does happen in real life; however, although each agent has one top level goal, they will have lower level ‘stretch goals’ also taken from this list: so at each decision point in an agent’s planning loop, if base level needs are satisfied and progress on the top level goal is blocked, actions should be chosen which progress one of the lower goals. Indeed, it’s possible that all agents could have all goals, but randomly ordered.

    At the lowest level there are immediate needs goals every agent must satisfy: food for tonight, a safe place to stay tonight, food for next year, a safe place to stay next year.

    On screen and off screen

    If we’re going to have a very large world with a very large number of characters (as an order of magnitude number, say 100,000), then obviously we cannot plan in detail every time each character lifts a cup to their lips to drink. When a character is on screen we must represent small actions, and at some level these must be planned for. But when they’re off screen, that’s just wasted computation. The only actions we need to plan are life altering actions, such as:

    @@ -125,4 +125,4 @@

    Generally, if a merchant buys goods in an ariston’s market, or sells goods in the ariston’s market, then the economy benefits and the ariston benefits from that; so the ‘tax’ element is part of the market markup. But if a caravan passes through an ariston’s territory without stopping at a market, there’s probably a tax of about 5% of value.

    Generally, an ariston’s army will control outlawry within the ariston’s domain, so outlaw encounters within a domain are unlikely. Soldiers could be able seek bribes, but that would bring a strongly negative impact on favour and I’m not sure it’s work modelling.

    Other habitual travellers: gossipers

    -

    Apart from merchants, the habitual travellers are diplomats (who, in the craft tree, are similar to chancellors) and minstrels (who aren’t on the craft tree but should be); and vagrants. However, vagrants almost certainly don’t have positive favour, so aren’t likely to be useful gossip agents. Each game day, every habitual traveller within the ‘local’ gossip bubble exchanges some items of gossip with the nearest innkeeper to their current location. In the second and third gossip bubbles, it’s probably only more favoured gossip agents who do this. See The spread of knowledge in a large game world

    \ No newline at end of file +

    Apart from merchants, the habitual travellers are diplomats (who, in the craft tree, are similar to chancellors) and minstrels (who aren’t on the craft tree but should be); and vagrants. However, vagrants almost certainly don’t have positive favour, so aren’t likely to be useful gossip agents. Each game day, every habitual traveller within the ‘local’ gossip bubble exchanges some items of gossip with the nearest innkeeper to their current location. In the second and third gossip bubbles, it’s probably only more favoured gossip agents who do this. See The spread of knowledge in a large game world

    \ No newline at end of file diff --git a/docs/codox/modelling_trading_cost_and_risk.html b/docs/codox/modelling_trading_cost_and_risk.html index 5292eb6..58c4b74 100644 --- a/docs/codox/modelling_trading_cost_and_risk.html +++ b/docs/codox/modelling_trading_cost_and_risk.html @@ -2,6 +2,6 @@ ""> Modelling trading cost and risk

    Modelling trading cost and risk

    In a dynamic pre-firearms world with many small states and contested regions, trade is not going to be straightforward. Not only will different routes have different physical characteristics - more or less mountainous, more or fewer unbridged river crossings - they will also have different political characteristics: more of less taxed, more or less effectively policed.

    -

    Raids by outlaws are expected to be part of the game economy. News of raids are the sort of things which may propagate through the gossip system. So are changes in taxation regime. Obviously, knowledge items can affect merchants’ trading strategy; in existing prototype code, individual merchants already each keep their own cache of known historical prices, and exchange historical price data with one another; and use this price data to select trades to make.

    +

    Raids by outlaws are expected to be part of the game economy. News of raids are the sort of things which may propagate through the gossip system. So are changes in taxation regime. Obviously, knowledge items can affect merchants’ trading strategy; in existing prototype code, individual merchants already each keep their own cache of known historical prices, and exchange historical price data with one another; and use this price data to select trades to make.

    So: to what extent is it worth modelling the spread of knowledge of trade cost and risk?

    Obviously the more we model, the more compute power modelling consumes. If the core objective is a Role Playing Games as currently understood, then there is no need to model very complex trade risk assessment behaviour.

    \ No newline at end of file diff --git a/docs/codox/the-great-game.gossip.news-items.html b/docs/codox/the-great-game.gossip.news-items.html index 64f1d4c..c2e6806 100644 --- a/docs/codox/the-great-game.gossip.news-items.html +++ b/docs/codox/the-great-game.gossip.news-items.html @@ -1,6 +1,6 @@ -the-great-game.gossip.news-items documentation

    the-great-game.gossip.news-items

    Categories of news events interesting to gossip agents

    degrade-character

    (degrade-character gossip character)

    Return a character specification like this character, but comprising only those properties this gossip is interested in.

    degrade-location

    (degrade-location gossip location)

    Return a location specification like this location, but comprising only those elements this gossip is interested in. If none, return nil.

    infer

    (infer item rule)

    Infer a new knowledge item from this item, following this rule

    interest-in-character

    (interest-in-character gossip character)

    Integer representation of how interesting this character is to this gossip. TODO: this assumes that characters are passed as keywords, but, as documented above, they probably have to be maps, to allow for degradation.

    interest-in-location

    (interest-in-location gossip location)

    Integer representation of how interesting this location is to this gossip.

    interesting-character?

    (interesting-character? gossip character)

    Boolean representation of whether this character is interesting to this gossip.

    interesting-item?

    (interesting-item? gossip item)

    True if anything about this news item is interesting to this gossip.

    interesting-location?

    (interesting-location? gossip item)

    True if the location of this news item is interesting to this gossip.

    interesting-object?

    (interesting-object? gossip object)

    TODO: write docs

    interesting-topic?

    (interesting-topic? gossip topic)

    TODO: write docs

    learn-news-item

    (learn-news-item gossip item)(learn-news-item gossip item follow-inferences?)

    Return a gossip like this gossip, which has learned this news item if it is of interest to them.

    make-all-inferences

    (make-all-inferences item)

    Return a list of knowledge entries inferred from this news item by this gossip.

    news-topics

    Topics of interest to gossip agents. Topics are keyed in this map by their verbs. The keys associated with each topic are the extra pieces of information required to give context to a gossip item. Generally:

    +the-great-game.gossip.news-items documentation

    the-great-game.gossip.news-items

    Categories of news events interesting to gossip agents

    degrade-character

    (degrade-character gossip character)

    Return a character specification like this character, but comprising only those properties this gossip is interested in.

    degrade-location

    (degrade-location gossip location)

    Return a location specification like this location, but comprising only those elements this gossip is interested in. If none, return nil.

    infer

    (infer item rule)

    Infer a new knowledge item from this item, following this rule

    interest-in-character

    (interest-in-character gossip character)

    Integer representation of how interesting this character is to this gossip. TODO: this assumes that characters are passed as keywords, but, as documented above, they probably have to be maps, to allow for degradation.

    interest-in-location

    (interest-in-location gossip location)

    Integer representation of how interesting this location is to this gossip.

    interesting-character?

    (interesting-character? gossip character)

    Boolean representation of whether this character is interesting to this gossip.

    interesting-item?

    (interesting-item? gossip item)

    True if anything about this news item is interesting to this gossip.

    interesting-location?

    (interesting-location? gossip item)

    True if the location of this news item is interesting to this gossip.

    interesting-object?

    (interesting-object? gossip object)

    TODO: write docs

    interesting-topic?

    (interesting-topic? gossip topic)

    TODO: write docs

    learn-news-item

    (learn-news-item gossip item)(learn-news-item gossip item follow-inferences?)

    Return a gossip like this gossip, which has learned this news item if it is of interest to them.

    make-all-inferences

    (make-all-inferences item)

    Return a list of knowledge entries inferred from this news item by this gossip.

    news-topics

    Topics of interest to gossip agents. Topics are keyed in this map by their verbs. The keys associated with each topic are the extra pieces of information required to give context to a gossip item. Generally:

    • actor is the id of the character who it is reported performed the action;
    • other is the id of the character on whom it is reported the action was performed;
    • @@ -11,6 +11,7 @@

      Notes:

      Characters:

      TODO but note that at most all the receiver can learn about a character from a news item is what the giver knows about that character, degraded by what the receiver finds interesting about them. If we just pass the id here, then either the receiver knows everything in the database about the character, or else the receiver knows nothing at all about the character. Neither is desirable. Further thought needed.

      +

      By implication, the character values passed should include ^all^ the information the giver knows about the character; that can then be degraded as the receiver stores only that segment which the receiver finds interesting.

      Locations:

      A ‘location’ value is a list comprising at most the x/y coordinate location and the ids of the settlement and region (possibly hierarchically) that contain the location. If the x/y is not local to the home of the receiving agent, they won’t remember it and won’t pass it on; if any of the ids are not interesting So location information will degrade progressively as the item is passed along.

      It is assumed that the :home of a character is a location in this sense.

      diff --git a/src/the_great_game/gossip/news_items.clj b/src/the_great_game/gossip/news_items.clj index f2572d4..dfe30ee 100644 --- a/src/the_great_game/gossip/news_items.clj +++ b/src/the_great_game/gossip/news_items.clj @@ -41,6 +41,11 @@ character, or else the receiver knows nothing at all about the character. Neither is desirable. Further thought needed. + By implication, the character values passed should include ^all^ the + information the giver knows about the character; that can then be degraded + as the receiver stores only that segment which the receiver finds + interesting. + ##### Locations: A 'location' value is a list comprising at most the x/y coordinate location @@ -218,22 +223,28 @@ ([gossip item follow-inferences?] (if (interesting-item? gossip item) - (let [g (assoc gossip :knowledge - (cons - (assoc - item - :nth-hand (if - (number? (:nth-hand item)) - (inc (:nth-hand item)) - 1) - :date (if (number? (:date item)) (:date item) (game-time)) - :location (degrade-location gossip (:location item)) - ;; ought to degratde the location - ;; ought to maybe-degrade characters we're not yet interested in - ) - ;; ought not to add knowledge items we already have, except - ;; to replace if new item is of increased specificity - (:knowledge gossip)))] + (let + [g (assoc + gossip + :knowledge + (cons + (assoc + item + :nth-hand (if + (number? (:nth-hand item)) + (inc (:nth-hand item)) + 1) + :time-stamp (if + (number? (:time-stamp item)) + (:time-stamp item) + (game-time)) + :location (degrade-location gossip (:location item)) + ;; ought to degratde the location + ;; ought to maybe-degrade characters we're not yet interested in + ) + ;; ought not to add knowledge items we already have, except + ;; to replace if new item is of increased specificity + (:knowledge gossip)))] (if follow-inferences? (assoc g diff --git a/test/the_great_game/gossip/news_items_test.clj b/test/the_great_game/gossip/news_items_test.clj index db5ee89..ca7788e 100644 --- a/test/the_great_game/gossip/news_items_test.clj +++ b/test/the_great_game/gossip/news_items_test.clj @@ -119,7 +119,7 @@ ;; dates will not be and cannot be expected to be equal actual (make-all-inferences {:verb :rape :actor :adam :other :belinda :location :test-home}) - actual' (set (map #(dissoc % :date) actual))] + actual' (set (map #(dissoc % :time-stamp) actual))] (is (= actual' expected))))) (deftest learn-tests @@ -130,5 +130,5 @@ actual (learn-news-item {:home [{0, 0} :test-home] :knowledge []} {:verb :sex :actor :adam :other :belinda :location [:test-home]}) - actual' (assoc actual :knowledge (vec (map #(dissoc % :date) (:knowledge actual))))] + actual' (assoc actual :knowledge (vec (map #(dissoc % :time-stamp) (:knowledge actual))))] (is (= actual' expected)))))