Tutorial:Pooled Resources

From Total War Modding

Originally created by Vandy.

This here tutorial is going to go over the basics of a Pooled Resource, why they’re awesome, and how to use them to their fullest potential. I’m going to try and not pigeon-hole readers into a specific usage of pooled resources, but I will try at all points to cover all realistic paths to go down, and all functionality that pooled resources have. Do note this tutorial will focus specifically on Warhammer II, though I may go back and add in a 3K section, or make a second tutorial.

Alright! A pooled resource is a type of game object that’s becoming more prevalent in Total War – being first introduced throughout Total War Warhammer II’s development (to my knowledge), and becoming increasingly important in Three Kingdoms where it powers many systems like population and food supplies.

A pooled resource is pretty basic, conceptually – it’s a custom resource (of whatever make or model) that is contained within a pool. In Warhammer II, pooled resource pools can only be linked to a faction, but in 3K the functionality was expanded dramatically and they can be linked to regions, armies, and more. Whatever game object “has” the pool, “has” the resource.

Infamy, the Vampire Coast's Pooled Resource, in-game

As mentioned, pooled resources have been used to create population systems, food. In WH2, it is used for many various odd currencies that some factions have – like Infamy, Skaven food, Imperial Authority, Blood Kisses. In my own usage, I’ve created pooled resources and have made them stand for a gromril resource for the Dwarfs, and I’ve used it for both the “stored lives” mechanic and the “Necromantic Power” mechanic in Return of the Lichemaster.

The massive Skaven Pooled Resource tooltip – Food!

The uses of pooled resources are far, in big part due to how absolutely versatile and moddable they are. They can stand for basically any numerical data you want on the campaign – the only limitation being their intrinsic link to factions, rather than other game objects like armies or characters or regions.

Initial Setup

At this point, I’m assuming one of two things – you either know what you want to make and need technical direction, or don’t have any ideas about design and just want to learn the functionality so you can make some designs.

The PR (pooled resource) game object is defined in, kinda obviously, the pooled_resources table. Most of the stuff there is super obvious – keys, localisation, an icon, min/max, and whether or not AI actually thinks about it.

As well, there’s a “default_factor” and a boolean for “persistent_factors”. Which, I guess is a good segue into an important bit of data for pooled resources.

Every pooled resource has at least one “factor”. A factor is just a way to define a source of income/expenditure for each individual pooled resource. A factor, for instance, could be “Battles” or “Buildings”, and you would then link effects or use script commands referencing that factor. It’s a way to inform the player where these +/- values are coming from, and a nice way to keep track of things from the modder side as well.

VERY IMPORTANT TO REALIZE. If you have “persistent_factors” set to false, an effect bundle lasting 5 turns that give +5 PR of a specific factor will give 25 total, 5 each turn. If you have “persistent_factors” set to true, an effect bundle doing the same will give +5 total for 5 turns, and then the PR will drop down by 5 on the sixth turn, as the source of the +5 is gone.

Most PRs should be set up as not-persistent, unless there’s a specific design in mind that requires persistent factors. If a source of a factor goes away, the +value goes away with persistence set. This is very important to realize, I can’t stress that enough.

I recommend creating custom pooled_resource_factors for further control over your own work, but there’s nothing stopping you from using vanilla factors that are used for other PR’s, they won’t overlap at all.

Following the creation of factors, they get linked to a PR in pooled_resource_factor_junctions. Make sure the unique ID used makes sense and is memorable, it’s used in a handful of other spots as we go around.

At this point, it makes sense to give the PR to an actual faction, so let’s do that. The only thing needed is a campaign_group, a linked campaign_group_member, a link between the member and your desired _faction or _subculture or _culture member criteria, and a link between the campaign group and the PR in campaign_group_pooled_resources. This tells the game to allow this faction/group of factions access to the pooled resource, and on game creation, sets the PR to the set initial_amount specified in this table.