the-great-game/docs/codox/The-spread-of-knowledge-in-a-large-game-world.html
Simon Brooke 3a0120dd4d Massive reworking of documentation
More consistent file names; all links now work.
2024-04-04 13:20:43 +01:00

64 lines
22 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>The spread of knowledge in a large game world</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">The-great-game</span> <span class="project-version">0.1.2-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="A-generic-planning-algorithm-for-craftworker-npcs.html"><div class="inner"><span>A Generic Planning Algorithm for craftworker NPCs</span></div></a></li><li class="depth-1 "><a href="API_Spec.html"><div class="inner"><span>API Spec (unfinished)</span></div></a></li><li class="depth-1 "><a href="Appraisal.html"><div class="inner"><span>Appraisal (unfinished)</span></div></a></li><li class="depth-1 "><a href="Baking-the-world.html"><div class="inner"><span>Baking the world</span></div></a></li><li class="depth-1 "><a href="Biomes_and_ecology.html"><div class="inner"><span>Biomes and ecology (unfinished)</span></div></a></li><li class="depth-1 "><a href="Building_on_microworld.html"><div class="inner"><span>Building on Microworld</span></div></a></li><li class="depth-1 "><a href="Canonical-dictionary.html"><div class="inner"><span>Canonical dictionary for this documentation</span></div></a></li><li class="depth-1 "><a href="Division_of_tasks_between_server_and_client.html"><div class="inner"><span>Division of tasks between server and client</span></div></a></li><li class="depth-1 "><a href="Dynamic-consequences.html"><div class="inner"><span>On the consequences of a dynamic game environment for storytelling</span></div></a></li><li class="depth-1 "><a href="Economy.html"><div class="inner"><span>Game world economy</span></div></a></li><li class="depth-1 "><a href="Further-reading.html"><div class="inner"><span>Further Reading (and watching)</span></div></a></li><li class="depth-1 "><a href="Game-engine-integration.html"><div class="inner"><span>Game-engine integration (unfinished)</span></div></a></li><li class="depth-1 "><a href="Game_Play.html"><div class="inner"><span>Game Play</span></div></a></li><li class="depth-1 "><a href="Genetic-buildings.html"><div class="inner"><span>Genetic Buildings</span></div></a></li><li class="depth-1 "><a href="Gossip_scripted_plot_and_Johnny_Silverhand.html"><div class="inner"><span>Gossip, scripted plot, and Johnny Silverhand</span></div></a></li><li class="depth-1 "><a href="MVP-Roadmap.html"><div class="inner"><span>Minimum Viable Product, and a road map</span></div></a></li><li class="depth-1 "><a href="Modelling_democracy_and_morale.html"><div class="inner"><span>The Red Company: modelling democracy and morale (unfinished)</span></div></a></li><li class="depth-1 "><a href="Modelling_trading_cost_and_risk.html"><div class="inner"><span>Modelling trading cost and risk (unfinished)</span></div></a></li><li class="depth-1 "><a href="Naming-of-characters.html"><div class="inner"><span>Naming of Characters</span></div></a></li><li class="depth-1 "><a href="Not_my_problem.html"><div class="inner"><span> Not my problem</span></div></a></li><li class="depth-1 "><a href="On-dying.html"><div class="inner"><span>On Dying, and Injury</span></div></a></li><li class="depth-1 "><a href="On-sex-and-sexual-violence.html"><div class="inner"><span>On Sex, and Sexual Violence, in Games</span></div></a></li><li class="depth-1 "><a href="Organic_Quests.html"><div class="inner"><span>Organic Quests</span></div></a></li><li class="depth-1 "><a href="Pathmaking.html"><div class="inner"><span>Pathmaking</span></div></a></li><li class="depth-1 "><a href="Populating-a-game-world.html"><div class="inner"><span>Populating a game world</span></div></a></li><li class="depth-1 "><a href="Roadmap.html"><div class="inner"><span>Roadmap (obsolete)</span></div></a></li><li class="depth-1 "><a href="Sandbox.html"><div class="inner"><span>Sandbox</span></div></a></li><li class="depth-1 "><a href="Selecting_Character.html"><div class="inner"><span>Selecting the Player Character</span></div></a></li><li class="depth-1 "><a href="Settling-a-game-world.html"><div class="inner"><span>Settling a game world</span></div></a></li><li class="depth-1 "><a href="Sexual-dimorphism.html"><div class="inner"><span>Sexual dimorphism</span></div></a></li><li class="depth-1 "><a href="Simulation-layers.html"><div class="inner"><span>Simulation layers</span></div></a></li><li class="depth-1 current"><a href="The-spread-of-knowledge-in-a-large-game-world.html"><div class="inner"><span>The spread of knowledge in a large game world</span></div></a></li><li class="depth-1 "><a href="Things_Voice_Interaction_Enables.html"><div class="inner"><span>Things Voice Interaction Enables</span></div></a></li><li class="depth-1 "><a href="Uncanny_dialogue.html"><div class="inner"><span>The Uncanny Valley, and dynamically generated dialogue</span></div></a></li><li class="depth-1 "><a href="Voice-acting-considered-harmful.html"><div class="inner"><span>Voice acting considered harmful</span></div></a></li><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to the-great-game</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>cc</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>journeyman</span></div></div></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>the-great-game</span></div></div></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>agent</span></div></div></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.agent.agent.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>agent</span></div></a></li><li class="depth-5"><a href="cc.journeyman.the-great-game.agent.schedule.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>schedule</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>buildings</span></div></div></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.buildings.module.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>module</span></div></a></li><li class="depth-5"><a href="cc.journeyman.the-great-game.buildings.rectangular.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>rectangular</span></div></a></li><li class="depth-4 branch"><a href="cc.journeyman.the-great-game.cloverage.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>cloverage</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>gossip</span></div></div></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.gossip.gossip.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>gossip</span></div></a></li><li class="depth-5"><a href="cc.journeyman.the-great-game.gossip.news-items.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>news-items</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>holdings</span></div></div></li><li class="depth-5"><a href="cc.journeyman.the-great-game.holdings.holding.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>holding</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>location</span></div></div></li><li class="depth-5"><a href="cc.journeyman.the-great-game.location.location.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>location</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>lore</span></div></div></li><li class="depth-5"><a href="cc.journeyman.the-great-game.lore.digester.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>digester</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>merchants</span></div></div></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.merchants.markets.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>markets</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.merchants.merchant-utils.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>merchant-utils</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.merchants.merchants.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>merchants</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.merchants.planning.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>planning</span></div></a></li><li class="depth-5"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>strategies</span></div></div></li><li class="depth-6"><a href="cc.journeyman.the-great-game.merchants.strategies.simple.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>simple</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -207px;"><span class="top" style="height: 216px;"></span><span class="bottom"></span></span><span>objects</span></div></div></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.objects.character.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>character</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.objects.container.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>container</span></div></a></li><li class="depth-5"><a href="cc.journeyman.the-great-game.objects.game-object.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>game-object</span></div></a></li><li class="depth-4 branch"><a href="cc.journeyman.the-great-game.playroom.html"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>playroom</span></div></a></li><li class="depth-4 branch"><a href="cc.journeyman.the-great-game.time.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>time</span></div></a></li><li class="depth-4 branch"><a href="cc.journeyman.the-great-game.utils.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>utils</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>world</span></div></div></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.world.heightmap.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>heightmap</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.world.location.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>location</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.world.mw.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>mw</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.world.routes.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>routes</span></div></a></li><li class="depth-5"><a href="cc.journeyman.the-great-game.world.world.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>world</span></div></a></li></ul></div><div class="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#the-spread-of-knowledge-in-a-large-game-world" id="the-spread-of-knowledge-in-a-large-game-world"></a>The spread of knowledge in a large game world</h1>
<h4><a href="#saturday-26-april-2008" id="saturday-26-april-2008"></a>Saturday, 26 April 2008</h4>
<h3><a href="#note" id="note"></a>Note</h3>
<p><em>This version of this essay has been adapted to use the code in <code>the-great-game.gossip.news-items</code>, <a href="the-great-game.gossip.news-items.html">q.v.</a>. The original version of the essay is <a href="https://www.journeyman.cc/blog/posts-output/2008-04-26-the-spread-of-knowledge-in-a-large-game-world/">still available on my blog</a>.</em></p>
<hr />
<p>These days we have television, and news. But in a late bronze age world there are no broadcast media. News spreads by word of mouth. If non-player characters are to respond effectively to events in the world, knowledge has to spread.</p>
<p>How to model this?</p>
<p>Some non-player characters — doesnt need to be many — are news-spreaders. News-spreaders need to travel. They have to travel even when there are no player characters in the vicinity. But, they dont have to travel very often — once or twice every game day. When a news-spreader is in the immediate vicinity of another character, the pair may (with some degree of randomness) exchange news. There needs to be a hierarchy in the exchange of news, so that I-saw events need to be more likely to be passed on than I-heard events; there needs to be a counter which counts the number of times a knowledge item has been passed on, and also an age counter so that knowledge items are less likely to be passed on as they get older.</p>
<p>One obvious class of news-spreader is a merchant. Merchant agents can either shuttle mechanically between a fixed group of markets or else possibly respond intelligently to supply and demand. Provided that there is a mesh of merchant routes covering the markets of the game world, and that a useful subset of non-merchant characters are required to visit a market every few game days, this should give a reasonably realistic framework for news spreading.</p>
<p>What else? What things qualify as news items? I think at least the following:</p>
<ul>
<li>Deaths of sentient characters, especially if violent</li>
<li>Commodity prices</li>
<li>Changes of rulers in cities</li>
<li>Marriages of sentient characters</li>
<li>Plot events, flagged as events by the game designer</li>
</ul>
<p>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.</p>
<p>So a news item becomes a map with keys similar to</p>
<pre><code>[:verb :actor :other :location :nth-hand :time-stamp]
</code></pre>
<p>The <a href="the-great-game.gossip.news-items.html#var-news-topics">exact keys for each verb are specified here</a>.</p>
<p>for example</p>
<pre><code> {:verb :kill,
:actor {:id :fred :name "Fred"},
:other {:id :joe :name "Joe"},
:location [{45467 78613} :hanshua :plateau],
:nth-hand 3,
:time-stamp 17946463}
</code></pre>
<p>meaning I spoke to a man whod 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 Hanshua 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 theres 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.</p>
<p>But if were 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</p>
<pre><code> {:verb :kill,
:actor {:id :fred :name "Fred"},
:other {:id :joe :name "Joe"},
:location [{45467 78613} :hanshua :plateau],
:nth-hand 3,
:time-stamp 17946463}
</code></pre>
<p>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. Its possible that the receiving agent could then challenge for further statements about fred and/or joe, the automated equivalent of a whos joe? question.</p>
<p>There could be feedback in this. Freds and joes 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 characters 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 bills attitude to fred should become sharply more hostile. If bill feels neutral about joe, then bills 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 bills attitude to fred should become more friendly.</p>
<p>But also, the added knowledge is <em>degraded</em>. If the recipient isnt from Hanshua, the exact location isnt meaningful to them, for example. If the recipient isnt interested in Joe, precisely who was killed may be forgotten. So what is stored could become:</p>
<pre><code> {:verb :kill,
:actor {:id :fred :name "Fred"},
:location [:hanshua :plateau],
:nth-hand 4,
:time-stamp 17946463}
</code></pre>
<p>The timestamp could also be degraded, or lost altother — although how exactly this is represnted Im 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.</p>
<p>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:</p>
<ul>
<li>Non-player characters can respond to questions about significant things which happen in the world — without it all having to be scripted</li>
<li>If you travel fast enough, you can keep ahead of your notoriety</li>
<li>Characters on major trade routes will know more about what is happening in the world than characters in backwaters</li>
</ul>
<p>This seems to me a reasonably good model of news spread.</p>
<h3><a href="#scaling-of-the-algorithm" id="scaling-of-the-algorithm"></a>Scaling of the algorithm</h3>
<p>Lets work around the idea that a game day equates to about two hours of wall clock time. Lets work around the idea that there are of the order of fifty markets in the game world, and that for each market there are two or three merchants whose home base it is.</p>
<p>Obviously non-player characters who are within the vicinity of a player character have to be awake, in order that the player can see them interacting with their world and can interact with them. Those characters have to be in working memory and have to be in the action polling loop in any case. So theres no extra cost to their gossiping away between each other — around the player theres a moving bubble of gossip, allowing each character the player interacts with to have a high probability of having some recent news.</p>
<p>But the merchants who arent in the vicinity of a player dont have to be in working memory all the time. Each merchant simply requires to be woken up — loaded into memory — once per game day, move a days journey in one hop, and then, if arriving at an inn or at a market, wake and exchange news with one resident character — an innkeeper or a gossip. So the cost of this algorithm in a fifty-market game is at worst the cost of loading and unloading two non-player characters from memory every minute, and copying two or three statements from the knowledge set of one to the knowledge set of the other. If youre dynamically modifying significance scores, of course, youd need to also load the characters about whom news was being passed on; but this still doesnt seem unduly onerous.</p>
<p>Obviously, if memory is not too constrained it may be possible to maintain all the merchants, all the innkeepers and all the characters currently being talked about in memory all the time, further reducing the cost.</p>
</div></div></div></body></html>