Skip to content

Commit

Permalink
5-way Faction Trade Scenario!
Browse files Browse the repository at this point in the history
(miners, hi-tech farmer, lower-tech farmer, pure big refinery, boutique mining/refining op)

refactor: Asset Transforms is now a list[map[...]] instead of map[asset, map[...]]; added a key for comments
refactor: Reworked testmaps for factions - maps are now tiny and can be done additively (need to split it to map per spawner)
feature: New faction definitions (FoodCo - small but techy food producer; Hephaestus - does both mining and refinement, but only small-scale)
feature: New Consideration - can we fulfill the Contract? Should reduce Actions wasted on retrying fulfillment attempts
balance: Fast Buy offers only happen some of the time (random, weighted by need being very low)
balance: Better values on Asset Transforms & CommodityDB for a more dynamic economy
  • Loading branch information
jmalek committed Oct 20, 2024
1 parent fd44f48 commit 611c040
Show file tree
Hide file tree
Showing 17 changed files with 352 additions and 90 deletions.
Binary file modified GOAI/GOAI.dmb
Binary file not shown.
1 change: 1 addition & 0 deletions GOAI/GOAI.dme
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
#include "integrations\utility_agent\senses\vision.dm"
#include "integrations\utility_agent\systems\movement_system.dm"
#include "maps\trademap3fac_chain.dmm"
#include "maps\trademap_multifac1.dmm"
#include "utility\actions.dm"
#include "utility\actionset.dm"
#include "utility\actiontemplate.dm"
Expand Down
18 changes: 12 additions & 6 deletions GOAI/_datastructures/registries/economy/assets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,22 @@ var/global/production_subsystem_last_update_time = null
curr_simulation_time += PRODUCTIONSYSTEM_TICKSIZE_DSECONDS

to_world_log("= PRODUCTION/CONSUMPTION SYSTEM: PROCESSING [faction.name] - simulation tick... =")
var/asset_idx = 0

for(var/productive_asset_key in prodconsume_db)
// Go through all Things Wot Use/Produce Resources...
if(isnull(productive_asset_key))
for(var/list/asset_deltas in prodconsume_db)
// Go through all Resource 'recipes' and check how much they use/produce stuff...
asset_idx++

if(!asset_deltas)
// junk entry somehow
continue

// ...check how much they use/produce stuff...
var/list/asset_deltas = prodconsume_db[productive_asset_key]
// What asset gives rise to this recipe?
var/productive_asset_key = asset_deltas["source_asset"]

if(!asset_deltas)
if(isnull(productive_asset_key))
// Required field
to_world_log("ERROR: asset [asset_idx] in prodconsume_db has no required key 'source_asset' - SKIPPING")
continue

var/owned_amt = faction_assets[productive_asset_key]
Expand Down
2 changes: 1 addition & 1 deletion GOAI/goai_data/commodity_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"prestige": 2
},
"/obj/ore": {
"ore": 0.05
"ore": 0.01
},
"/obj/steel_bar": {
"steel": 1
Expand Down
63 changes: 38 additions & 25 deletions GOAI/goai_data/economy_asset_transforms.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"hungry_workers": {
[
{
"//": "Workers are 'regenerated' to usable state by using up food.",
"source_asset": "hungry_workers",
"consumes": {
"hungry_workers": 1,
"/obj/food": 1
Expand All @@ -9,62 +11,73 @@
}
},

"planetary_farmland_upgraded": {
{
"//": "Having steel and the know-how to apply it improves farm yields at scale.",
"source_asset": "farm_upgrade_tech",
"consumes": {
"workers": 10,
"planetary_farmland": 1,
"farm_upgrade_tech": 1,
"/obj/steel_bar": 0.01
"/obj/steel_bar": 1
},
"produces": {
"hungry_workers": 10,
"planetary_farmland_downgrader": 1,
"farm_upgrade_tech": 1,
"/obj/food": 100
"planetary_farmland_upgraded": 1
}
},

"planetary_farmland": {
{
"//": "Basic food production asset.",
"source_asset": "planetary_farmland",
"consumes": {
"workers": 10
"workers": 1
},
"produces": {
"hungry_workers": 10,
"/obj/food": 20
"hungry_workers": 1,
"/obj/food": 3
}
},

"planetary_farmland_downgrader": {
{
"//": "Upgraded food production asset.",
"source_asset": "planetary_farmland_upgraded",
"consumes": {
"planetary_farmland_downgrader": 1
"planetary_farmland_upgraded": 1,
"workers": 1
},
"produces": {
"planetary_farmland": 1
"hungry_workers": 1,
"planetary_farmland": 1,
"/obj/food": 10
}
},

"industrial_furnace": {
{
"//": "Basic steel production asset; requires fairly high volumes.",
"source_asset": "industrial_furnace",
"consumes": {
"workers": 100,
"/obj/ore": 10
"/obj/ore": 1000
},
"produces": {
"hungry_workers": 100,
"/obj/steel_bar": 1
"/obj/steel_bar": 20

}
},

"mining_outpost": {
{
"//": "Basic ore production asset.",
"source_asset": "mining_outpost",
"consumes": {
"workers": 10
"workers": 50
},
"produces": {
"hungry_workers": 10,
"hungry_workers": 50,
"/obj/ore": 100
}
},

"workers": {
{
"//": "Unassigned workers still get hungry.",
"source_asset": "workers",
"consumes": {
"workers": 2
},
Expand All @@ -73,4 +86,4 @@
"hungry_workers": 1
}
}
}
]
13 changes: 7 additions & 6 deletions GOAI/goai_data/faction_definitions/FarmVille.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"name": "FarmVille",
"tags": [
"FarmVille"
"agricultural"
],
"relationships": {
"ORMA": 50
"agricultural": 50,
"metallurgy": 50
},
"actionset_files": [
"faction_base.json",
"faction_trade_test.json"
],
"needs": {
"food_generic": 100,
"wealth": 4000,
"wealth": 2000,
"prestige": 50,
"ore": 100,
"steel": 5
Expand All @@ -31,10 +32,10 @@
"steel": "/obj/steel_bar"
},
"assets": {
"wealth": 3000,
"wealth": 2000,
"planetary_farmland": 100,
"farm_upgrade_tech": 50,
"workers": 2000,
"farm_upgrade_tech": 20,
"workers": 2500,
"/obj/food": 10000,
"/obj/steel_bar": 10,
"/obj/ore": 50
Expand Down
44 changes: 44 additions & 0 deletions GOAI/goai_data/faction_definitions/FoodCo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "FoodCo",
"tags": [
"corporate",
"agricultural"
],
"relationships": {
"agricultural": 50,
"metallurgy": 50
},
"actionset_files": [
"faction_base.json",
"faction_trade_test.json"
],
"needs": {
"food_generic": 100,
"wealth": 2000,
"prestige": 50,
"ore": 100,
"steel": 5
},
"need_weights": {
"food_generic": 5,
"wealth": 4,
"prestige": 1,
"ore": 0.1,
"steel": 2
},
"preferred_trades": {
"food_generic": "/obj/food",
"prestige": "/obj/decor",
"ore": "/obj/ore",
"steel": "/obj/steel_bar"
},
"assets": {
"wealth": 4000,
"planetary_farmland": 100,
"farm_upgrade_tech": 100,
"workers": 1500,
"/obj/food": 6000,
"/obj/steel_bar": 10,
"/obj/ore": 50
}
}
2 changes: 1 addition & 1 deletion GOAI/goai_data/faction_definitions/FreeTrade.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"wealth": 8000,
"planetary_farmland": 100,
"industrial_furnace": 10,
"workers": 3000,
"workers": 3500,
"/obj/food": 10000,
"/obj/ore": 5,
"/obj/steel_bar": 80
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"name": "FreeTrade",
"tags": [
"FreeTrade"
"corporate",
"metallurgy"
],
"relationships": {
"ORMA": 50,
"FarmVille": 50
"corporate": 50,
"agricultural": 50,
"mining": 50,
"metallurgy": 50
},
"actionset_files": [
"faction_base.json",
Expand Down
45 changes: 45 additions & 0 deletions GOAI/goai_data/faction_definitions/HephaestusMFT2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "Hephaestus",
"tags": [
"corporate",
"mining",
"metallurgy"
],
"relationships": {
"agricultural": 50,
"mining": 50
},
"actionset_files": [
"faction_base.json",
"faction_trade_test.json"
],
"needs": {
"food_generic": 100,
"wealth": 3000,
"prestige": 50,
"ore": 5,
"steel": 80
},
"need_weights": {
"food_generic": 6,
"wealth": 5,
"prestige": 1,
"ore": 2,
"steel": 0.1
},
"preferred_trades": {
"food_generic": "/obj/food",
"prestige": "/obj/decor",
"ore": "/obj/ore",
"steel": "/obj/steel_bar"
},
"assets": {
"wealth": 3000,
"mining_outpost": 2,
"industrial_furnace": 1,
"workers": 300,
"/obj/food": 2000,
"/obj/ore": 500,
"/obj/steel_bar": 10
}
}
8 changes: 4 additions & 4 deletions GOAI/goai_data/faction_definitions/ORMA.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "ORMA",
"tags": [
"ORMA"
"mining"
],
"relationships": {
"FreeTrade": 50
"metallurgy": 50
},
"actionset_files": [
"faction_base.json",
Expand Down Expand Up @@ -33,8 +33,8 @@
"assets": {
"wealth": 5000,
"mining_outpost": 10,
"workers": 200,
"/obj/food": 400,
"workers": 1000,
"/obj/food": 1000,
"/obj/ore": 4000
}
}
Loading

0 comments on commit 611c040

Please sign in to comment.