1. Espiocracy
  2. News

Espiocracy News

Dev Diary #39 - AI Players 🤖

What's happening / TLDR: Developer diaries introduce details of Espiocracy - Cold War strategy game in which you play as an intelligence agency. You can catch up with the most important dev diary (The Vision) and find out more on Steam page.

---

Dev diaries of Espiocracy often explore the nature of (good) strategy games. The yearning for crafting own agency during gameplay, for the rocky marriage of immersion and strategic decisions, for interesting emergent simulation. It's time to wrestle another hallmark of the genre: challenges generated by other artificial players.

It's not a feature of all strategy games - colony managers and city builders pose the player mainly against the environment. Espiocracy harbors rich dose of such environmental challenges, as should be the case for the Cold War and beyond, to the point of implementing a kind of AI for the most important cogs (actors). However, the main challenge in this game stems from vigorous competition between players: hunting spies, stealing assets, ambushing operations, or even turning operatives against a player. This is further complicated by a game of information with covers, traps, bluffs, and the entire geopolitical poker. Artificial intelligence for THAT surely requires special approach.

Indeed, it does.

[h2]The Player[/h2]

To allow precise discussion, let's begin with a quick recap on the player persona. In Espiocracy, you play as an intelligence community (a set of intelligence agencies) of a single nation.



As the first dev diary proposed, a player here is the most resilient entity of the period, right in the fascinating middle between playing as an entire nation and playing as a small group of characters. For the player ecology, it means that the game harbors secondary (to international) layer of diplomacy: non-kinetic interactions between intelligence communities. Following DD#8 (to be refreshed and expanded in another dev diary), these include communication, alliances, deals, or partially controlling another player. This is further exacerbated by the fact that every player can try to get a foothold on the ground held by another player, in what can be described as a state of constant war. With this unusually competitive landscape in mind, let's jump straight into AI of such players.

[h2]Climbing the Shoulders of Giants[/h2]

Implementation of AI players in Espiocracy follows the principles of chess programming.

For 70 years, chess programmers have been writing engines that can competitively play chess, a game with tree complexity reaching 10 with 123 zeros. They have been working on outsmarting chess grandmasters for the entire Cold War and succeeded just a few years after its end, which is yet another topical and historical parallel that permeates development of Espiocracy.

This niche field generously offers many clever solutions that crave to be implemented in strategy games. Naturally, there are many reasons why they have not been (largely) included in games up to this point. First and foremost, they require counterintuitive approach to development. Instead of writing AI five minutes before midnight when a game is complete, Espiocracy features AI since early builds. In a nuanced way, parts of the code have to be explicitly designed to allow the development of appropriate AI - similarly to architecture requirements posed by multiplayer. Sometimes, even player-facing mechanics have to be (re)designed for AI. As a testament to this design lens, in what began as a hermetic joke and ended up as actually useful implementation, the player is currently served with interfaces corresponding to the dynamics of a chess game:



What principles, precisely?

  • State of the game from the perspective of a player (resources, intelligence, alliances, politics, other players, and so on) is approximated in a multi-dimensional vector, an analogue to chess position. As a must for an espionage game, this point also implements absolute no-cheating paradigm (AI players do not have any more intelligence than a human player would have in the same situation).
  • From such position, the game generates a (limited/filtered) list of legal moves such as launching an operation against a particular target, establishing a station, nudging an actor towards an action, or directly attacking other players (captures).
  • An AI player can ask the game to simulate making a move, own move or other players', akin to asking: what will happen after I arrest this operative? The game responds with an updated position which, importantly, stems from internal rules that approximate changes in the world in a way easily understood by a human in a single sentence (e.g. establishing an intelligence station will subtract money and free operatives, but it will establish local spy network in the future and improve outcomes of local operations). The new position can be used further for analysis or to repeat the cycle of generating and making moves.

This framework sets up the stage for developing AI players that utilize decades of lessons in chess programming. In the most universal approach, AI regularly evaluates positions and finds a combination of moves that will improve the position by the highest value.

There are many exciting solutions that flesh out the details (piece-square tables, alpha-beta search, even a counterpart of opening books). For a nice and easily understandable demonstration of the ingenuity of chess programmers, take a look at mobility. Mobility is the number of available legal moves. In chess, statisticians found a definite correlation between higher mobility and victories - better players usually create more opportunities for themselves. This point of view makes a lot of sense in Espiocracy which, much like immensely complex chess, can be meaningfully reduced to mobility (a single number!), or as we know it here, player agency. With a rather simple algorithm, AI players can find a series of moves that increase mobility, which already leads to pretty sophisticated gameplay such as accepting small losses for larger long-term gains, expanding in preparation for invasive actions, or eliminating enemies that may limit future expansion. This is only a single fascinating solution among hundreds available. And it's not the end of innovation in this department...

[h2]Open AI[/h2]

The gravity pull of chess programming, the one which worked for 70 years and still draws people to this day, may be slightly difficult to understand from the outside. If I would have to explain it, I would compare it to a boxing championship for programmers. Thankfully, I don't have to, because the modding scene of strategy games speaks for itself - given the ability to mod, almost every strategy game receives AI mods, some of which are developed with immense dedication for years. Their authors develop them often despite heavy limitations or technical hostility of the game to modifications in AI behavior.

In the spirit of chess programming, Espiocracy will be fully open to multiple external AIs via dedicated API in C#.

The game will be released with a few AIs implemented by yours truly, using chess programming lessons to the best of my ability. However, that ability is severely limited not only by my brain and time but also perspective. Critically and perhaps controversially, I think that too many strategy games suffer from (relatively) poor AI because developers cannot unsee the implementation of mechanics. As laid out in the introduction, solid AI is too important for this game to leave it solely in the hands of the developer(s). By developing both a fish and a fishing rod, I have a sincere hope that one day you could play Espiocracy with easily developed AI mods authored by people much smarter than me.

To allow a truly competitive nature of AI development, the game is already set up to allow multiple different AIs assigned to different artificial players. In a dream-come-true difficulty settings, instead of deciding between degrees of handicap, you can now choose to play against artificial players who can be actually more stupid or more intelligent.



As you can probably guess at this stage in the hereby honeypot for programmers disguised as a dev diary, AI configuration is used not only for difficulty management or for recording timelapses of USA with AI_X vs USSR with AI_Y. In parallel, I'm working on tools that would measure and compare AIs against each other, have a counterpart of strategic test suite, and maybe (I didn't go that far yet) even a multipolar analogue of Elo rating.

Last but not least, I see this openness as an investment into the unknown future of new tools, about which we hear in recent months. By implementing open API, I'm leaving the door open for the day when our computers will have enough power to run deep learning algorithms with strategic reasoning skills.

[h2]Behind The Scenes[/h2]

► For the folks curious about the last remark, we may be surprisingly close. You can already run a 25x smaller equivalent of ChatGPT with a speed of ~2s per sentence on an 8-core CPU. It's large enough to exhibit pretty complex reasoning and planning. Naturally, it's still too slow to power ~100 players in parallel, but once the mechanics are more complete, I can honestly see an attempt at managing an American/Soviet player with its faster iteration (which would probably require most engineering around translation of the quantified position into text description - tinkering with the representation of position is a common trope for many chess engines).

► Speaking of efficiency, this is also a significant chunk of the chess programming legacy. In addition to their numerous tricks, I'm testing unusual distributed approaches (such as... queuing reasoning of AI players to the moment when the game is paused) and explicit computation management. In an ideal case, AI players would receive a limited computational budget, much like in chess engine competitions, which would be set up in game rules. Moreover, comparative tools lend themselves to easy measurement of performance which also should be communicated to the player (e.g. consciously choosing more intelligent AI that will slower ticks by X ms).

► If you want to begin scratching that chess programming itch, have a look at 30 weird chess algorithms, simple & strong chess engine written in 131 lines of Python, elegant pseudocode of Negamax C*, and then lose yourself in clever takes on finding good moves.

[h2]Final Remarks[/h2]

The next dev diary will be posted on April 1st.

If you're not already wishlisting Espiocracy, consider doing it

https://store.steampowered.com/app/1670650/Espiocracy/

There is also a small community around Espiocracy:



---
"Turochamp, a chess program by Alan Turing and David Champernowne developed in 1948 as chess playing algorithm, implemented as . Since there was no machine yet that could execute the instructions, Turing acted as a human CPU requiring more than half an hour per move. One game from 1952 is recorded, which Turochamp lost to one of Turing's colleagues, Alick Glennie. (...) The system anticipated much that has become standard in chess programming." - Chess Programming Wiki & Jack Copeland

Dev Diary #38 - The Lives of Actors 🌱

What's happening / TLDR: Developer diaries introduce details of Espiocracy - Cold War strategy game in which you play as an intelligence agency. You can catch up with the most important dev diary (The Vision) and find out more on Steam page.

---

"Living, breathing game world" is a marketing term that in the last few years was abused enough to be associated with big empty sandboxes rather than interesting worlds. In a way, its popularity is inversely correlated with actual living & breathing worlds - in the 1990s and 2000s, arguably more games tried to pull off ecology systems or independent lives of NPCs, despite much stricter computational environment. In 2013, Tynan Sylvester, developer of RimWorld, diagnosed this "old dream in game design, the simulation dream" as "shattered and killed" by overwhelming complexity. A decade later, wiser by playing many fantastic indie games with intertwined simulated worlds, we meet here to wonder how the dream has been partially resurrected, and how Espiocracy can stand on the shoulders of these giants.

This period has seen game developers proudly saying that they're not really in the business of developing games - they're instead creating story generators, intentional sandboxes, or straight-up simulations. Instead of trying to fit square simulations into round games, they embraced the simulationist approach as the primary driving force.

Although I'm not brave enough to verbally join this crowd (Espiocracy is very much a strategy game first), the wider lesson is used here extensively: to create actually living, breathing game world, sometimes one may have to forget about the "game" part. This is the ultimate paradigm behind the large cast of (hopefully) believable and real actors in Espiocracy.

[h2]Not Only Predictions[/h2]

In cooperation with the framework of motivation and predictions, actors also observe the world and directly react to changes - usually to actions of other actors. This creates natural disputes, such as actor X vehemently opposing constitutional changes proposed by actor Y, followed by response to response, and so on. More than just reaction chains, such an approach also ensures long-running series of interactions between actors, which form the basis of relationships between them (e.g. actor A supporting actor B over a number of issues leads to an alliance and further cooperation).

In addition to predictive and reactive activity, actors (both individual humans and organizations) live their own lives in the background. Every actor has routines - regular low-level activities. Let's take a look at the most prevalent examples, and how they are tied to historical simulation:

  • Going on holidays to X -> Many human actors regularly move on the map to their favorite place(s), which opens up opportunities such as interception or taking power in absentia. This is how an analog of the 1991 Soviet coup d'état is included (Gorbachev went on holiday to Crimea and was isolated there by the conspirators).
  • Working usually in X -> Actors working in the same place, e.g. government buildings, bump into each other and have more interactions. Others may prefer seclusion for its security, such as the late paranoid Stalin staying mostly in his dacha protected by camouflaged antiaircraft guns, or just for its peace, such as writers churning book after book on a household typewriter.
  • Active in X -> A human actor can have a specific type of job in addition to what they're known for (e.g. Orwell at the start of the game is not only writing books but also works in the British press), an organization can contribute its members to additional activities (e.g. a church may run many schools), which expands actions available to the actor, and accumulates effects over time.
  • Campaigning -> An example of routine tied to actor type, in this case, unearthed before an election by political actors, which limits time available for other activities, and makes a human actor or an organization's members travel on the map.
  • Hiding -> Atomic option for actors vehemently afraid of capture (see: Saddam Hussein in 2003), which severely subtracts influence and limits all the other actions for the price of eventual survival.
  • Heavy drinking -> A routine may be less of a conscious decision and more of a straight vulnerability (with rare unusual trade-offs, such as two human actors with the same routine getting along).

These quasi-environmental activities are supported by fully environmental actor events. They cover anything along the lines of diseases, accidents, severe mistakes of important members, lucky business bets, random meetings with other actors, or even falling in love. In the dark world of Espiocracy, such events are not fully random (hence "environmental"), and instead, they can be caused by other actors or players, while keeping the cover of just an event (it's love at first sight, not a honeypot!).

[h2]Plots[/h2]

Motivation, predictions, reactions, routines, events... If you've read any book about good storytelling or building interesting characters, you may have a nagging feeling that this list lacks something larger than just an individual character - it lacks the use of tropes. How can this system capture revenge, redemption, or more complex arcs?

Most interesting tropes are directly implemented in Espiocracy as plots, that can take over the minds of actors, and then guide their actions. As plots rather than explicit tropes, they are less of a comic book arc, and more of a realistic combination of goals and methods, for instance, very Cold-War-ish unmasking the enemy within is used to propel McCarthyism by regularly pushing actors under its influence towards witch hunt and deeper paranoia.

Usually, plots are acquired in response to something, with a classic example of a revenge plot kicking in after large damage is attributed to another actor (including the player, e.g. revenge against the CIA after it killed the family of an actor). They may end once the goal is outdated, approximately achieved, or when actor's motivation fades away.

[h2]The Big Picture[/h2]

Soaring even higher in our bird's-eye view, actors are influenced not only by aforementioned mechanics (and implied wider game world, in the form of i.a. wars or nukes), there is also a dedicated mechanic for local competition between all actors.

Actors are primarily characterized by 0-100 parameter of influence, which gates available actions and their reach (as described in DD#6). Every country has a limited pool of influence tied to local population size and State Power Index, roughly enough for 4-30 influential actors. The influence of any actor depletes the pool, which establishes an emergent competitive environment:

  • Actor's ability to increase influence is scaled by whatever's left in the local pool. An actor increasing own influence simultaneously lowers that capability for all the other actors. Correspondingly, an actor lowering the influence of other actors frees it up to be captured.
  • Overcrowding hurts all actors and eliminates the weakest ones.
  • Power vacuum is real, quantifiable, and generates dynamic power grabs.
  • New actors pick up the fight by merely existing and requiring initial influence.


[h2]Final Remarks[/h2]

After our journey through the game world of Espiocracy - the map, world entities, and behavior of actors - it's time to get closer to the players and gameplay (and finally some lovely screenshots). The next dev diary, "AI of Players", will be posted on March 24th.

If you're not already wishlisting Espiocracy, consider doing it

https://store.steampowered.com/app/1670650/Espiocracy/

There is also a small community around Espiocracy:



---
"Passion is the friction between soul and the outside world" - Andrei Tarkovsky

Dev Diary #37 - Behavior of Actors 🧠

What's happening / TLDR: Developer diaries introduce details of Espiocracy - Cold War strategy game in which you play as an intelligence agency. You can catch up with the most important dev diary (The Vision) and find out more on Steam page.

---

Actors - influential individuals and organizations, capable of changing history - are the main building block of historical simulation in Espiocracy. Today we'll explore their AI.

This is a fascinating engineering problem! We want:

  • Believable, interesting, sometimes cunning behavior
  • via ~50 adjustable and moddable actions
  • for 1500-2500 (!) actors active at any point
  • in the real-time-ish game with very limited computational budget per actor
  • without employing a team of AI programmers to craft and maintain large behavior trees or complex state machines

Playing to our strengths, we have:

  • Many historical samples. One of the best sources is CIA archive of Presidential Daily Briefs, counting thousands of reports on precisely described political activities.
  • Unlimited ability to run millions of simulations offline (= during development, before the release), to collect rich statistical data on the effects of any behavior in the game world.
  • Audience of players in 2023. Most of them do have not bad GPUs, 60% have 6+ CPU cores, 93% clock them at 2.3+ GHz, 69% use 16+ GB RAM.

If you've been anywhere near computer science in the last few years, you know where this leads to: machine learning. The game does not have computational budget for glamorous deep neural networks, but it has enough for two efficient models (regression & gradient boosting) at the heart of actor behavior, which do all the heavy lifting (training) before the game is installed on your computer and then use this compressed knowledge (inference) to control decisions of actors in gameplay.

Naturally, these models are embedded into a wider solution that starts off at an unusual place.

[h2]Motivation and Goals of Actors[/h2]

All living organisms have to maintain homeostasis, an internal balance of parameters such as temperature, otherwise, they will die. Peter Sterling and Joseph Eyer proposed that evolution invented brains to switch from reactive to predictive homeostasis (allostasis). After all, organisms cannot react to fatal disruptions - but they can try to predict them. This point of view was picked up in the last decade by the theory of constructed emotion in which Lisa Feldman Barrett posits that human emotions are predictions, not reactions. Instead of mere emotional response to external stimuli, our brains may build internal models of the future and give it a meaning that is perceived, i.a., as emotions. Returning to the example of temperature regulation, we evolved from cells that simply swim away from the cold, into cavemen who can be happy at the end of severe winter, while it's still cold, because we understand seasons and know that soon we'll be embraced by warm spring.

Remarkably, this approach to cognition is inversely mirrored by the critique of AI in games. AI is stupid when it can be easily duped (cheesed) with any ploy to which it will be too late to merely react, when it does not have a sense of self-preservation, cannot predict the consequences of its actions, remains predictable instead of predictive, or does not creatively prepare for the future.

Therefore, actors in Espiocracy are first and foremost allostatic forecasters.

(To be clear, we are not discussing AI of players competing with a human player, to be described in a different dev diary. This one is solely about actors, autonomous NPC-like entities.)

On the most basic level (lizard brain), actor behavior is guided by three needs and goals:

  • Survival - staying alive or not dissolved
  • Growth - increasing influence (which factors in wealth, number of members, etc.)
  • Impact - changing the world according to ideologies, views, traits, opportunities, etc.


These are precisely and consistently quantifiable parameters. For instance, the need for survival increases when an actor's life is threatened by enemies, diseases, or the possibility of imprisonment followed by execution. The three parameters together (squared and multiplied by personal weights) contribute to the overall level of motivation of the actor. High enough motivation pushes the actor to launch actions that will meet needs and goals which caused motivation to increase. If you see here remnants of a perceptron, you're dead right.

[h2]Predictive AI 1: Acting on Needs and Goals[/h2]

Actions available to actors range from universal (such as fleeing the country) to type-specific (e.g. armed organizations able to raid a place) or even role-specific (a member of government defined in the constitution able to propose launching a war). The first example, running away, is easy to understand in the context of motivation. An actor highly worried about survival may flee the country. Once the actor is away from the threat, the need for survival does indeed decrease. Note that actions do not directly satisfy needs or goals, fleeing didn't give straight +20 to own survival, and instead, it worked through decoupled mechanics that underly the calculation of survival. (This is the critical ingredient that allows the mechanisms described below to work.)

Many actions, however, are more complicated than fight-or-flight response.

In the real life, this is where we would do the thinking - use domain knowledge and an internal model of the world to predict what a particular action would achieve. Generally, AI programmers replicate this process in the code but Espiocracy approaches it already in reconciliation with Sutton's bitter lesson and throws a lot of cheap compute at the problem: data about consequences of actions are collected from many simulation runs (with actions or action combinations paired with corresponding changes of goals and context vector), then these are used to train simple regression models (one per action), which regularly infer predicted values of need-goal satisfaction for every available action.



For the simplest example of action, we're essentially gathering data on how often/much fleeing the country actually saves an actor's life. Things get interesting when we start to compare actions (as a kind of internal model of the world!), for instance in this case an actor fighting for survival may plead for help, attack head-on the perceived threat, or resign from the role. This choice is influenced by availability (closed and well-guarded borders make fleeing much harder), traits (some actors will never flee), personal weights of needs and goals, competence parameter (less competent actors make less optimal decisions), and a small injection of randomness.

Computationally, a lot depends on the context vector and frequency of inference. Currently, these are tied to a regional level (a few countries), which means that action-need predictions are recalculated when, i.a., a war erupts in the region. I would worry more about it (and massage features in the vector or build a tree of models tailored to actor types) if I wouldn't have two other major components of the predictive AI.

[h2]Predictive AI 2: Simulating the Future[/h2]

Our brains can play out not only the consequences of an action - we can also predict what will happen without our interventions. More than simple extrapolation, we can sense dramatic shifts such as the consequences of losing an election.

The game regularly prepares simplified simulations of the future at different levels of detail in four timescales: 2 weeks forward, 2 months, 2 years, and 2 decades. Simulations focus only on the most important events (such as political changes) and approximate their influence on actor goals. Then, individual actors, depending on their influence, competence, position, and access to knowledge can tap into the information about changes to their future needs and goals. This creates lovely emergent motivation, for instance, a political leader anticipating his future loss, and prompted to prioritize growth over impact or even survival before an election.



Of course, the difference between natural prediction and clairvoyant cheating AI depends on the details of implementation. For this reason, simulations are generally about the overt world (e.g. no equivalent of intelligence mechanic from OpenXcom), and "tapping in" slowly grows into a complex algorithm (but it's more interesting to write code about access to information in an intelligence game than about directly scripted behavior!).

[h2]Predictive AI 3: Deeper Actions[/h2]

It's no coincidence that there are three goals and three predictive components. They were aligned in their developmental origin: survival-satisfaction, growth-simulation, and now it's time for impact - deep actions.

Actors intentionally change (impact) the history via actions-target pairs chosen by the second model, trained to spot changes in alternate history (instead of changes to needs and goals). Collected data about actions (enriched by flexible vectorized targets) is paired with influence on State Power Index, both short-term and long-term. In search for directional parameter that widely grasps all the significant events from writing influential books to winning the space race, it turned out that SPI is a robust-enough approximation, that also ties this more complex model (at the moment it's gradient boosting machine) to the logical attempt at making the actors try to improve the position of their country relative to other countries (it's not all roses, subverting another country also increases your SPI).



Not all actors will prioritize this kind of impact due to the weighted nature of needs and goals. Expanding on the tailored approach of all the other shallow actions (which takes into account traits or competence), here the model chooses actions from a list generated by the actor's ideologies, views, past experiences, or friendships and conflicts with other actors.

[h2]Final Remarks[/h2]

After staring into the abyss of predictive AI, in the next dev diary we'll look into other avenues of actor activity (such as reactions and storytelling features) on March 10th.

If you're not already wishlisting Espiocracy, consider doing it:

https://store.steampowered.com/app/1670650/Espiocracy/

There is also a small community around Espiocracy:



---
"Physical concepts are free creations of the human mind, and are not, however they may seem, uniquely determined by the external world. In our endeavor to understand reality we are somewhat like a man trying to understand the mechanism of a closed watch. He sees the face and the moving hands, even hears its ticking, but he has no way to open the case. If he is ingenious he may form some picture of a mechanism which could be responsible for all of the things he observes, but he may never be quite sure his picture is the only one which could explain his observations." - Albert Einstein & Leopold Infeld, 1938

Dev Diary #36 - Worldbuilding 🏗️

What's happening / TLDR: Developer diaries introduce details of Espiocracy - Cold War strategy game in which you play as an intelligence agency. You can catch up with the most important dev diary (The Vision) and find out more on Steam page.

---

Worldbuilding is commonly associated with largely fictional worlds (think: Tolkien, Pratchett, or George Lucas) rather than art rooted in historical accuracy. Even in deeper alternate-history scenarios, the world is more of an extrapolation than an invention. Espiocracy, however, walks the path much closer to worldbuilding due to the subject matter (many "alleged" and "classified"), sheer need for details, and requirements posed by the emergent nature of gameplay.

Today we'll explore the ontology of our game world.

As hinted in DD#24, the entire world is built out of entities (a conceptual element of the domain of discourse, or just a fancy word for a thing that is less material than "a thing" and less mathematical than "an element"). These are divided into two main categories: physical objects and mental concepts.

Subject to change and already slightly outdated.

In an implementation closer to colony builders rather than classic strategy games, all entities have parameters, belong to hierarchic categories, are dynamic, can be manipulated, and can interact with other things. Instead of designing strict rulesets with hardcoded units, the game bakes an inherently emergent simulation, where every cog in the machine - every country, player, ideology, city, and so on - can be potentially modified.

All mechanics described in the previous 35 dev diaries utilize this system to some extent. There are even mechanics mostly nailed by sheer relationships between these entities. For instance, an intelligence operation launched by the player exists in the game world as a mental concept, which means that it can be even a subject of a view (eg. guilt after assassinating X), which in turn is a thought that, unless recorded on a medium of thought such as documents, resides only in the mind of a human or a group of people and can perish with death of minds harboring this thought. This is not a special mechanic for generating and then killing guilty operatives, it's natural worldbuilding. The possibilities, also for modding, can be spectacular - technically, it is possible to develop a 1984-ish mod where players can erase entire mental concepts from existence, even countries (as an organization, as a mental concept from the minds of people, and from all the records). Likewise, on the physical side of the entity spectrum, any physical object can be destroyed, up to the hellish mod which can take an advantage of the fact the Moon is also a physical object in the game world. (Kōan: will biblically accurate angels be modded in as physical objects or mental concepts?)

[h2]Traits[/h2]

To illustrate the power of universal entities building the game world, let's take a look at an innocent feature: traits.

Game designers usually pick a single entity (or a few) to be fleshed out by traits. This is a result of their costly implementation and maintenance - that is, costly if you implement entities separately. In Espiocracy, all world entities can get traits and the same traits may be even applied to more than one type of entity because they are implemented on the level of hierarchic categories (and because the code doesn't shy away from the OOP beauty of C#). Here's an example of a city with a set of traits:



"Sea of Rubble" can be applied to any kind of infrastructure - for instance to the economy of a nuked country. To find another example, "Impulsive" can be a trait of any human - an operative, a president, or a witness. Beyond storytelling and modding possibilities, traits can also form the basis of universal decisions, such as rebuilding critical infrastructure or transport networks to remove its "Sea of Rubble" trait.

[h2]Gameplay[/h2]

The universality of entities is reflected by the user interface. Any entity can be selected. A click on a country on the map de facto selects it as an organization, one of the actual entities existing in the world:



After selecting an entity, you get not only details about it (either a standard rundown of details or a designed widget for more important categories such as above), but also hyperlinks to related entities (eg. local events listed above are links to relevant mental concepts), and possible interactions (buttons on the right).

Interactions follow the same principle of emergence. All items can be moved or stolen, all humans can be killed, all thoughts can be disseminated, and so on. Moreover, many of these interactions are enhanced by the rich toolbox of an intelligence agency, meaning that the player can for instance pull off ~20 types of intelligence operations against any human in the game world, from kidnapping all the way to expelling.

[h2]New Entities[/h2]

Entities in the world are initialized historically (more on that in the next section) and spawned during the campaign. At the moment, there are three methods of procedural generation:

  1. New entities are derived from existing entities. A population may create a new actor to act on popular views, sprawling economy may lead to the establishment of a new city, and so on. Entities can also undergo internal-external changes, such as organizations creating branch organizations, a new organization created in a merger, or splitting one entity into a few new entities.
  2. For most important categories, such as actors or countries, there are sublayers - they contain entities nominally belonging to a different category, but with a high potential to be promoted. For example, the "sublayer of actors" contains people and organizations who are not yet (or no longer) influential enough to be actors influencing the country and the world. Usually, when an existing actor is deposed, the vacuum is filled by promoting one of the leading subactors (which creates nice small gameplay around supporting/subverting them to reap benefits later).
  3. Inventing from zero is either achieved via simulation engines (eg. top intelligence operatives created by a separate full simulation or new witnesses spawned as side products of an operational simulation) or, in simpler cases (eg. spy gear), spawned by various mechanics.

[h2]Historicity[/h2]

It is said that a historical game becomes an alt-history game the second it is unpaused. Espiocracy, to pursue more interesting gameplay, takes it one step further and by default engages the engine of alternate history before the game is unpaused.

This is motivated mainly by the huge benefit of hindsight issues in the world of espionage. Take for instance very popular case of Kim Philby - at the start of the game, in 1946, he was a high-ranking member of MI6 and a Soviet spy. Featuring him precisely in this form creates an obvious degenerate strategy for at least two players, a move so obvious that it's a meaningless chore instead of genuine gameplay (British player should always chase Philby, Soviet player should always recall Philby before he's imprisoned).

The solution? Gradual randomization in the form of historicity setting.



10/10 corresponds to Philby in MI6 and all the other entities roughly the same as in history. It is still alternate history (some holes in historical records have to be filled) but players interested in historical accuracy will still be covered. While I believe that this type of gameplay has many disadvantages in the context of espionage, I'm a larger believer in giving players full customization of experience.

Every lower level gradually randomizes locations, dates, types, and entities themselves. This is implemented in a two-fold way - by actual randomization of the initial state and running a simulation of the game world before the start date, longer with a lower historicity level.

Default recommended level will be probably set to 8/10. This is where there is a high-ranking Soviet agent in the West but not Philby and not in MI6. It also corresponds to more scrambled plans of actors in the game world, slightly altered incoming political changes, or modified views, facilitated by approximately two months of pre-game simulation.

Lowering it further starts to build the world in a more verbatim sense - for instance, changing the position of fossil fuel deposits (to the point where Arabian oil ceases to be a hindsight). By elongating pre-start simulation and lifting limits on its course, it may even lead to slightly changed borders or different political processes in place, all while ensuring relative historical plausibility (eg. Germany may start as an already unified neutral state).

[h2]Final Remarks[/h2]

Next dev diary will be posted on February 24th.

If you're not already wishlisting Espiocracy, consider doing it:

https://store.steampowered.com/app/1670650/Espiocracy/

There is also a small community around Espiocracy:



---
"You had to start wondering how the fresh water got in and the sewage got out... World building from the bottom up, to use a happy phrase, is more fruitful than world building from top-down" - Terry Pratchett

Dev Diary #35 - The Map 🗺️

What's happening / TLDR: Developer diaries introduce details of Espiocracy - Cold War strategy game in which you play as an intelligence agency. You can catch up with the most important dev diary (The Vision) and find out more on Steam page.

---

Welcome back after holiday break! As the tradition (of 34 installments...) suggests, we'll start with a lighter dev diary: this time, about the map in the map game.

[h2]Background Map[/h2]



Espiocracy implements old school 2.5D approach - player moves the camera in 3D at an angle, but all elements are 2D. In a classic trick, detailed 3D model of Earth was rendered into 248 two-dimensional textures. Not only the computation is done once and for all of the terrain (= better performance, lower requirements, easier development), we also get rather unique relief map of the world at resolution of 43x21 thousand pixels.

From day one, CIA maps were primary inspiration, which contributed to the choice of Robinson projection for the map. In a very topical accident frozen in time, the game actually uses... a CIA variant of Robinson projection, used in The World Factbook, which means that it's probably literally unique game map.

A few examples of zoomed in camera, starting with Indonesian labyrinth:



Korean Peninsula:



The Great Lakes region:



Tasmania:



And here's practical demonstration of the resolution, max zoom into Galápagos Islands:



These are more of an unintended harvest. Relief map remains always in the background and players preferring calm screen can switch to even more old school paper background:



Ultimately, they all serve the king of map types...

[h2]Political Map[/h2]



(This is the political map for the start date of March 5th, 1946. Protectorates and colonies share color with controlling countries. Thin west-facing stripes denote occupation (stripes have color of occupying state or states). Thick east-facing stripes denote territory controlled by subnational militant organization.)

Political map features de facto states. Following statehood criteria of Montevideo Convention...

  1. Permanent population
  2. Defined territory
  3. Government
  4. Capacity to enter into relations with the other states

...and gameplay criteria (every independent state is a player, has its own intelligence community, set of actors, available international actions etc), enriched by historical foresight, I made the following decisions:

  • Occupation zones - were consolidated where possible (eg. Allied-occupied Austria) or featured as separate states when setting up a conflict (eg. West and East Germany)
  • Ephemeral states around 1946 which were protected by another country - featured (eg. Newfoundland and Labrador)
  • Ephemeral states abandoned by other countries - represented below state level (eg. Second East Turkestan Republic)
  • Participants of civil wars with fluid territory - represented below state level (eg. Viet Minh)
  • De facto states with defined territory, invaded soon after 1946 - featured (eg. Tibet, Oman separated from Muscat, India divided into British India, Travancore, Hyderabad, Bhopal, Jammu and Kashmir, other princely states)
  • Excessive number of small nearby states that acted or will soon act together - consolidated (eg. Trucial States, British West Indies, 500+ princely states except for the four above)

A few closer glances:







While inclusion of states is a careful process, the game includes as many territories, enclaves, and islands as possible in the limited development time. Currently, there are 193 islands in Espiocracy. These provide very palpable geographical approach to the Cold War, from SIGINT installations to Argentina invading the Falklands or USA invading Grenada.

[h2]Gameplay[/h2]

High resolution of the map is not really an aesthetic choice - it is motivated by the gameplay and simulation. Instead of provinces, the world in the game is represented as 5100x2650 grid (with higher precision when needed). Operatives and actors travel in this coordinate system, cities or battles have precise points, rebel or armed conflict territory expands point by point, and most importantly: borders can be drawn in myriad of ways.

To assist alternate history and avoid bordergore, determination of borders (eg. in peace treaty) is supported by database of historical and natural borders. Here's an example of multiple layers of suggested borders in Germany (work in progress):



You can see here Weimar Republic states, administrative units of Nazi Germany, forward positions on V-Day, Anglo-French-American division, mountains, and rivers. The database will slightly evolve over the course of a campaign (eg. less significant & older borders will be forgotten - who remembers V-Day positions in 1995? - while new conquest or rebellions will leave new traces), although lines with the highest weight will remain unchanged (natural borders).

[h2]Final Remarks[/h2]

That was brief, visual, and light as promised. We'll certainly return to the map in the future - perhaps even two times more, since there's a lot more to talk about, from map modes to special hover UI or keyboard-based map traversal.

If you're not already wishlisting Espiocracy, consider doing it:

https://store.steampowered.com/app/1670650/Espiocracy/

There is also a small community around Espiocracy:



---
"One Soviet general, looking at a map of the territory Russia had acquired on the Karelian Isthmus, is said to have remarked: we have won just about enough ground to bury our dead" - William R. Trotter