Procedural Generation in Strategic Primer

Ever since I first read about procedural content generation—the technique of creating (or at least “generating”) “content” (models, textures, sounds, environments, etc.) when the game or application is run rather than creating them in development and then just bundling them with the software—I’ve wanted to use it at some point. And in my development of the map viewer for Strategic Primer, I’ve finally come to a point where I not only can, but also have to use this unfamiliar technique.

Many of the most obvious recent changes to the Strategic Primer map viewer, and to the campaign as a whole, have been driven by a desire to increase the resolution and detail of the map. Unfortunately, this has led to dramatic increases in the size of the map files (the map was less than four hundred kilobytes in size as of the first turn, and after the resolution increase before the current turn it’s nearly thirty megabytes), and significant performance problems.

To alleviate the performance issues yet improve the information available to the players (and to me), I decided to reduce the resolution of the main map by half (the increase had been four-fold), but add sub-maps for each tile. Unfortunately, if each tile’s sub-map is actually stored, this increases the size of the map to several hundred megabytes, and (because sub-maps are loaded with the main map) doesn’t help the performance problems.

So, to let me avoid both sets of problems associated with these expansions of available data without reducing the information available to me or the players, I’ve decided to procedurally generate sub-maps at run-time when they haven’t been loaded from file, and only store them if they differ from what would be generated the next time.

To get this to work I’ve already had to go to great lengths to change the ID numbers of about a quarter of the “fixtures” in the map (figuring out which ones to change took at least a dozen hours or so, perhaps days, and applying the change to the main map and to all the players’ maps took several days, running mostly in the background). I need to actually write the code to dynamically generate sub-maps, to determine whether a given sub-map needs to be written to file, and so on, and there are a few wrinkles in the design that I need to iron out yet (mostly relating to rivers and the aquatic flora and fauna that should inhabit them), but for the most part I think I know what I’m doing.

Any comments or questions about these plans, or procedural generation in general?

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s