I want a pixel art video game with a simulated economy set in ancient Canaan, featuring quests and story lines based on the lore of the Canaanite pantheon (which is primarily attested in the Ugaritic texts). I'm going to share some development progress here. Partly I think this will keep me organized. Partly, I'm worried that I won't every finish it, but at least this way people can see some of what almost was.
One of the first things I did was come up with a Canaanite video game ontology, i.e. a sorted list of things I might want in the video game that are probably all historically appropriate, I'm not sure, I'm not a historian. Here it is:
: Canaanite Video Game Ontology
* domestic animal: ox, horse, goat, sheep, cow, sheep, camel, rock dove.
* wild animal: lion, wild dog, crocodile, snake, lizard, deer, gazelle.
* wild insect: ant, beetle, bee, fly, wasp, butterfly, dragonfly.
* wild bird: eagle, vulture, falcon, goose, duck, pigeon, sparrow, bulbul, bunting, grebe, gull, heron, kite, lark, owl, pipit, sandpiper, serin, shrike, sparrow, swift, vulture, warbler, wheatear.
* wild fish: sea bream, grouper, mullet, perch, sea bass, tilapia, string ray, shark, shrimp.
* plant: grass, seaweed, wheat plant, reed, barley plant, flax plant, fig tree, grape vine, olive tree, almond tree, date palm tree, pomegranate tree, oak tree, cedar tree, pine tree, sycamore tree.
* character class: god, king, servant, handmaid, merchant, beggar, child, farmer, bee keeper, fisherman, herdsman, pigeon fancier, butcher, sheep shearer, spinner, weaver, scutcher, brick mason, stone mason, brick maker, carpenter, potter, miner, smelter, copper smith, flint knapper, shipwright, fletcher, miller, baker, vintner, candler, sailor, guard, soldier, wet nurse.
* food: honey, pigeon meat, fish meat, fish roe, goat meat, cow meat, goat milk, cow milk, barley, wheat berry, millet seed, flour, bread, fava bean, chickpea, pea, lentil, almond, flax seed, date, fig, olive, olive oil, grape, grape juice, wine, pomegranate, drinking water, salt.
* textile: string, rope, linen fiber, linen cloth, wool yarn, wool cloth, animal skin, leather, fur.
* tool: adze, mattock, scythe, pick, billhook, flint blade, sickle, spear, oar, paddle, net, sharpened stick, club, bronze axe, bronze sword, bronze dagger, bow, arrow, shield, helmet, walking stick, crook.
* furniture: wicker chair, wicker table, oven, fireplace, door, gate, fence.
* furnishing: waterskin, candle, linen sack, linen blanket, bronze platter, reed mat, wool blanket, woven basket, clay amphora, clay jar, clay pot, clay cup, clay vase, stone plate, stone bowl, clay plate, clay bowl, stone pot, incense, lyre, horn, flute, drum, flint knife, shell spoon, bone spoon, brass spoon, wood spoon.
* valuable: silver piece, ruby, emerald, sapphire, diamond, carnelian, agate, bronze ring, bronze earring, bronze bead, bronze necklace, bronze bracelet, bronze hair pin, bronze collar, silver ring, silver earring, silver bead, silver necklace, silver bracelet, silver hair pin, silver collar, gold ring, gold earring, gold bead, gold necklace, gold bracelet, gold hair pin, gold collar.
* clothing: linen dress, linen robe, linen tunic, linen cloak, wool dress, wool robe, wool tunic, wool cloak, linen shawl, wool kilt, headband, arm band, hat, turban, hair tie.
* vehicle: boat, ship, cart, chariot.
* raw material: water, beeswax, clay, copper, tin, bronze, dung, flax fiber, papyrus, reed, wood, ivory, brick, silver, gold, malachite, chalcopyrite, cassiterite, emery.
* map region: palace, garden, lodge, house, stream, temple, country, field, lake, large rock, mine, city, hill, plain, shrine, marsh, village, river, tomb, dovecote, mountain, market, dock, sacred grove, grotto, waterfall, cliff, cave.
* human activity: sleeping, bathing, eating, drinking, working, farming, hoeing, weeding, harvesting, sowing, rowing, celebrating, binding flax, mining, collecting reeds, collecting dung, cleaning, cooking, washing laundry, childcare, praying, singing, dancing, selling goods, cutting wood, making bricks, building, guarding, butchering, making wine, bronze working, making a religious offering, harvesting fruit, harvesting grain, harvesting legumes, talking, walking, running, fishing, counting money, thinking, begging, haggling, cutting wood, smelting tin, hammering bronze, making candles, tending livestock, firing bricks, laying bricks, grinding flour, shearing sheep, spinning yarn, weaving fabric, fetching water, boiling water, cooking meat, throwing clay, firing clay.
Nice. Next, here is my initial pixel art:
These thigns don't look good in isolation, don't look good together, and the objects certainly don't look good superimprosed over the terrain, but they show the vibe I'm going for. I think the brick walls need to be replaced entirely, but most of the rest of it just needs heavy clean up.
I started by cleaning up the terrain tiles. That got me a three material dual grid tileset (water, grass, sand/stone):
These are 16x16 tiles, and they're offset from by half a tile from the world map as the players see it, because there are only 3^4 = 81 distinct corners where materials meet, whereas there are 3^8 = 6561 neighbors for a tile in three materials, and I didn't want to draw a different central tile for each of those options. In short, by drawing the corners instead of the centers, you can draw many fewer tiles. This is called a dual grid system.
Levels generated with that dual grid tileset let me test my path finding algorithms, but they felt very flat, so I started working on a mountainous tileset. Actually, I started with rivers and a waterfall, and it didn't look right with the land tiles that I already had - they didn't seem adequate to surround a waterfall in a natural looking way. So I drew a lot of terraced land spaces trying to figure out what looked right.
I don't have my mountain tiles organized very well; I think some of these might need to be offset by half a tile in one or both directions for consistency, but first I'm just trying to cut down duplicate tiles to see what I've got.
Eventually I want tiles for a biome progression like:
[sea and shore → town → fields and forest and desert → mountains and waterfalls → caves and mines]
I also want a lot of sprites for crops, but I might just have a few generic crop sprites, and you'll have to look in the textual user interface to tell if a grain growing on a square is barley or wheat or millet.
Let's talk a little about NPC activities.
I originally wrote a scheduling function that put all the NPCs on a 24 hour schedule like [sleep, bathe, eat breakfast, walk to work, work, eat lunch, work, walk home, eat supper, relax, sleep]. They were all offset from each other by different wake times, but otherwise they had identical schedules. Then I wrote a path planning algorithm, and instead of just automatically telling an NPC to dp a verb at a given time, it made sense for them to e.g. only work once they finished walking to their own work area. Preconditions for verbs. Nice.
I also wrote verbs for different tasks. These took the form of economic production functions, describing what a person could produce in a work day, given different inputs - tools, time worked, material inputs that are consumed in production, material inputs like land that aren't consumed in production.
For example, a hunter could produce certain amounts of [meat, hide, bone, sinew, horn, and antler] in a given day, with a certain amount of inherent randomness, and different gains to these products based on whether they possess, for example, a [javelin, bow and arrow, knife, or snare trap]. Fun side note: my code estimates/calculates the amount of hide obtained from an animal by assuming a spherical cow of unit density (1 gm/cm^3).
For most jobs, you do a specific verb for a few hours a day, and once your time card tally says you've done 8 hours of work, then the production functions is called and drops some items into your inventory.
My production functions for farmers are much more involved and I'm not done writing them. The basic calculation for different crops is just
total yield = yield per hectare * workable area
with workable area depending on whether you have a family and/or a draught animal, but then you also have a smaller net yield for many crops that is found by subtracting off how much of the crop is saved for planting seed, i.e.
planting seeds saved = planting rate * workable area
net yield = total yield - planting seeds saved
I'm also planning to model seasonality of work that's done on different crops (when you plant, when you weed, when you harvest) based on what you farm, with the work differing by season for every crop, but with work functions being broadly divisible into categories of: grain, legumes, or fruit. Fruit farmers will also mostly be goat farmers, which I think is realistic.
Farmers don't get a portion of crops in their inventory every 8 hours - they harvest once a year and either sell their crop throughout the year at market, or maybe they sell to a food merchant who sells the crop at market and then the farmer doesn't have to spend time in the market. So when the game starts, it models last years harvest and how much the farmer has probably sold up to the current date to figure out their inventory.
Here's a thing I made when working on crop seasonality code that I wouldn't want to lose. Maybe you'll have a use for it also:
date_ranges = {
"January": [1, 31],
"February": [32, 59],
"March": [60, 90],
"April": [91, 120],
"May": [121, 151],
"June": [152, 181],
"July": [182, 212],
"August": [213, 243],
"September": [244, 273],
"October": [274, 304],
"November": [305, 334],
"December": [335, 365],
}
When a player or NPC does a verb, I want there to be some visual indication of the fact, even if you can't e.g. see their fingers weaving reeds into mats. So I've been working on animations for bending over and moving hands.
At some point I might also have sleeping animations or animations for moving hands while sitting at a chair.
Let's talk about simulating the economy. I think at some point I'm going to change the NPC scheduling function so that everyone goes to market for a while each day, both to buy and sell. A person walks around, inquires about prices from the people they bump into, and then makes some purchases. The market will have booths for a realistic appearance, but the selling and buying will probably happen virtually following this bump-encounter price-sharing.
I don't know much economics and I'm sure I will have to do a lot of debugging to get an economy that is both somewhat stable and somewhat realistic.
For this time period, a daily wage for most labor was 0.07 to 0.10 troy ounces of hacksilver, which is 2.07 to 3.11 grams. I'd be really pleased if I got my economy to reproduce a typical wage like that, but I'm also just considering enforcing that wage and seeing what happens to the rest of the economy as a consequence, or enforcing it for a few physically demanding jobs.
Sellers are going to set one price for each good that they sell in a day. There will be no daily haggling, and no adjusting of prices when a seller sees other sellers' prices that day (though maybe they can base today's price on prices seen yesterday).
Sellers are going to try to maximize profit, in the sense of
profit = items sold * price per item
or
profit = quantity sold * unit price for quantity
I don't think the sellers need to include [cost of production] in their profit calculations. Like, that does influence the final number, but it doesn't influence the optimization problem, right? The right price to maximize [price weighted number of sales] doesn't depend on whether you go into debt afterward because the cost of production was too high. But I don't know much econ. Maybe I'm wrong and my Canaanite economy won't work without that term in the mental calculus of the merchants. We'll see.
Whether an item is net profitable for a seller after the cost of production is still important of course - it influences whether you decide to keep producing that particular thing at all, and more broadly whether you decide to keep or change your profession. I might include a mechanism for NPCs to change their jobs like this. I've also considered that if an NPC goes too long without food, they could, um, reincarnate as a new healthy NPC with a randomly chosen job. This way I wouldn't have to model everyone choosing the optimal job given their expectations about the economy, but the economy would still move toward a workforce that was doing profitable things, in case fig farming or linen scutching turns out to not be in such high demand in my virtual world. Also I don't have to worry about everyone switching to fig farming if that suddenly looks like a very profitable career. Reincarnation with random jobs hopefully means that there is both job diversity and individual wealth (due to non-wealthy generating jobs being replaced after a few days), without everyone having to calculate Hamilton–Jacobi–Bellman equations or POMDPs or other life-history optimal decision process math.
Like in real life, sellers won't have access to demand functions (either demand functions for individual purchasers or aggregate market demand functions) for use in setting their prices to maximize profit. They'll just do little experiments from day to day and see how their profit changes as a consequence.
For there to be a market for expensive non-consumable goods, like houses and boats, I think the purchasers will have to periodically have a need to replace them, i.e. the items need to wear out or break or maybe get lost sometimes - otherwise the boat makers would makes a boat for everyone and then no one would ever need a boat again unless the population increased. So I'll probably end up putting an age or usage counter on lots of material artifacts in the game, and I'll cause items to break based on age or usage, simply so that there can be a realistic economy on durable goods.
So that's a sketch of how sellers do things. How do the NPCs choose what to buy? This sounds a lot harder to model. I said before that the sellers don't have access to demand functions of the market, for the sake of realism. Also for realism, the NPCs don't have demand functions at all, full stop, regardless of access. I just don't think demand functions are good models of economic choice. If you think otherwise, please show me your demand function for apples or window panes or '95 ford crown victorias.
So I'm not writing demand functions for NPCs. What else can we do? We could say that NPCs have daily needs for calories, and they have finite budgets, and maybe finite storage, and they try to minimize days when they go hungry over some small time horizon? I think this would produce a really weird market that cared mainly for producing the food with the cheapest-to-produce calories, and then cared about producing tools used in producing that food, and then cared about inputs to the production of those tools if any. But it's not going to create a rich human world where people cook for their families and rest on their funiture and play musical instruments and wear colorful clothes or precious stone jewelry or burn incense or bring wine to a festival or other acts of human flourishing that are aided by material goods.
Here's a slight increase in the mental complexity of the NPCs that can support a much richer economy: an NPC wants to buy something they don't have. People who aren't starving will have some discretionary funds, and use this to buy a trinket randomly.
In the long run, I think this results in all the impulse purchases having the same price (unless that price isn't enough to offset the cost of production, and then the profession that makes the impulse item disappears from the market (unless the impulse item is a byproduct of labour that the market directly values - like maybe there's a market for sinew because there's a market for meat, even though a hunter couldn't live by only selling sinew)). I'll say that again: I expect that impulse purchases will all have the same price eventually roughly or disappear from the market. And in this economy, there still won't be any purchases of things that are more expensive than the normal discresionary fund value.
So that's a slight improvement, but only slight. Let's make the NPCs a little more mentally complex to improve the maket realism more.
Suppose that people make somewhat strategic purchases for their professions. A wine maker buys grapes from the grape farmer and maybe ?(buys yeast from a miller or a brewer)? and buys amphorae from the potter. Then in addition to grape farmers being supported by food purchasers and impulse buyers, they're also supported by the occasional reincarnation of a person into a wine maker.
Let me say that again. Wine makers exist and try to maximize personal profits by doing their jobs. This supports other jobs. Hopefully the economy is productive enough that NPCs can support each other in making nice things, instead of everyone starving because they're not making food - the main things that the market necessarily values - and so gradually everyone reincarnates into an X that reincarnates into a Y, and the cycle of rebirth always ends in you being a barley farmer or a barley farmer tool supplier.
I'm not sure that this is enough purchaser preference to act as the foundation for a world that looks human, but it's a start. I'm also not sure how complicated I should make the mental calculation for the NPCs trying to maximize profit within their profession by purchasing instrumental goods.
I could also tie food purchasing into instrumental preference - people work better when fed, so profit maximizing is a reason to buy food. But I absolutely refuse to do that. That's a move away from humanity. If anything, I should add more preferences for direct social and sensory experience - preference for food variety, preference for caring for people and pets, preference for making beautiful things, et cetera. And then instead of just trying to buy one of every cheap thing in the market, people would save up to buy a piece of pretty jewelry or a food they'd never tried before or a nice collar for their dog, who is a good girl. I'm not sure if I can code all that up, but it would be nice.
I already mentioned that for there to be a market in durable goods, I think that durable goods have to become useless at some point - e.g. worn away, broken down, or maybe lost. I'd like for NPCs to model this a little bit - they have an expectation of when a thing they own will break and save up in advance to replace it. Alternatively, they just don't think about it till it breaks, and if it's useful for their job, then they stop making random impulse purchases until they've saved up enough to clear their shopping list of profession-specific capital.
So I'm not sure how much NPCs should think about purchases in order to maximize personal producitivty, but maybe just having to clear your shopping lists before doing impulse purchases is enough. I guess we have 1) a home grocery list, and 2) a shopping list for materials consumed in production at their job, and 3) a shopping list for job tools, and then I have to figure out how a player makes purchases with those lists looming over their head.
...
Okay, so now you have some idea of how little I know about economics. Hopefully I haven't embarrased myself too much. Let's switch to talking about the Canaanite Pantheon.
Gods will have their own abodes. Towns and divine abodes will have fixed map designs, and the wilderness between them will be procedurally generated. Maybe there will be some other landmarks with fixed map designs as well. Travelling through the wilderness might be taxing. Like you need to store up resources before going on a trip and you use up your food while you walk or sail. Or maybe there are theives or wild animals that attack you. I'm not sure. I don't want to discourage exploration too much, but I do want some challenge.
When you find a god after a journey through the wilderness, they'll give you a quest. I might also let each town have a shrine to a god, and the god can act through the shrine in some way. But when you find a god, they have a quest for you. And gods have quests for every economic specialty, and they'll give you a specific quest for a specialty that you possess.
Here are some gods and some of their quests.
...
Gods also sometimes cause miracles in the world. Here are some of the miracles for different gods.
...
Gods also sometimes have conflicting goals about the state of the world. Here are some events showing the contrary interplay of miracles.
...
Gods also sometimes cooperate about the state of the world. Here are some events showing cooperative interplay of miracles.
...
Summary: In this game, you can do jobs in the Canaanite economy, and hopefully some of those will be fun, like a farm or fishing simulator. You can acquire resources doing these jobs to go on journeys. On journeys, youc an meet gods, who will give you quests. You might learn a little bit about the personality of the gods this way. You'll learn what they can influence and who their enemeis and allies are at least. And maybe the status quo of the gods will change throughout the game, and you'll live through the whole Baal cycle or something, I don't know. That feels harder to tell without narration, but it might be doable.
No comments:
Post a Comment