Resource Modeling in Strategic Primer

As I wait for the players of the current campaign of Strategic Primer to finish their strategies for the current turn, I’ve spent some time adding support for resources and equipment in the map to the map viewer. Today I’d like to briefly discuss how the map represents these things, what this means for players, and how I’d like to further improve this support in the future.


When I say that I “added support for resources,” I mean that units and fortresses can now contain resources and equipment. Anyone who has been following the development of this suite of “assistive programs” knows that the map format has been able to represent, and the map viewer has been able to show, various kinds of natural resources for a few years now. But that’s only a rudimentary capability, for three reasons:

  • While the kinds of resources that the map could represent were varied, the expressiveness was limited by the fact that adding a new kind of resource meant adding a new tag to the map format and adding code to the map viewer to read that tag and to represent the new kind of resource.
  • The vocabulary available for describing a given resource, once I pinned down what it was (its “type” and “kind”), was limited. I could say whether a mineral deposit was exposed, for instance, but not how much of the mineral there was in the vein. I wrote a program to generate that information in a separate format several months ago, but I wanted something that would represent a definite quantity of some resource, and not in a separate program.
  • Related to that second point, the existing map concepts represented resource sources, in the world: mineral veins, stone deposits, crop fields, timber groves, and so on. There was no way of representing harvested resources, such as a player’s granary or wood stockpile, let alone resources in transit.

If I felt I had to solve those problems without extending the map format (for instance, if I felt that I had to ensure that old versions of the programs didn’t crash or report failure if they tried to read new map files), I could have hacked together something using the existing support for caches, which know their “kind” and “contents.” But fortunately, this is a feature that will only break old versions of the program once I add resource data to map files, and that will (I expect) take long enough that players will probably have upgraded for other reasons (or just on general principle) before this comes up. (And old versions going back to 2012 at the latest will ignore resources, though not equipment, instead of crashing anyway.)


What I’ve implemented so far is very rudimentary, but addresses each of the requirements listed above. A resource in the map has the following data associated with it:

  • Its general “kind” (e.g. grain)
  • Its more specific “contents” (e.g. wheat)
  • What unit its quantity is measured in (e.g. bushels)
  • What quantity of the resource, in that unit, is present in the “resource pile.”

A piece of equipment, known in the map as an implement, is much simpler, with (at the moment) only its “kind” being stored.

Like essentially everything else that a map can contain, resource piles and equipment can also be represented by a custom icon (though I don’t yet have a default icon for either of them).

Unlike mineral veins, groves, and so on, resource piles and equipment implements cannot (in the map format) appear in the map (on a tile) directly. Instead, they are held by a unit or fortress.


Including resource quantities in the map is the next step forward, after adding workers as unit members, toward making maps and operations on them the primary form of communication about the game. In the end, I’d like to be able to see a map (or a changeset derived from one to be applied to another) as the spatially-oriented representation of a strategy or of the player’s results, and the player’s strategy or results document as the linear representation of the strategy or results encoded in the map. We’re a long way from that goal, but this is an important step.

Depending on how long it takes for the players to finish their strategies and how much time I have to spare to the task, I may get the data about the players’ resources into the map before I send them their results, or I may have to send updated known-world maps with the new information as an update after I return the results. This information will also eventually make it into the reports generated from the players’ maps using the report-generator program, but that will be even later.

Players’ maps will include information about their own resources and, eventually, equipment, but not about other players’. (In fact, while players’ known-world maps may contain some “sensitive details” about other players, independent towns, and unclaimed features, any future additions will have such details “zeroed out” automatically.)

Future Work

While current versions of the assistive programs won’t crash on maps containing the new information, and even better won’t lose it when writing a changed map back to disk, they don’t do much with information about resources or equipment yet. I hope to add features interacting with resources and equipment fairly soon, but there are some more urgent development priorities.

Still, here’s my current thoughts as to features related to resources and equipment to add:

  • Support for them in the report generator
  • Adding and editing them from the map viewer. (This may be implemented first, as it would make my task of adding the data to the map far easier.)
  • Some way of getting a resource summary, grouping like resources and converting units to get totals.
  • Support for knowledge of some sort (one obvious candidate being density) about specific resources, probably loaded from files that could be included with the assistive programs.
  • Some way of doing mass and automatic conversion of resources (such as updating the age of food at the end of each turn)
  • Resource consumption (starting with food)

Those last two may have to wait for changesets … yet another point toward the urgency and importance of that constellation of features.

If you have any ideas for features related to this framework that I should add, or any other thoughts, please let me know.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.