Monday, November 30, 2015

Espionage And Dirty Politics In 4X Games

So Espionage in most 4x games is shit. Its not even a debate. Paradox is all about waiting for timers to tick and dice to roll. Civ barely has one. Dominions only has what is essentially magic espionage plus scouts.
Lets talk about the way the world should be instead of the way it is. Granted I'll be using some game specific mechanics from my game since I'm describing the system I myself am making as the best way to do it.
First, you have characters. These are the rulers and nobles of nations, archmages and possibly regular mages, important merchants and factors, and various religious dignitaries. These people have both known and secret desires, said desires generating based on the history of their religion, state, etc. Nobles want to own the land their grandfathers conquered but their fathers lost, plus of course more land if the opportunity presents itself. Same for leaders of state. They want to reach or exceed their days of glory. Mages want money and resources for their research, access to ancient texts, and other things. Merchants and factors want trade deals, tax relief, access to new markets. Religious people want to expand their religion, recruit important characters as members and so forth.
Other characters will try to enact plots if the conditions are right but since the game part is essentially the same, I'll focus on the player.
As a player you want stuff. You could buy it/trade for it or conquer it. But you can also use sneaky dealings. First you as the ruler of a state have intelligence infrastructure. You can invest in it, research it, try to trade for the knowledge of others. Also like all systems in my game, the more you perform espionage the better you become. Having a well funded and long running and active intelligence organization provides slow growth in their ability, this represents training and internal culture. Your spy agency will study nobles, either randomly or if you have a specific goal then as you direct. As you allocate funding, human capital, and time to a given important character you will slowly dig out their dirty secrets, hidden desires and possibly catch win of their own intelligence activities. You can blackmail them with dirty secrets, support or counter their plots, and bribe them with their wildest dreams. Assuming they have something of value that you want.
You could also sell your knowledge to another character, perhaps their long time rival or the target of their plot, in return for that character's favor which you can then use later to get them to help you in your own plots. Note that if you make a deal with someone you don't have to follow through at the end, but then that person won't trust you and may tell their friends and allies, or even the whole world, of your duplicity depending on how angry you make them. Note that you need to break several deals before no one will work with you, early on you just have to give them better deals for their assistance. And deals you keep counteract deals you break, at least a little.
Perhaps you find out that some noble in another kingdom desires a certain piece of land owned by your or his liege. As it is one of his secret and not open desires, its worth a lot to him. He is quite powerful, perhaps he owns the 3rd most land in the kingdom. You are an empire. You make a deal to get him that land and make him king in return for backstabbing his current ruler. His acceptance will depend on how people view you as a liege, his own moral alignment, how his people feel about you and his current ruler and so forth. But he'll ignore quite a bit of negativity to get the land stolen from his great grandfather which was returned to the crown when the son of the thief died without an heir. You either invade openly and make him your puppet king when he turns to your side or provide troops and money, he seizes power, and swears as your vassal. The political consequences in his kingdom depends on how the people view you, him, the old king, and the way shit went down. Note that, since technically your overall plot was to take the kingdom without an all out war, you could have other plots such as certain nobles arriving late to the enemy's assistance, or abstaining from conflict, or swearing allegiance to the puppet king or w/e. Even multiple traitors. Also other nations finding out through their own intelligence operations could intervene or get negative opinion modifiers after finding out about the bribes and blackmail you employed. Maybe someone else knew about the secret desire of the noble and that counts as them realizing you bribed him.
There is also a propaganda system you can play with that will effect the opinions of your espionage and military actions but that's another thread.
Plots can also be directed at your own citizens, like mages and merchants and your own nobles. Maybe a noble is getting to strong so you have him killed, reveal a dirty secret to turn off his allies, or something. Maybe a mage has a book you want for the national magic academy so you bribe or blackmail him or something. You can also catch traitors, if your intelligence infrastructure is good, and blackmail them into double agents, have them hanged for treason and their property confiscated, and so forth.
This all derives from the secret desires, dirty secrets, open desires and general desires. Everyone wants a higher rank or more money or land or w/e. But open and secret desires carry more weight when met than general ones.
Secret desires can also be met diplomatically of course. If a noble loves his firstborn daughter you can get him a powerful match, a match that will treat her well, or marry her yourself if the noble has a good opinion of you, thus gaining his favor and even political support. Marrying her yourself meets both a general desire of increased prestige and/or rank if she is the heir, and his specific desire of a good man to make her happy. Granted, if you divorce her, or have her killed and he finds out, then you lose both the favor of the act itself, and double penalties for breaking your previous agreements.
Also, you have 3 sort of reputations that affect how people view you. Fear, how much they are afraid of your armies or your torture chamber or your rampant executions, respect, how they view you as a leader based on your accomplishments, and opinion/influence. This includes stuff like your dynasty/personal/national right to be their liege, giving them money or land and all the stuff that you might see in a Paradox game like royal marriages, plus extra like fostering kids and shit. Each person has a separate value for each. Someone who really fears you will be more likely to fall to blackmail, someone who respects you will trust you to keep your word, and in the case of becoming a vassal, to treat them well.
The main goal of the espionage system was to make it more like war. Doing recon, finding out who is willing to side with you, gathering your forces, like in the case of rebellious nobles, and so forth. There are unfortunately some timers like applying your spies and waiting for find out info, but info you find is forever so in some cases you might have the info before you formulate the plan and then you don't have to wait. But ideally its all focused on actions you take with direct results. Marry daughter, get support of father, bribe greedy noble for support. Next Imperial election become Emperor.
Ideally you could be a noble in a state similar to the HRE or the Eastern Empire of the Valdemar series and spends hundreds of years working with building alliances and bribes and assassinations and not fighting a single battle but still having the joy of becoming the Emperor through planning and skill. Of course you CAN fight battles and the combat and conquest systems are large parts of the game.

Tuesday, October 6, 2015

Magic Systems In Fantasy Strategy; Leaving Even Dominions Behind

One thing I've always really wanted in a fantasy strategy game is a super awesome magic system. Now Dominions has a magic system but the whole game is super combat focused and a lot of the magic system isn't super open to exploration. Spells are complete entities that do one specific thing. Not only that but the different potential options available were quite limited.

In order to fulfill my dream of a fabulous magical component in a 4x/empire building game I came up with a combination of atomic parts drawn from dozens of magical systems in games and novels. The goal is that nearly every society in the game will be able to assemble its own almost unique magic system, similar in differentiation to the static premade magical capabilities of Dominions3-4 but with many more options. Magic changes somewhat over the course of the game and the historical pattern itself will probably be different every game.

In the early phase start you have a randomized map as well as a number of randomized tribes that will eventually form nations. Various spirits and deities will inhabit the world, including the players option of designing their own race and deity. Special magical races will have their own standard set of magical capabilities at the start, but this will only constitute a small part of their overall magical nature. Tribes will be able to make deals with various spirits and deities as well as conduct independent magical research and potentially integrate or be taught by populations of the already magical races.

In the early start there is a large bonus to magical research and magic in general sort of signifying the traditional age of magic/legends/enchantment in fantasy stories. The world is simply more magical at the dawn of time.

There is a set of primal gods which exist at the start of every game, a set of randomly generated lesser gods, the player's god immortal designer character, and the potential for various races to sort of will their own god into existence. Gods with similar powers draw from the same well, so if you have a god of the hearth, god of the sun, god of the forge, etc, they all draw from the well of fire. Or if multiple races have their own gods of the forge or w/e they still draw from the well of fire.

When a race/religion generates its own god through an act of magical and mental will that god is bound to that religion. However gods require sacrifices and worship to act on a race's behalf and may act against a race that changes their beliefs. Thus spawning a god is not a permanent increase in power for a temporary cost in various resources like magic or the heat of a volcano or w/e. Gods have multiple attributes that define their desires which must be dealt with to gain their blessing. These attributes are drawn from the creators of the gods at the time of creation. For gods who are primal or randomly generated at the start, as well as nature and elemental spirits, these gods mostly tend to reward those who support their essence. Racial gods are a lot more into punishment as part of their closer link to their creators than natural deities. A war god will often bless any nation/tribe that shows reverence for war. A racial war god will punish its race if they start to deviate from its desires as well as perform blessings. Racial gods tend to only bless their creator nation/tribe/race.

Created gods are powered by worship and will slowly fade away as their number of followers falls. Natural gods are sometimes empowered by worship but don't ever really pass on for the same reason. Worship powered gods can grow in power while natural gods generally don't. They do start out stronger. Because all gods/spirits of similar natures draw from the same well primal gods may be dethroned if another god surpasses them in power. Generally primal gods will have more tricks related to their nature than created or even randomly spawned gods. Their nature will be more focused on their well primary attribute.

Gods are implemented as regular characters in the code and they can actually do things like lead a nation. A player designed immortal will generally start as the initial ruler of their people. Similarly a regular character though generally only a mage or ruler, can gain power equal to that of a god through magic and worship.

Beyond the deities/immortals in the setting magic can exist naturally. The overall level of magic slowly drops over time but is also influenced by the actions of groups in the game. Magic decreases based on the population of sentient creatures in the game but this mainly affects the nature of magic research. That is, research into magic is sort of an act of creation. Magic solidifies into a natural law as it is created. Essentially magic begins as a primal and undirected force. As more magical power is directed its harder to find new magic to direct and eventually its tapped out. Already directed magical power remains in the world so whatever magic is discovered will always exist and function. Magic must be rediscovered in ancient ruins or learned from spirits/deities/immortals and can't be created by "research" anymore when its all gone. Therefore over time as magic is lost to time it seems that the world is less magical. However existing magical knowledge spreads, making it more difficult for it to be wiped out, so there is a sort of magical rock bottom below which you cannot go.

It is possible to directly wipe out a specific type of magical knowledge or to go after magical knowledge in general and it is also possible to lock away ambient magical energy. When sealing away magical energy although knowledge is not lost all magic becomes weaker as the total pool of magic is limited. You can however attempt to shatter magical seals and release magic back into the world. You can also collect and lock away magical items. Various natural resources, geographic locations, magical beings, and magical items can be used to draw out magical energy for use in various actions.

As far as the actual options for magic go there are various atomic effects you can combine. You can magically transfer attributes between populations and characters to enhance one at the expense of the other. You can expend a larger amount of magical energy to enchant items or units/characters to have boosted stats in a similar way. There are all the common kinds of elemental magic like fire and shadow and crap as well as areas of effect and ranges and what not. You can summon or create creatures, affect weather, boost crop yields, cover the land in shadow, generate storms, terraform the land, create portals to other dimensions or gate between locations. You can build or power structures. You can use magical tools or spells to spawn roads or dig out harbors, or do it the old fashioned way. Mages can combine powers for greater effect. You can boost the life span of a character or grant them immortality.

I had several major goals in the system. Magical resources are something to fight over, gods or nations can wage war between each other to strike down other gods who use the same power well, some gods and spirits function as characters with various goals.

Goals of spirits or deities can include a sentient forest that wants to cover all land and can provide various benefits within its controlled land. Ascendants or immortal could have more standard temporal political goals. Fights can break out over banning certain magics or preventing a nation from controlling too much of the total magic, you can fight for causes like removing magic from the world. Various primal entities will be in conflict and may independently offer you aid for completing their goals. You, or the AI nations, must decide how to interact with various beings, actually siding with them, accepting aid and then backstabbing them, etc.

Magic can fill in technological or climate gaps. For instance ice mages could supply the necessary temperature changes to allow for underground food storage vs living in an icy place or importing ice and having special buildings to mitigate temperature change. You can as mentioned build structures and roads. Of course you can use magic for combat.

The actual system functions mostly sort of emergently. There are the overarching rules and the various atomic magical effects. These combine with each other and with the other game systems in a way that allows for a great deal of depth and complexity even though the input, the rules and effects, and not super complex, because the combinations of the input are what populate the system.

The vast possibility space for the player to discover comes at a relatively small dev cost vs hardcoding every single spell or action or w/e as games like Dominions3-4 do. Of course most 4x/empire/political/conquest/grand strategy games lack any sort of interesting magic system at all.

Wednesday, September 30, 2015

Bandaids And Abstraction: Why 4X Games Fail To Solve Problems At All Much Less Realistically

There are a lot of games in the 4x genre trying to solve the major issues. From longevity to stacks of doom they are all going about it in entirely the wrong way. The most common solutions for these issues involve abstractions and bandaids/limitations added to curtail player strategies. Instead of artificially limiting players, games need to provide systems where the desired behavior is a productive strategy for the player.

Since I've talked about longevity before I think I'll address the famous doomstack this time. A doomstack is when the player, or the AI, assembles its entire military into a single army. The goal is this is that combat algorithms in most 4x games give a higher kill to death ratio the more units there are between the totals of competing armies. 400 to 100 you lose 20 and 200 to 100 you lose 50. Paradox games allow for much more likely routs against smaller armies basically making armies disappear and need to be rebuilt instead of running away and then regenerating.

Many different studios and games attempted to resolve this issue. These were the most common solutions:
1UPT
Tile caps
Attrition %
Multi unit damage

These are merely treating the effects and not the cause. The solution to this problem and almost all the others in the 4x genre has always been to go after the causes. Contrary to popular belief, the cause of all the problems the 4x genre suffers is simplicity. There are trade offs of course but you have a choice of either adding complexity or accepting defeat as far as the historical problems the genre faces are concerned.

In this specific case there are several necessary systems and mechanics to be invoked. Attrition, logistics, and other specific systems must be employed the but the issue extends beyond that. Games must include reasons to split up stacks. Dominions3-4 deals with this issue somewhat in that you cannot leave provinces undefended without risking capture but its still a bit abstract and simplistic. In the ancient empires garrisons were necessary for defense from both internal and external assaults. Paradox games simulate this somewhat with the limitation that garrisons are non-interactive and are basically just a number but we can do much better.

In the majority of military history many victories were won by generals who cleverly attacked multiple fronts instead of grouping up and hunting down enemy doomstacks. Night attacks, sneak attacks, assassinations, feints and parries on the scale of armies. Paradox does the best job of dealing with the sort of rock and a hard place traps that often were important in warfare but like always they fall short of what can and should be done. Armies can charge in from all over the world as battles are fought over months or sometimes even years. Meanwhile defense is handled by the aforementioned automatic garrisons. Their recent EU4 switch to a fort system would be better if again they didn't implement it so abstractly.

Part of the failing of EU4 is how generic the combat units are. There is no training, no unique units, everything is drawn from a general manpower pool and Paradox games never implement the economics to go with their combat. Here the depth of Dominions3-4 is somewhat unique. Units are mostly unique to the provinces they were trained in. Racial units can often only be built in the original capital province of a race because they spawn based on special structures. Sadly you cannot build the special units of other races and there is generally only one province per nation with special training areas. Similarly in Paradox titles the nature of each province is rather unimportant and generic, perhaps barring trading bonused provinces and a couple really high tax ones.

So you need the time to get stuff done before armies can coalesce, interesting and significant provinces/cities to capture, logistics, attrition, and a system where huge numbers don't massively disadvantage weaker armies, whether that weakness is in quantity or quality of units.

Another alternative is war/espionage systems that offer other ways to fight a war. Rapid movement, chaff shredders, immunities, sabotage, and other ways to get things done and cause your opponent to have to shake up their tactics and strategies, but that's a topic for another post,

Saturday, March 28, 2015

Snowballing, Map Painting, Blobbing: Solutions

Note that this is a post about "meta" game, but not metagame, mechanics. Actual in world gameplay mechanics are not really discussed.

I have thought long and hard about how to handle an certain issue in almost all types of strategy games, but probably the most annoying in TBS, Grand Strategy, and 4X strategy games. In games that simulate you ruling over some kind of nation, and especially with a long time scale, there is a tipping point when you become untouchable. Below is the method I devised to resolve this issue. Be warned, I expect both that my method will work and be elegant, and that 80%+ of strategy gamers will despise it.

The reason that games attempting to simulate or abstract wars between various organizations and nation-states cannot do so is because of the player. the player ruins everything. Each different game attempts to account for the player but they all fail. The reason for this is that they are not identifying the problem correctly, whether because of intellectual shortcomings, or because doing so causes a sort of cognitive dissonance which they avoid by trying to solve a substitute problem, subconsciously rejecting the true explanation.

There are 3 major issues with the player as well as lesser issues related to the particular genre:
1. The player has limitless time to solve their problem.

2. The player has infinite redos if they mess up.

3. The player can crowdsource solutions via the internet.

In more poetic terms, specifically related to games that supposedly follow a nation-state over centuries, the problem is restated thusly:
In comparison to a true ruler in the medieval age, because even space games tend to simply change up the setting while retaining the underlying politics/theme, the player possesses many anomalous qualities. The player is immortal, relentless in their pursuit of a single overarching goal, almost perfectly pragmatic, immune to the constraints of time, possessing personal mental energies vastly outweighing that of their many silicon adversaries, and may gain the guidance of vastly more experienced entities of the same divine nature.

To use an example, this describes every person who ever copied a strategy first formulated by DDRJake in gaining one of the Steam Achievements of Europa Universalis 4. If you think about it for a second you see that this is the distilled essence of how a player approaches that situation.

As mentioned previously every game makes some attempts to level the playing field between both the player and the real life rulers and the player and the vastly inferior simulacrums they face off with in the digital game world. Some games give the AI powerful bonuses regarding resources and game data. Perhaps they provide map vision, better leaders if the game has those, superior starting resources, other AI who will suicide the player sacrificing themselves so another AI may win. Perhaps there are +1s to dice rolls. Yet it must be possible for the player to win. And here we see why crowdsourcing of solutions is an issue. If one person can defeat the AI on the highest difficulty through personal brilliance, invariably many can do so and will publish step by step guides online so as to gain the adoration and gratitude of other internet goers.

Indeed creating a challenging game based on knowledge and information has all the issues that plague people who possess great intellect. The law you discover can be applied by nearly any living human once you have done the hard work of figuring it out. Whereas talents that are physical cannot be spread in this way. Thus the greater popularity of physically challenging activities over mentally challenging ones. A human being cannot absorb the physical muscles of another through reading some text. Any attempt to create an intellectual challenge that remains static is doomed to fail as such challenges need only be solved once and introducing small random factors only requires the aspirant to hit reload or restart a couple times to gain a favorable result.

The first step to creating a robust intellectual challenge is thus obvious. A new challenge must be generated for each aspirant. This is not a perfect solution. You can still crowdsource the solution, and if arbitrary saving is enabled you can roll back a failure. But you cannot find a solution already written and the denizens of the internet are unlikely to solve a complex pussle for you with little benefit to themselves. You still have the benefit of limitless time as well. This simulates the real life experience of a historical general or ruler, where they could apply theory gained from solving related problems but could not study the exact answer to their current problem in advance.

The next step of the process has one major answer and many minor refinements. A time cap. Yes, you may grant the player 10 minutes a turn or some other arbitrary number, but you must have a cap that will eventually become less than what is necessary to plan out and flawlessly execute each minute, miniscule, microscopic decision. Thus contrary to the current design of most games, the tipping point is not the point where you become invincible, but the point at which diminishing returns on expansion begin to set in. This simulates the real life experience of a historical ruler or general, who simply could not personally manage every aspect of their army or state. Now you may formulate a system for them to offload that responsibility, while remaining able to take control of whatever particular aspect they deem most important, while delegating less critical tasks to an inferior mind, or simply a mind better attuned to those tasks. Specialization of labor of the art of sovereignty. An example of the classic axiom of economics, comparative advantage. Even if you don't create a system that would make equal or better choices than the player, as long as it isn't terrible, the time cap provides incentive to automate some aspects of their responsibilities because they can no longer accept the tedium of micromanagement to gain the benefit of optimal actions.

The goal of the time cap is that smarter players, or simply more experienced ones, would be able to make more and better decisions within the time limit. Compare to games such as RTSes or MOBAs or shooters where players with twitch skills have the advantage. This is intended to simulate the way that superior rulers in real life quickly forged great empires which quickly collapsed after their deaths. Europa Universalis was famously unable to create a system in which players, OR the AI, could perform a conquest which mimicked these real life rulers, because taking a lot of land fast merely meant snowballing harder, there was no downswing. It is extremely difficult to make a mistake when you have infinite planning time and can wait a couple days to ask superior players what to do.

This goal combines in my personal with attempting to have players roll their own unique map, although you could save and trade scenarios, so that you can make a choice without easily being able to plot all future consequences. A smarter player will be able to handle this better, thus allowing the game to replicate the real life situation of giant empires collapsing instead of snowballing as they grow.

The final step is what many games actually figured out and applied. No saves. Ironman. But importantly, a no save game in which one or even ten bad decisions will not permanently cripple the player. Paradox games do this very well. Although truly, if your time cap and randomized scenarios are implemented well, this step may not be strictly necessary. If you have reached the limit of your on the fly cognitive capabilities, no amount of save scumming will allow your empire to expand because you will keep making sub-optimal decisions. Granted you could simply spend your time limit grabbing game data, save the game and quit, and then work from there, but even then that would provide limited assistance unless you had human readable text files describing current game state.

I expect that many players will rage at a time cap in a turn based game, but you can't please everyone.


Disclaimer:
The inspiration for this post was the game I am making for which this blog is named. It applies mainly to turn based games, although variations for RT/WP games are simple to construct, for instance a time limited pause function. It primarily focuses on games that are single player and which you cannot "win". Dominions, on a suitably large map, or a Paradox game are probably the best widely known examples. Civilization might work as well.