Game world economy
+Generated by Codox
The-great-game 0.1.0
Game world economy
Broadly this essay extends ideas presented in Populating a game world, q.v.
Primary producers
Herdsfolk
diff --git a/docs/codox/index.html b/docs/codox/index.html index 545a41e..0a34e6b 100644 --- a/docs/codox/index.html +++ b/docs/codox/index.html @@ -1,3 +1,3 @@ -Generated by Codox
The-great-game 0.1.0-SNAPSHOT
The-great-game 0.1.0-SNAPSHOT
Released under the GNU General Public License,version 2.0 or (at your option) any later version
Prototype code towards the great game I've been writing about for ten years, and know I will never finish.
Installation
To install, add the following dependency to your project or build file:
[the-great-game "0.1.0-SNAPSHOT"]
Topics
Namespaces
the-great-game.gossip.gossip
Interchange of news events between agents agents
Public variables and functions:
the-great-game.merchants.markets
Adjusting quantities and prices in markets.
Public variables and functions:
the-great-game.merchants.merchant-utils
Useful functions for doing low-level things with merchants.
Public variables and functions:
the-great-game.merchants.merchants
Trade planning for merchants, primarily.
Public variables and functions:
the-great-game.merchants.planning
Trade planning for merchants, primarily. This follows a simple-minded generate-and-test strategy and currently generates plans for all possible routes from the current location. This may not scale. Also, routes do not currently have cost or risk associated with them.
Public variables and functions:
the-great-game.merchants.strategies.simple
Default trading strategy for merchants.
Public variables and functions:
the-great-game.world.routes
Conceptual (plan level) routes, represented as tuples of location ids.
Public variables and functions:
Generated by Codox
The-great-game 0.1.0
The-great-game 0.1.0
Released under the GNU General Public License,version 2.0 or (at your option) any later version
Prototype code towards the great game I've been writing about for ten years, and know I will never finish.
Installation
To install, add the following dependency to your project or build file:
[the-great-game "0.1.0"]
Topics
Namespaces
the-great-game.gossip.gossip
Interchange of news events between agents agents
Public variables and functions:
the-great-game.merchants.markets
Adjusting quantities and prices in markets.
Public variables and functions:
the-great-game.merchants.merchant-utils
Useful functions for doing low-level things with merchants.
Public variables and functions:
the-great-game.merchants.merchants
Trade planning for merchants, primarily.
Public variables and functions:
the-great-game.merchants.planning
Trade planning for merchants, primarily. This follows a simple-minded generate-and-test strategy and currently generates plans for all possible routes from the current location. This may not scale. Also, routes do not currently have cost or risk associated with them.
Public variables and functions:
the-great-game.merchants.strategies.simple
Default trading strategy for merchants.
Public variables and functions:
the-great-game.world.routes
Conceptual (plan level) routes, represented as tuples of location ids.
Public variables and functions:
Generated by Codox
The-great-game 0.1.0-SNAPSHOT
Introduction to the-great-game
+Generated by Codox
The-great-game 0.1.0
Introduction to the-great-game
The Great Game
In this essay I’m going to try to pull together a number of my architectural ideas about the Great Game which I know I’m never actually going to build - because it’s vastly too big for any one person to build - into one overall vision.
So, firstly, how does one characterise this game?
diff --git a/docs/codox/modelling_trading_cost_and_risk.html b/docs/codox/modelling_trading_cost_and_risk.html index 71c862f..88dd04c 100644 --- a/docs/codox/modelling_trading_cost_and_risk.html +++ b/docs/codox/modelling_trading_cost_and_risk.html @@ -1,6 +1,6 @@ -Generated by Codox
The-great-game 0.1.0-SNAPSHOT
Modelling trading cost and risk
+Generated by Codox
The-great-game 0.1.0
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.
So: to what extent is it worth modelling the spread of knowledge of trade cost and risk?
diff --git a/docs/codox/sexual-dimorphism.html b/docs/codox/sexual-dimorphism.html index 54624d7..8cf4c50 100644 --- a/docs/codox/sexual-dimorphism.html +++ b/docs/codox/sexual-dimorphism.html @@ -1,6 +1,6 @@ -Generated by Codox
The-great-game 0.1.0-SNAPSHOT
Sexual dimorphism
+Generated by Codox
The-great-game 0.1.0
Sexual dimorphism
This essay is going to upset a lot of people, so let’s start with a statement of what it is about: it is an attempt to describe the systematically different behaviours of men and women, in sufficient detail that this can be represented by agents in a game world. It’s trying to allow as broad as possible a range of cultures to be represented, so when I’m talking about what I consider to be behaviours of particular cultures, I’ll say that.
Of course, I’m writing this from the view point of an old white male. It’s not possible to write about these things from a totally neutral viewpoint, and every one of us will have prejudices.
OK? Let’s start.
diff --git a/docs/codox/the-great-game.core.html b/docs/codox/the-great-game.core.html index 72be981..e85f03f 100644 --- a/docs/codox/the-great-game.core.html +++ b/docs/codox/the-great-game.core.html @@ -1,3 +1,3 @@ -Generated by Codox
The-great-game 0.1.0-SNAPSHOT
Generated by Codox
The-great-game 0.1.0
Generated by Codox
The-great-game 0.1.0-SNAPSHOT
the-great-game.gossip.gossip
Interchange of news events between agents agents
dialogue
(dialogue enquirer respondent world)
Dialogue between an enquirer
and an agent
in this world
; returns a map identical to enquirer
except that its :gossip
collection may have additional entries.
move-gossip
(move-gossip gossip world new-location)
Return a world like this world
but with this gossip
moved to this new-location
. Many gossips are essentially shadow-records of agents of other types, and the movement if the gossip should be controlled by the run function of the type of the record they shadow. The #run function below does NOT call this function.
run
(run world)
Return a world like this world
, with news items exchanged between gossip agents.
Generated by Codox
The-great-game 0.1.0
the-great-game.gossip.gossip
Interchange of news events between agents agents
dialogue
(dialogue enquirer respondent world)
Dialogue between an enquirer
and an agent
in this world
; returns a map identical to enquirer
except that its :gossip
collection may have additional entries.
move-gossip
(move-gossip gossip world new-location)
Return a world like this world
but with this gossip
moved to this new-location
. Many gossips are essentially shadow-records of agents of other types, and the movement if the gossip should be controlled by the run function of the type of the record they shadow. The #run function below does NOT call this function.
run
(run world)
Return a world like this world
, with news items exchanged between gossip agents.
Generated by Codox
The-great-game 0.1.0-SNAPSHOT
the-great-game.merchants.markets
Adjusting quantities and prices in markets.
adjust-quantity-and-price
(adjust-quantity-and-price world city commodity)
Adjust the quantity of this commodity
currently in stock in this city
of this world
. Return a fragmentary world which can be deep-merged into this world.
new-price
(new-price old stock supply demand)
If stock
is greater than the maximum of supply
and demand
, then there is surplus and old
price is too high, so shold be reduced. If lower, then it is too low and should be increased.
run
(run world)
Return a world like this world
, with quantities and prices in markets updated to reflect supply and demand.
update-markets
(update-markets world)
(update-markets world city)
(update-markets world city commodity)
Return a world like this world
, with quantities and prices in markets updated to reflect supply and demand. If city
or city
and commodity
are specified, return a fragmentary world with only the changes for that city
(and commodity
if specified) populated.
Generated by Codox
The-great-game 0.1.0
the-great-game.merchants.markets
Adjusting quantities and prices in markets.
adjust-quantity-and-price
(adjust-quantity-and-price world city commodity)
Adjust the quantity of this commodity
currently in stock in this city
of this world
. Return a fragmentary world which can be deep-merged into this world.
new-price
(new-price old stock supply demand)
If stock
is greater than the maximum of supply
and demand
, then there is surplus and old
price is too high, so shold be reduced. If lower, then it is too low and should be increased.
run
(run world)
Return a world like this world
, with quantities and prices in markets updated to reflect supply and demand.
update-markets
(update-markets world)
(update-markets world city)
(update-markets world city commodity)
Return a world like this world
, with quantities and prices in markets updated to reflect supply and demand. If city
or city
and commodity
are specified, return a fragmentary world with only the changes for that city
(and commodity
if specified) populated.
Generated by Codox
The-great-game 0.1.0-SNAPSHOT
the-great-game.merchants.merchant-utils
Useful functions for doing low-level things with merchants.
add-known-prices
(add-known-prices merchant world)
Add the current prices at this merchant
’s location in the world
to a new cacke of known prices, and return it.
add-stock
(add-stock a b)
Where a
and b
are both maps all of whose values are numbers, return a map whose keys are a union of the keys of a
and b
and whose values are the sums of their respective values.
burden
(burden merchant world)
The total weight of the current cargo carried by this merchant
in this world
.
can-afford
(can-afford merchant world commodity)
Return the number of units of this commodity
which this merchant
can afford to buy in this world
.
can-carry
(can-carry merchant world commodity)
Return the number of units of this commodity
which this merchant
can carry in this world
, given their current burden.
expected-price
(expected-price merchant commodity city)
Find the price anticipated, given this world
, by this merchant
for this commodity
in this city
. If no information, assume 1. merchant
should be passed as a map, commodity
and city
should be passed as keywords.
Generated by Codox
The-great-game 0.1.0
the-great-game.merchants.merchant-utils
Useful functions for doing low-level things with merchants.
add-known-prices
(add-known-prices merchant world)
Add the current prices at this merchant
’s location in the world
to a new cacke of known prices, and return it.
add-stock
(add-stock a b)
Where a
and b
are both maps all of whose values are numbers, return a map whose keys are a union of the keys of a
and b
and whose values are the sums of their respective values.
burden
(burden merchant world)
The total weight of the current cargo carried by this merchant
in this world
.
can-afford
(can-afford merchant world commodity)
Return the number of units of this commodity
which this merchant
can afford to buy in this world
.
can-carry
(can-carry merchant world commodity)
Return the number of units of this commodity
which this merchant
can carry in this world
, given their current burden.
expected-price
(expected-price merchant commodity city)
Find the price anticipated, given this world
, by this merchant
for this commodity
in this city
. If no information, assume 1. merchant
should be passed as a map, commodity
and city
should be passed as keywords.
Generated by Codox
The-great-game 0.1.0-SNAPSHOT
the-great-game.merchants.merchants
Trade planning for merchants, primarily.
Generated by Codox
The-great-game 0.1.0
the-great-game.merchants.merchants
Trade planning for merchants, primarily.
Generated by Codox
The-great-game 0.1.0-SNAPSHOT
the-great-game.merchants.planning
Trade planning for merchants, primarily. This follows a simple-minded generate-and-test strategy and currently generates plans for all possible routes from the current location. This may not scale. Also, routes do not currently have cost or risk associated with them.
augment-plan
(augment-plan merchant world plan)
Augment this plan
constructed in this world
for this merchant
with the :quantity
of goods which should be bought and the :expected-profit
of the trade.
Generated by Codox
The-great-game 0.1.0
the-great-game.merchants.planning
Trade planning for merchants, primarily. This follows a simple-minded generate-and-test strategy and currently generates plans for all possible routes from the current location. This may not scale. Also, routes do not currently have cost or risk associated with them.
augment-plan
(augment-plan merchant world plan)
Augment this plan
constructed in this world
for this merchant
with the :quantity
of goods which should be bought and the :expected-profit
of the trade.
Returns the augmented plan.
generate-trade-plans
(generate-trade-plans merchant world commodity)
Generate all possible trade plans for this merchant
and this commodity
in this world
.
Returned plans are maps with keys:
-
diff --git a/docs/codox/the-great-game.merchants.strategies.simple.html b/docs/codox/the-great-game.merchants.strategies.simple.html
index 8032a66..ca81e5b 100644
--- a/docs/codox/the-great-game.merchants.strategies.simple.html
+++ b/docs/codox/the-great-game.merchants.strategies.simple.html
@@ -1,4 +1,4 @@
-
Generated by Codox
The-great-game 0.1.0-SNAPSHOT
the-great-game.merchants.strategies.simple
Default trading strategy for merchants.
+Generated by Codox
The-great-game 0.1.0
the-great-game.merchants.strategies.simple
Default trading strategy for merchants.
The simple strategy buys a single product in the local market if there is one which can be traded profitably, trades it to the chosen target market, and sells it there. If there is no commodity locally which can be traded profitably, moves towards home with no cargo. If at home and no commodity can be traded profitably, does not move.
move-merchant
(move-merchant merchant world)
Handle general en route movement of this merchant
in this world
; return a (partial or full) world like this world
but in which the merchant may have been moved ot updated.
plan-and-buy
(plan-and-buy merchant world)
Return a world like this world
, in which this merchant
has planned a new trade, and bought appropriate stock for it. If no profitable trade can be planned, the merchant is simply moved towards their home.
re-plan
(re-plan merchant world)
Having failed to sell a cargo at current location, re-plan a route to sell the current cargo. Returns a revised world.
sell-and-buy
(sell-and-buy merchant world)
Return a new world like this world
, in which this merchant
has sold their current stock in their current location, and planned a new trade, and bought appropriate stock for it.
Generated by Codox
The-great-game 0.1.0-SNAPSHOT
the-great-game.utils
TODO: write docs
deep-merge
(deep-merge & maps)
Recursively merges maps. Stolen from https://dnaeon.github.io/recursively-merging-maps-in-clojure/
make-target-filter
(make-target-filter targets)
Construct a filter which, when applied to a list of maps, will pass those which match these targets
, where each target is a tuple [key value].
Generated by Codox
The-great-game 0.1.0
the-great-game.utils
TODO: write docs
deep-merge
(deep-merge & maps)
Recursively merges maps. Stolen from https://dnaeon.github.io/recursively-merging-maps-in-clojure/
make-target-filter
(make-target-filter targets)
Construct a filter which, when applied to a list of maps, will pass those which match these targets
, where each target is a tuple [key value].
Generated by Codox
The-great-game 0.1.0-SNAPSHOT
the-great-game.world.routes
Conceptual (plan level) routes, represented as tuples of location ids.
find-route
(find-route world-or-routes from to)
Find a single route from from
to to
in this world-or-routes
, which may be either a world as defined in the-great-game.world.world or else a sequence of tuples of keywords.
find-routes
(find-routes routes from)
(find-routes routes from to)
(find-routes routes from to steps)
Find routes from among these routes
from from
; if to
is supplied, to to
, by breadth-first search.
Generated by Codox
The-great-game 0.1.0
the-great-game.world.routes
Conceptual (plan level) routes, represented as tuples of location ids.
find-route
(find-route world-or-routes from to)
Find a single route from from
to to
in this world-or-routes
, which may be either a world as defined in the-great-game.world.world or else a sequence of tuples of keywords.
find-routes
(find-routes routes from)
(find-routes routes from to)
(find-routes routes from to steps)
Find routes from among these routes
from from
; if to
is supplied, to to
, by breadth-first search.
Generated by Codox
The-great-game 0.1.0-SNAPSHOT
the-great-game.world.run
Run the whole simulation
run
(run world)
(run world date)
The pipeline to run the simulation each game day. Returns a world like this world, with all the various active elements updated. The optional date
argument, if supplied, is set as the :date
of the returned world.
Generated by Codox
The-great-game 0.1.0
the-great-game.world.run
Run the whole simulation
run
(run world)
(run world date)
The pipeline to run the simulation each game day. Returns a world like this world, with all the various active elements updated. The optional date
argument, if supplied, is set as the :date
of the returned world.
Generated by Codox
The-great-game 0.1.0-SNAPSHOT
the-great-game.world.world
Access to data about the world
actual-price
(actual-price world commodity city)
Find the actual current price of this commodity
in this city
given this world
. NOTE that merchants can only know the actual prices in the city in which they are currently located.
run
(run world)
(run world date)
Return a world like this world
with only the :date
to this date
(or id date
not supplied, the current value incremented by one). For running other aspects of the simulation, see the-great-game.world.run.
Generated by Codox
The-great-game 0.1.0
the-great-game.world.world
Access to data about the world
actual-price
(actual-price world commodity city)
Find the actual current price of this commodity
in this city
given this world
. NOTE that merchants can only know the actual prices in the city in which they are currently located.
run
(run world)
(run world date)
Return a world like this world
with only the :date
to this date
(or id date
not supplied, the current value incremented by one). For running other aspects of the simulation, see the-great-game.world.run.