Added ideas about scheduling daily behaviour.
All tests currently pass, but that's at least partly because a lot of the new code doesn't yet have tests.
This commit is contained in:
parent
1c4cb01af5
commit
81ceaec950
130
doc/Biomes and ecology.md
Normal file
130
doc/Biomes and ecology.md
Normal file
|
@ -0,0 +1,130 @@
|
|||
# Biomes and ecology
|
||||
*The motivation for this document was to explain the mulberry trees in the Tcha valley, and think about why Tchahua is especially a centre for the silk trade*
|
||||
|
||||
## Broader geography
|
||||
|
||||
The broader geography of the world is not a matter for this document, but TODO: there isn't yet a document which usefully describes it, and there needs to be.
|
||||
|
||||
|
||||
## Biomes relevant at this stage
|
||||
|
||||
### 1. Steppe
|
||||
|
||||
The centre of the continent is the steppe; it is generally too arid for forest growth, and is therefore scrub and grassland. There is one principal river system, which feeds into a marshland in the south, from which the water then goes underground beneath the limestone plateau to become the Tcha and Sind rivers. In late summer there's little water in the river, and few other waterholes. Antelope, camels, horses, goats, possibly sheep are native to the steppe, and there are probably something like leopards which predate on them, but I haven't fleshed it out.
|
||||
|
||||
Big dragons don't hunt on the steppe because they can't take off from flat ground, but smaller dragons may do so.
|
||||
|
||||
Settled by the steppe tribes, who are nomadic herders, extremely warlike but not technically highly developed. They are the game world's principle horse breeders. Basically in the game as I'm working on it at present, the player cannot go north across the steppe because the steppe tribes are too hostile.
|
||||
|
||||
A single major road, the Caravan Road, runs north to south across the steppe. There were in the past fortified caravanserrais along the length of the road, established and protected by Hans'hua, but they have been progressively overrun and destroyed by the steppe tribes and are now ruinous. Only one remains: the North Inn, just below the northern slope of the plateau. There is some limited horticulture on land close to the South Inn, supplying markets in Hans'hua.
|
||||
|
||||
### 2. Plateau
|
||||
|
||||
The limestone plateau runs along the whole of the southern edge of the steppe, from the western massif to the rim of the crater which forms The Great Place. It is a landscape of clints and grykes, on which nothing grows, and on which there is no water. It is about four day's journey by fast horse from north to south. The caravan road crosses the plateau from the North Inn to another caravanserrai, the South Inn, located in the north end of the Tcha valley. Because of the dense chaotic pattern of clints and grykes and the lack of accessible water, it is effectively impossible to cross the plateau other than by the caravan road, or by another path to the extreme east of the plateau, where it abuts the mountains of the Rim.
|
||||
|
||||
#### 2.1 Hans'hua
|
||||
|
||||
There is one city, Hans'hua, on the caravan road about half way across the plateau, where wind-pumps lift water from the underground river. Apart from this one city, nothing lives on the plateau. Migrating birds cross it, and that is all.
|
||||
|
||||
The city is small, walled, and run as an extreme neoliberal oligarchy; the city's main industry is maintaining the wind pumps, and its entire income is from tolls on caravans passing along the caravan road. This has been, and is still, extremely lucrative, but it is obvious both to the long distance merchants and to the oligarchs that the new ships are going to make the caravans too slow, too risky and too expensive to compete, and that as more ships are built, traffic on the caravan road will dwindle.
|
||||
|
||||
### 3. Massif
|
||||
|
||||
There's a granite intrusion which forms the entire western coast of the continent. It's geologically old and consequently the hills, though high, are rounded rather than jagged; at the southern end of the range (which is the only part that's in the least fleshed out yet) they're not snow covered in summer. As the prevailing winds are westerly, this massif intercepts most of the rain, which is why the steppe is arid.
|
||||
|
||||
Consequently it's pretty thoroughly forested, and the southern parts of it are mainly broadleaf forests including high quality hardwoods and many fruiting trees. Understory typical of mediterranean littoral forests, about which I don't really know enough.
|
||||
|
||||
Deer, cattle, pigs, wolves, leopards, badgers, squirrels… masses of birds of all appropriate types.
|
||||
|
||||
Because it's an old granite intrusion, the soil in the valleys is largely clay. There are mineral rich veins with a considerable range of minerals, but, obviously, not all in the same place.
|
||||
|
||||
Settled by the Western Clans, a negroid people living mainly in small isolated villages in the forest, with mostly limited agriculture.
|
||||
|
||||
#### 3.1 Northern massif
|
||||
|
||||
I haven't yet fleshed this out, but there are probably permanent snows and the forests are probably coniferous. It's my current working assumption that the new great ships are built from old growth conifers, taken from forests in the northern massif; but as I say this is not yet fleshed out.
|
||||
|
||||
The northern culture have developed very high quality ceramics using clay from the massif, including stonewares and porcelaines. I think the same clays also exist in the south of the massif, but the technology for producing high quality ceramics does not exist there. The northerners are also making high quality steels from magnetite and haematite from the massif. Whether these ores exist in the south I don't yet know.
|
||||
|
||||
#### 3.2 Dor
|
||||
|
||||
The northernmost of the western clans, the Dor, live in the central massif north of Andale, but apart from the fact that they exist and they're there, I don't yet really know much.
|
||||
|
||||
#### 3.3 Andale
|
||||
|
||||
The river An rises in the east of the massif near the south-west corner of the steppe, west of where the village and market of Dawnhold now stand, and flows more or less due westward. There are two major drops in the river's course, the upper a day's travel east of Silverhold, which is an actual fall of at least six metres, and the lower at Anghold. Between Anghold and Silverhold the river is navigable by small shallow draught boats; west of Anghold it is navigable down to the sea at Anmouth.
|
||||
|
||||
There are freshwater and migratory fish in the river, and fishing is a source of protein and livelihood the whole length of the valley.
|
||||
|
||||
The valley is largely forested. Apart from wild animals, domestic cattle and pigs are herded in the forest. Trees include alder, almond, apple, apricot, ash, beech, birch, cherry, chestnut, hazel, holly, lime, maple, mulberry, oak, orange, pear, walnut, yew.
|
||||
|
||||
##### 3.3.1 Dawnhold
|
||||
|
||||
Dawnhold isn't strictly geographically in Andale — it's east of, on the steppe side of, the watershead, but it marks the eastern border of the lands settled by clan An. There's an annual market, a village, and a garrisoned fortification to deter raids by the steppe tribes.
|
||||
|
||||
##### 3.3.2 Silverhold
|
||||
|
||||
Small town serving the only significant silver mine in the world. A tributary flows in from the north here, but I know nothing about it yet. There is a major fortification/refinery/treasury. All around Silverhold, right up to the headwaters of the An and right down to Anghold, the valley is forested with only small clearings round villages, which are mainly close to the river.
|
||||
|
||||
Many other metals — certainly inluding lead, tin, and small quantities of gold, probably not copper — come out of the mines at Silverhold.
|
||||
|
||||
The An produce enough ferrous metals for their own tools and weapons, but their iron smelting technology is not advanced and they don't export iron or iron products. They produce eathernware ceramics for domestic consumption. They produce leather and linen, and textiles from nettle fibres. They produce timber, which is their principal building material, but they don't export it. In practice their major export is silver coinage.
|
||||
|
||||
##### 3.3.3 Longwater
|
||||
|
||||
Longwater is a long, narrow lake, like Loch Lomond, on a tributary which flows into the An from the south, joining upstream from Anghold. There is no major nucleated settlement on Longwater, but there are sufficient small villages and hamlets on its banks to form an identifiable settlement cluster. Small boats can make it downstream from Longwater from the An and back, probably with some degree of portage around rapids. There's a pass over from the south of the Longwater valley to Gor territory, but it's high, difficult, and not much used. The whole of the Longwater valley is broadleaf forest.
|
||||
|
||||
##### 3.3.4 Anghold
|
||||
|
||||
There's a small town, market and fortification — Anghold — on the south bank of the An, just above first cataract, where boats are portaged up from the lower river to the middle reach. Downstream from Anghold the river is wider, slower and more meandering, with marshy banks. The valley west of Anghold, especially on the southern side, is also more populated, with more of the forest cleared and more arable agriculture.
|
||||
|
||||
##### 3.3.5 Anmouth
|
||||
|
||||
The An meets the sea at Anmouth, where there is a deep harbour at a bend in the river just east of a long estuary, There is a bar, making it dangerous to enter the harbour in bad weather, and the whole estuary is pretty exposed to western storms, although there may be some islands providing some shelter for emergency anchorages — I don't have that level of detail yet. Certainly the big new ships do not yet call in here, but could.
|
||||
|
||||
There are farming and sea-fishing villages down both sides of the estuary. There is no tradition of ship building, however.
|
||||
|
||||
#### 3.4 Gor
|
||||
|
||||
Clan Gor occupy the south-western peninsula of the continent, and the south slope of the massif, east almost as far as the Tcha valley. Their land is forested with a similar mix of trees to Andale. They have no major rivers, but several minor ones. They live mainly in coastal villages, and sea fishing is a major economic activity. They have no deep water ports.
|
||||
|
||||
In addition they do mine iron, and they have exported swords, but the market for their swords is being undercut by better crucible steel swords from the north now being imported into the Cities of the Coast by the new ships. Similarly, the Gor used to export earthenware, but that too is now being undercut by stonewares and porcelaines from the north.
|
||||
|
||||
Because of a history of being victims of raiding from the Cities of the Coast, the Gor maintain a fortified eastern border along the line of hills to the west of the Tcha valley. Nevertheless they have mostly good trading relationships with Tchahua. In particular they export large quantities of raw and spun silk, and some woven silk cloth, to Tchahua.
|
||||
|
||||
I don't yet have nearly a clear enough picture of the organisation and layout of the Gor lands, but their major stronghold and administrative centre must be to the east. While they traditionally had the communist and democratic culture of the other Western Clans, one family have become dominant and have become effectively hereditary leaders, influenced by the cultures to their east. However the leading family do not self-identify as aristons.
|
||||
|
||||
### 4. Coast
|
||||
|
||||
"The Coast" is the name given to the southern littoral of the continent, west of the Great Place and east of the Massif. It's limestone, with deeply cut, steep sided valleys separated by high, arid uplands, with scrubby vegetation, grazed by domestic sheep and both domestic and wild goats.
|
||||
|
||||
The native culture were peaceable, communistic agriculturalists, not greatly different from the Western Clans. However some several hundred years ago they were invaded by a warrior group from the steppe tribes, who established themselves as a military aristocracy — the Aristae — and started to build cities — and impose taxes onto the peasantry, forcing them into a more or less cash oriented economy.
|
||||
|
||||
The valleys were once forested, but the central valleys, which were in any case rather dryer and where the Aristae first settled and established cities, are now mostly cleared, and are a mix of pastoral and arable, with considerable viticulture.
|
||||
|
||||
#### 4.1 Tcha valley
|
||||
|
||||
The Tcha is the westernmost — and largest — river of the coast. It emerges from under the plateau at a pool under the South Tower marking the southern limit of Hans'hua territory and runs south more or less along the divide between the granite to the west and the limestone to the east. It is still largely forested, partly because it is relatively recently occupied by the Aristae, but partly because of the growth of the silk industry. This has led to some forested areas, especially near the navigable reaches of the river, being converted into mulberry orchards. However, there's still a great deal of mixed forest, and the majority of mulberry leaves for feeding to silk worms are gathered from natural forest.
|
||||
|
||||
A road branches off from the main Caravan Road at the South Inn and runs down the eastern side of the valley, to a ferry across the Sind river, where it joins the Tcha as a tributary, at the village helpfully known as Sind Ferry, and thence to Tchahua.
|
||||
|
||||
Mulberries, by products of the silk industry, are used in the production of brandy. Mulberry wine is produced in villages in the forest, and transported down river to a distillery at Sind Ferry, where it is distilled. Some mulberry wine may be sold in Tchahua for drinking as wine (and it is certainly drunk in the villages), but it is generally considered inferior to grape wine.
|
||||
|
||||
There is some arable and mixed agriculture, mainly towards the southern end of the valley on the western (less steep) side, although this side is also largely forested.
|
||||
|
||||
##### 4.1.1 Tchahua
|
||||
|
||||
The city of Tchahua lies on the east bank of the river at the head of its estuary, and has deep water — the only really usable deep water port on the coast, being not only the largest river but also the least silted. Until quite recently it had been a small provincial silk weaving city, nominally independent but in fact paying tribute to both Sinhua to its east and the Gor to its west, in order to avoid being formally conquered by either.
|
||||
|
||||
There's a multi-span bridge here — I think a pontoon bridge — of which the eastern most span is a drawbridge which can be lifted into a fortified gateway on the eastern (Tchahua) shore. There is a fishing industry, but as the eastern side
|
||||
|
||||
Industries are silk weaving and dying, and fishing. Very recently, a new deep water quay has been constructed and the first large ships have begun to call. It is obvious that the city is going to become much more important as a strategic market and transport hub, but that has only just begun to have effect.
|
||||
|
||||
### 4.2 Sind valley
|
||||
|
||||
#### 4.2.1 Sinhua
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,16 +1,27 @@
|
|||
# Division of tasks between server and client
|
||||
|
||||
An alternative nomentclature I may use for this dichotomy would be _planner_ and _performer_; it would be the same dichotomy. 'Planner' and 'server' are synonyms; 'performer' and 'client' are synonyms.
|
||||
|
||||
## What do I mean by the 'server'?
|
||||
|
||||
There is something which manages game state and things like the gossip network, merchant network, and major world events. This something is almost certainly written in some form of Lisp; I'd prefer Clojure but I don't think it's performant enough so probably Common Lisp. This means that it has inevitable pauses for garbage collection. Underneath this is a database which handles persistent storage of game state, which is probably an SQL database and quite likely [SQLite](https://www.sqlite.org/index.html).
|
||||
|
||||
The initial idea of The Great Game is that it is a single player game, but it actually doesn't need to be and it would be quite possible for one server to support multiple clients, each being used by a different player.
|
||||
|
||||
The server/planner decides what each actor does, models what each character knows, plans and records all actions and transactions. It plans speach acts, and handles conversations which happen off screen, but hands speech texts over to the client/performer layer for actual performance. It also plans journeys as described in [[Pathmaking]], but it doesn't deal with movement within a polygon or with collision avoidance. It deals with fights which happen off screen, but not those that happen on screen.
|
||||
|
||||
## What do I mean by the client?
|
||||
|
||||
There is something that renders an interesting and lively display of the part of the game world that the player can see from their current position. This display has to run without significant pauses — it's not OK, for example, for all conversation to stop suddenly in a market place just because the server is garbage collecting.
|
||||
|
||||
The client is written in some high level game engine system, possibly Unreal Engine (although for ideological reasons I'd prefer an open source one).
|
||||
|
||||
The client/performer renders and animates everything the player character can see, and performs every sound the player character can hear. In doing this it is responsible for
|
||||
|
||||
1. The rendering of landscape, vegetation, buildings, furniture, and everything else that is fixed within the visible scene;
|
||||
2. The animation of everything which moves within the visible scene, and, to facilitate this, detailed route planning and collision avoidance;
|
||||
3. The performance of all speech acts and gestures, all musical performance, and the playing of all [foley](https://en.wikipedia.org/wiki/Foley_(filmmaking)) sounds;
|
||||
4. Combat which happens in the field of view, including specifically all combat (including sparring) involving the player character. This means that the client/performer is the bit of the system which decides what blows are struck and whether they hit their targets, and consequently which character wins each fight. It reports this information back to the server.
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ First, a framing disclaimer: in [Racundra's First Cruise](https://books.google.c
|
|||
|
||||
I will never build a complete version of The Great Game; it will probably never even be a playable prototype. It is a minor side-project of someone who
|
||||
|
||||
1. Is ill, and consequently has inconsistent levels of energy and concentration;
|
||||
1. Is old and ill, and consequently has inconsistent levels of energy and concentration;
|
||||
2. Has other things to do in the real world which necessarily take precedence.
|
||||
|
||||
Nevertheless, in making design choices I want to specify something which could be built, which could, except for the technical innovations I'm trying myself to build, be built with the existing state of the art, and which if built, would be engaging and interesting to play.
|
||||
|
@ -35,6 +35,8 @@ This doesn't mean that speech acts by non-player characters which make plot poin
|
|||
|
||||
Modern Role Playing Games are, in effect, extremely complex state machines: if you do the same things in the same sequence, the same outcomes will always occur. In a world full of monsters, bandits, warring armies and other dangers, the same quest givers will be in the same places at the same times. They are clockwork worlds, filled with clockwork automata. Of course, this has the advantage that is makes testing easier - and in a game with a complex branching narrative and many quests, testing is inevitably hard.
|
||||
|
||||
Interestingly, [Kenshi](https://lofigames.com/) — a game I'm increasingly impressed and influenced by — is not quite clockwork in this sense. As the player upsets the equilibrium of the game's political economy, factions not impacted negatively will move against competing factions which are impacted negatively, in a way which *may* be scripted, but it's so well done it's hard to tell.
|
||||
|
||||
My vision for The Great Game is different. It is that the economy - and with it, the day to day choices of non-player characters - should be modelled. This means, non-player characters may unexpectedly die. Of course, you could implement a tag for plot-relevant characters which prevents them being killed (except when required by the plot).
|
||||
|
||||
## Plot follows player
|
||||
|
@ -45,15 +47,15 @@ Another solution - which I'd like to explore - is 'plot follows character'. The
|
|||
|
||||
## Cut scenes, cinematics and rewarding the player
|
||||
|
||||
There's no doubt at all that 'cut scenes' - in effect, short movies spliced into game play during which the player has no decisions to make but can simply watch the scene unroll - are elements of modern games which players enjoy, and see to some extent as 'rewards'. And in many games, these are beautifully constructed works. It is a very widely held view that the quality of cutscenes depends to a large degree on human authorship. The three choices I've made above:
|
||||
There's no doubt at all that 'cut scenes' - in effect, short movies spliced into game play during which the player has no decisions to make but can simply watch the scene unroll - are elements of modern games which players enjoy, and see to some extent as 'rewards'. And in many games, these are beautifully constructed works. It is a very widely held view that the quality of cutscenes depends to a large degree on human authorship. The choices I've made above:
|
||||
|
||||
1. We can't always know exactly what non-player characters will say (although perhaps we can in the context of cut scenes where the player has no input);
|
||||
2. We can't always know exactly which non-player characters will speak the lines;
|
||||
3. We can't predict what a non-player character will say in response to a question, or how long that will take;
|
||||
4. We can't always know where any particular plot event will take place.
|
||||
4. We can't always know where any particular plot event will take place;
|
||||
|
||||
Each of these, obviously, make the task of authoring an animation harder. The general summary of what I'm saying here is that, although in animating a conversation or cutscene what the animator is essentially animating is the skeletons of the characters, and, provided that all character models are rigged on essentially similar skeletons, substituting one character model for another in an animated scene isn't a huge issue, with so much unknowable it is impossible that hand-authoring will be practicable, and so a lot will depend on the quality of the conversation system not merely to to produce convincingly enunciated and emoted sound, but also appropriate character animation and attractive cinematography. As you will have learned from the Mass Effect analysis videos I linked to above, that's a big ask.
|
||||
each, make the task of authoring an animation harder. The general summary of what I'm saying here is that, although in animating a conversation or cutscene what the animator is essentially animating is the skeletons of the characters, and, provided that all character models are rigged on essentially similar skeletons, substituting one character model for another in an animated scene isn't a huge issue, with so much unknowable it is impossible that hand-authoring will be practicable, and so a lot will depend on the quality of the conversation system not merely to to produce convincingly enunciated and emoted sound, but also appropriate character animation and attractive cinematography. As you will have learned from the Mass Effect analysis videos I linked to above, that's a big ask.
|
||||
|
||||
Essentially the gamble here is that players will find the much richer conversations, and consequent emergent gameplay, possible with non-player charcaters who have dynamic knowledge about their world sufficiently engaging to compensate for a less compelling cinematic experience. I believe that they would; but really the only way to find out would be to try.
|
||||
|
||||
Interestingly, an [early preview](https://youtu.be/VwwZx5t5MIc?t=327) of CD PRoject Red's not-yet-complete [Cyberpunk 2077](https://www.cyberpunk.net/us/en/cyberpunk-2077) suggests that there will be very, very few cutscenes, suggesting that these very experienced storytellers don't feel they need cutscenes either to tell their story or maintain player engagement.
|
||||
Interestingly, an [early preview](https://youtu.be/VwwZx5t5MIc?t=327) of CD Project Red's [Cyberpunk 2077](https://www.cyberpunk.net/us/en/cyberpunk-2077) has relatively few cutscenes, suggesting that these very experienced storytellers don't feel they need cutscenes either to tell their story or maintain player engagement.
|
||||
|
|
26
doc/Not my problem.md
Normal file
26
doc/Not my problem.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
# Not my problem
|
||||
|
||||
## Introduction
|
||||
|
||||
This document is essentially a catalogue of side-tracks which I do not have to go down when implementing The Great Game. Solved problems; or problems which are common to many other games, so if I don't solve them someone else will. The object of doing this is to work down to a constrained set of problems which are genuinely things I'm trying to innovate, which I should focus on; which essentially come down to
|
||||
|
||||
1. Gossip
|
||||
2. Reputation
|
||||
3. Dynamic character motivation and action, and hence
|
||||
4. Dynamic economy, and
|
||||
5. Dynamic plot
|
||||
6. Procedural ('genetic') buildings.
|
||||
|
||||
(Note that although procedural vegetation is in principle a solved problem and so I don't need to solve it, I need repeatable procedural vegetation so I need to be a bit careful about the procedural vegetation library I pick).
|
||||
|
||||
## Animation
|
||||
|
||||
I envisage a well rendered three dimensional world in which many non-player characters interact with one another and with the player character. All of my characters are either human, quadrupeds, or birds (my dragons animate like very large birds). The humans are all just human; there are infants, children, adolescents, youths, adults, elderly; there are multiple racial types — but they're all human. Systems for creating varied distinct human models exist; systems for animating them exist; systems for applying and animating clothing exist. Even systems for animating continuous speech exist.
|
||||
|
||||
## Rendering
|
||||
|
||||
Ideally I'd like a stylised, not-quite-photorealistic render, because such things age, in my opinion, better than things which do seek to be photorealistic. But actually that does not matter very much; the game won't be made or broken by its rendering. Photorealistic renders are sort of the current default, that most game engines.
|
||||
|
||||
## Continuous Open World
|
||||
|
||||
I've done a great deal of thinking about how to render a continuous open world over the years, and I think at least some of it is reasonably good; but I haven't actually written any code, and in the same time period other people have written continuous open world libraries which do work, so I'd be much better choosing an existing one.
|
|
@ -20,7 +20,7 @@ Routing is fundamentally by [A\*](https://www.redblobgames.com/pathfinding/a-sta
|
|||
|
||||
#### Algorithmic rules
|
||||
|
||||
1. No route may pass through any part of a reserved holding, except the holding which is its origin, if any, and the holding which is its destination (and in any case we won't render paths or roads within holdings, although traversal information may be used to determine whether a holding, or part of it, is paved/cobbled;
|
||||
1. No route may pass through any part of a reserved holding, except the holding which is its origin, if any, and the holding which is its destination, if any (and in any case we won't render paths or roads within holdings, although traversal information may be used to determine whether a holding, or part of it, is paved/cobbled;
|
||||
2. No route may pass through any building, with the exception of a city gate;
|
||||
3. We don't have bicycles: going uphill costs work, and you don't get that cost back on the down hill. Indeed, downhills are at least as expensive to traverse as flat ground;
|
||||
4. Any existing route segment costs only a third as much to traverse as open ground having the same gradient;
|
||||
|
|
12
doc/intro.md
12
doc/intro.md
|
@ -321,7 +321,13 @@ maybe around 10%.
|
|||
|
||||
A caravan or ship costs so much per day to run, irrespective of whether full
|
||||
or empty. So the base cost of a journey is a function of the time taken, which
|
||||
is essentially a function of the distance.
|
||||
is essentially a function of the distance.
|
||||
|
||||
Obviously, on top of the base cost of movement there are tolls, which are imposed
|
||||
by the aristons through whose territory the journey passes (and therefore predictable,
|
||||
and can be used in route planning), and also the risk of having to bribe or fight outlaws,
|
||||
and the possible need to hire mercenaries to defend against outlaws, which is not predictable
|
||||
but can be estimated and thus also used in route planning.
|
||||
|
||||
### Outlawry and merchants
|
||||
|
||||
|
@ -329,7 +335,7 @@ Outside the domains of aristons, outlaws may intercept caravans; when this
|
|||
happens the following outcomes are possible:
|
||||
|
||||
1. The merchant (together with any mercenaries the merchant has hired to protect the caravan) successfully fights off the outlaws;
|
||||
2. The outlaws steal the entire cargo (and may kill the merchant);
|
||||
2. The outlaws steal the entire cargo (and may kill the merchant and others);
|
||||
3. The merchant pays protection money to the outlaws, typically around 5%-10% of the value of cargo carried;
|
||||
4. The merchant employs the outlaws as caravan guards (see below);
|
||||
5. The outlaws allow the caravan to pass unmolested;
|
||||
|
@ -362,7 +368,7 @@ 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.
|
||||
there's probably a toll 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
|
||||
|
|
|
@ -4,17 +4,21 @@
|
|||
(:require [cc.journeyman.the-great-game.objects.game-object :refer [ProtoObject]]
|
||||
[cc.journeyman.the-great-game.objects.container :refer [ProtoContainer]]))
|
||||
|
||||
;;; hierarchy of needs probably gets implemented here
|
||||
;;; I'm probably going to want to defprotocol stuff, to define the hierarchy
|
||||
;;; of things in the gameworld; either that or drop to Java, wich I'd rather not do.
|
||||
;;; hierarchy of needs probably gets implemented here
|
||||
;;; I'm probably going to want to defprotocol stuff, to define the hierarchy
|
||||
;;; of things in the gameworld; either that or drop to Java, wich I'd rather not do.
|
||||
|
||||
;;; attitudes - liking/disliking, attraction/repulsion, amity/hostility, trust/fear
|
||||
;;; also need to live at this layer, even though dynamic change in attitudes belongs
|
||||
;;; in the character layer.
|
||||
|
||||
(defprotocol ProtoAgent
|
||||
"An object which can act in the world"
|
||||
(act
|
||||
[actor world circle]
|
||||
"Allow `actor` to do something in this `world`, in the context of this
|
||||
"Allow `actor` to do something in this `world`, in the context of this
|
||||
`circle`; return the new state of the actor if something was done, `nil`
|
||||
if nothing was done. Circle is expected to be one of
|
||||
if nothing was done. `Circle` is expected to be one of
|
||||
|
||||
* `:active` - actors within visual/audible range of the player
|
||||
character;
|
||||
|
@ -22,24 +26,86 @@
|
|||
to it that they may enter the active circle within a short period;
|
||||
* `:background` - actors who are active in the background in order to
|
||||
handle trade, news, et cetera;
|
||||
* `other` - actors who are not members of any other circle, although
|
||||
I'm not clear whether it would ever be appropriate to invoke an
|
||||
`act` method on them.
|
||||
* `:other` - actors who are not members of any other circle.
|
||||
|
||||
The `act` method *must not* have side effects; it must *only* return a
|
||||
new state. If the actor's intention is to seek to change the state of
|
||||
something else in the game world, it must add a representation of that
|
||||
intention to the sequence which will be returned by its
|
||||
`pending-intentions` method.")
|
||||
(hungry? [actor world circle] "True if this actor is hungry and has no
|
||||
immediate access to food.")
|
||||
(pending-intentions
|
||||
[actor]
|
||||
"Returns a sequence of effects an actor intends, as a consequence of
|
||||
acting. The encoding of these is not yet defined."))
|
||||
acting.")
|
||||
(pending-scheduled-action? [actor world circle]
|
||||
"True if there is a plan in this `actor`'s
|
||||
schedule which should be activated now.
|
||||
NOTE THAT plans in the `daily` schedule are
|
||||
NOT activated when in circles `:background`
|
||||
or `:other`")
|
||||
(plan-fight-or-flight [actor world circle]
|
||||
"Return a plan to resolve any active threat to this
|
||||
`actor` in this `world`.")
|
||||
(plan-find-food [actor workd circle]
|
||||
"Return a plan to find this `actor` food in this `world`.")
|
||||
(plan-find-rest [actor workd circle]
|
||||
"Return a plan to find this `actor` a safe place to rest, or
|
||||
if in one, to actually rest, in this `world`.")
|
||||
(plan-goal [actor world circle] "Return a plan to advance this `actor`
|
||||
towards their personal objective, in this
|
||||
world, or `nil` for default actors with no
|
||||
objective.")
|
||||
(plan-scheduled-action [actor workd circle]
|
||||
"Return a plan taken from the schedule of this actor
|
||||
for the current date and time, if any, else `nil`.")
|
||||
(schedule [actor] "Return a map of scheduled actions for this `actor`.
|
||||
TODO: work out the detailed format!")
|
||||
(threatened? [actor world circle] "True if this `actor` is threatened in this
|
||||
`world`.")
|
||||
(tired? [actor world circle] "True if this `actor` needs rest."))
|
||||
|
||||
(defrecord Agent
|
||||
;; "A default agent."
|
||||
[name craft home culture]
|
||||
[name craft home culture]
|
||||
ProtoObject
|
||||
ProtoContainer
|
||||
ProtoAgent
|
||||
)
|
||||
|
||||
(act
|
||||
“Return a world like this `world `except that this `actor `has acted in it.
|
||||
‘Circle’ indicates which activation circle the actor is in.
|
||||
|
||||
Note that this implies that a `plan `is a function of three arguments, an
|
||||
actor, a world. and a circle.”
|
||||
[actor world circle]
|
||||
(let [urgent (case circle
|
||||
:other (cond
|
||||
(pending-scheduled-action? actor world circle)
|
||||
(plan-scheduled-action actor world circle)
|
||||
(empty? (:plans actor))
|
||||
(plan-goal actor world circle))
|
||||
:background (cond
|
||||
(threatened? actor world circle)
|
||||
(plan-fight-or-flight actor world circle)
|
||||
(pending-scheduled-action? actor world circle)
|
||||
(plan-scheduled-action actor world circle)
|
||||
(empty? (:plans actor))
|
||||
(plan-goal actor world circle))
|
||||
;; else
|
||||
(cond
|
||||
(threatened? actor world circle)
|
||||
(plan-fight-or-flight actor world circle)
|
||||
(hungry? actor world circle)
|
||||
(plan-find-food actor world circle)
|
||||
(tired? actor world circle)
|
||||
(plan-find-rest actor world circle)
|
||||
(pending-scheduled-action? actor world circle)
|
||||
(plan-scheduled-action actor world circle)
|
||||
(empty? (:plans actor))
|
||||
(plan-goal actor world circle)))
|
||||
a’ (if urgent
|
||||
(assoc actor :plans (cons urgent (:plans actor)))
|
||||
actor)]
|
||||
(eval ((first (:plans a’)) a’ world)))))
|
||||
|
|
63
src/cc/journeyman/the_great_game/agent/schedule.clj
Normal file
63
src/cc/journeyman/the_great_game/agent/schedule.clj
Normal file
|
@ -0,0 +1,63 @@
|
|||
(ns cc.journeyman.the-great-game.agent.schedule
|
||||
"Schedules of plans for actors in the game, in order that they may have
|
||||
daily and seasonal patterns of behaviour.")
|
||||
|
||||
;; TODO: I don't have a good handle yet on when a new scheduled task can
|
||||
;; interrupt an existing scheduled task. It's highly undesirable that
|
||||
;; uncompleted scheduled tasks should be left on the queue. The simplest
|
||||
;; solution is to arrange the schedule such that, under notmal circumstances,
|
||||
;; no scheduled task will interrupt another. But if a scheduled task is
|
||||
;; interrupted by an attack, say, or a conversation, and then continued,
|
||||
;; there's a chance of overrunning the start of the next.
|
||||
;;
|
||||
;; Perhaps I need to give scheduled tasks the equivalent of a watchdog timer,
|
||||
;; but that makes them much more sophisticated objects than I wanted them to
|
||||
;; be.
|
||||
|
||||
;; NOTE: this assumes that a world contains a key `:time` whose values are
|
||||
;; a map with at least the keys
|
||||
;; 1. `:day`, whose value is an integer representing the current day of the
|
||||
;; year, and
|
||||
;; 2. `minute`, whose value is an integer representing the current minute of
|
||||
;; the day.
|
||||
;; it probably also includes a `:year`, but that isn't needed here.
|
||||
|
||||
;; (def default-human-schedule
|
||||
;; "A sample schedule for a human actor. This assumes that each of:
|
||||
;; 1. `find-food`;
|
||||
;; 2. `goto-market`;
|
||||
;; 3. `help-with-harvest`;
|
||||
;; 3. `perform-craft`
|
||||
;; 4. `sleep-until-dawn`
|
||||
;; Are plans, which is to say, functions of three arguments, an `actor`,
|
||||
;; a `world` and a `circle`."
|
||||
;; {:annual {32 {:daily {1020 (fn [a w c] (attend-festival a w c :imbolc))}}
|
||||
;; 122 {:daily {1020 (fn [a w c] (attend-festival a w c :bealtaine))}}
|
||||
;; 210 {:daily {480 help-with-harvest}}
|
||||
;; 211 {:daily {480 help-with-harvest}}
|
||||
;; 212 {:daily {480 help-with-harvest}}
|
||||
;; 213 {:daily {480 help-with-harvest}}
|
||||
;; 214 {:daily {480 help-with-harvest
|
||||
;; 1020 (fn [a w c](attend-festival a w c :lughnasadh))}}
|
||||
;; 306 {:daily {1020 (fn [a w c] (attend-festival a w c :samhain))}}}
|
||||
;; :daily {420 find-food
|
||||
;; 480 (fn [actor world circle]
|
||||
;; (case circle
|
||||
;; (:other :background) nil
|
||||
;; ;; else
|
||||
;; (if (has-craft-supplies? actor world circle)
|
||||
;; (goto-market actor world circle)
|
||||
;; (perform-craft actor world circle))))
|
||||
;; 720 find-food
|
||||
;; 780 perform-craft
|
||||
;; 1020 find-food
|
||||
;; 1320 sleep-until-dawn}})
|
||||
|
||||
(defn plan-scheduled-action [actor world circle]
|
||||
"Return the scheduled plan for the current time in this `world` from the
|
||||
schedule of this `actor`, provided the `actor is in an appropriate `circle`"
|
||||
(case circle
|
||||
(:active :pending) (let [s (:schedule actor)
|
||||
d (or (:daily (-> s :annual (-> world :time :day)))
|
||||
(:daily s))]
|
||||
(when d (d (-> world :time :minute))))))
|
9
src/cc/journeyman/the_great_game/character/character.clj
Normal file
9
src/cc/journeyman/the_great_game/character/character.clj
Normal file
|
@ -0,0 +1,9 @@
|
|||
(ns cc.journeyman.the-great-game.character.character
|
||||
"A character that can talk; either human or dragon (although very probably
|
||||
we won't do talking dragons until really well into this process). All
|
||||
characters have the news-passing abilities of a gossip, but we use `gossip`
|
||||
to mean a special character who is part of the news-passing network."
|
||||
(:require [cc.journeyman.the-great-game.gossip.gossip :refer [dialogue]]
|
||||
[cc.journeyman.the-great-game.agent.agent :refer [Agent]]))
|
||||
|
||||
|
|
@ -36,6 +36,8 @@
|
|||
[cc.journeyman.the-great-game.utils :refer [inc-or-one truthy?]]
|
||||
[taoensso.timbre :as l]))
|
||||
|
||||
(declare interesting-location?)
|
||||
|
||||
(def 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
|
||||
|
@ -116,7 +118,7 @@
|
|||
:war {:verb :war :keys [:actor :other :location]
|
||||
:inferences [{:verb :war :actor :other :other :actor}]}})
|
||||
|
||||
(def all-known-verbs
|
||||
(def all-known-verbs
|
||||
"All verbs currently known to the gossip system."
|
||||
(set (keys news-topics)))
|
||||
|
||||
|
@ -131,7 +133,9 @@
|
|||
;; TODO: we ought also check the relationships of the gossip.
|
||||
;; Are relationships just propositions in the knowledge base?
|
||||
(filter #(= (:actor %) character) (:knowledge gossip))
|
||||
(filter #(= (:other %) character) (:knowledge gossip)))))
|
||||
(filter #(= (:other %) character) (:knowledge gossip))
|
||||
(when (interesting-location? gossip (:home character))
|
||||
(list true)))))
|
||||
|
||||
(defn interesting-character?
|
||||
"Boolean representation of whether this `character` is interesting to this
|
||||
|
@ -180,19 +184,13 @@
|
|||
;; TODO: Not yet (really) implemented
|
||||
true)
|
||||
|
||||
(defn interesting-topic?
|
||||
[gossip topic]
|
||||
;; TODO: Not yet (really) implemented
|
||||
true)
|
||||
|
||||
(defn interesting-verb?
|
||||
"Is this `verb` interesting to this `gossip`?"
|
||||
[gossip verb]
|
||||
(let [vs (:interesting-verbs gossip)]
|
||||
(truthy?
|
||||
(if (set? vs)
|
||||
(vs verb)
|
||||
false))))
|
||||
(when (set? vs)
|
||||
(vs verb)))))
|
||||
|
||||
;; (interesting-verb? {:interesting-verbs #{:kill :sell}} :sell)
|
||||
|
||||
|
@ -249,8 +247,7 @@
|
|||
(interesting-character? gossip (:actor item))
|
||||
(interesting-character? gossip (:other item))
|
||||
(interesting-location? gossip (:location item))
|
||||
(interesting-object? gossip (:object item))
|
||||
(interesting-topic? gossip (:verb item)))))
|
||||
(interesting-object? gossip (:object item)))))
|
||||
|
||||
(defn infer
|
||||
"Infer a new knowledge item from this `item`, following this `rule`."
|
||||
|
@ -273,9 +270,9 @@
|
|||
`item`."
|
||||
[item]
|
||||
(set
|
||||
(map
|
||||
#(infer item %)
|
||||
(:inferences (news-topics (:verb item))))))
|
||||
(map
|
||||
#(infer item %)
|
||||
(:inferences (news-topics (:verb item))))))
|
||||
|
||||
(defn degrade-character
|
||||
"Return a character specification like this `character`, but comprising
|
||||
|
@ -330,8 +327,8 @@
|
|||
:knowledge
|
||||
(set
|
||||
(cons
|
||||
item'
|
||||
(:knowledge gossip))))]
|
||||
item'
|
||||
(:knowledge gossip))))]
|
||||
(if follow-inferences?
|
||||
(assoc
|
||||
g
|
||||
|
|
Loading…
Reference in a new issue