Monday, January 30, 2012

Design Pattern: Upgrade

The upgrade is a pattern that is applied all the time to games.  The player is allowed to make a decision to improve a game entity in some way.  Upgrades always cost something to acquire, usually a resource and/or time.

Upgrades come in two flavors: upgrades of course and upgrades of choice.

The former covers upgrades where you will get the upgrade just by playing and often represent an expansion of player skill and game difficulty.  In classic FPS's, like Doom, gaining access to a new weapon as you play through the levels is an example of an upgrade of course.  A more colloquial term for this flavor would be ability curve, where over the course of play (see the name?) the player's abilities expand.  Upgrades of course are useful for in-play tutorials.

The latter is the type of upgrade which pertains to the customization of a game entity.  Usually, upgrades of choice are pigeon-holed in some way; that is, there are more choices of upgrades than there are chances to upgrade, either by a restriction on the number of upgrades or by availability of upgrade resources.  This forces the player to make a choice concerning how they want to improve.  The former type of pigeon-holing is more easy described as expansion slots while the latter is an example of scarcity.

Examples

Age of ... Series

The technologies of the games are upgrades of choice almost universally, though some only grant access to other technologies to be researched.  Researching techs in most games including the Age of ... Series is almost always done with scarcity; you can research everything, but time and resources are scarce enough that you usually have to make decisions.

D&D

As characters progress in D&D (3.0 and later, at least), they are allowed to add Feats to their character.  Feats are special abilities that allow you to break the normal rules in some way, ostensibly because the character has become just that awesome.

There are many many dozens of feats, and no source book or expansion is complete without a list of new feats to make your characters especially over-powered.  Since these are permanent additions to character abilities, they are pigeon-holed upgrades of choice, or expansion slots.


Halo, DOOM, etc.

FPS's almost always use upgrades of course; as you play, you gain access to more types of weapons.  The resource you expend in these situations is usually only the time it takes to play to t a given level where access to a weapon is granted.

Design Pattern: Complementary Mechanics

Complementary mechanics are a coupling of mechanics where each reinforces the other in order to result in a desirable player behaviors.  The best complementary mechanics reinforce each other as well as encourage player behaviors that relate to each mechanic; I'm calling this type 'completely complementary mechanics'.

Complementary mechanics are a very effective way to silently pressure a player into strategic actions with them not necessarily being aware of the greater importance of those actions.  They must be carefully designed, however, so that the resultant behavior is fairly obvious given the mechanics involved.

Examples

Chess

If you are familiar with chess strategy, then you know that building a pawn wall is very important.  The pawns, though weak individually, become a powerful tool that thwarts opponent movement when used together.

In order for it to work, a pawn wall must be zig-zag shaped; pawns capture diagonally, so for one to protect another, they must all be adjacent diagonally.  To complement the fact that they capture diagonally, pawns can move one or two spaces on their first move, making the most basic pawn wall, a two space wide zig-zag one space in front of all of a players more powerful pieces, mostly trivial to accomplish.

Because most chess pieces cannot hop over allied pieces, the complementary mechanics of pawns naturally force you to move them into a defensive structure that is porous enough to let your pieces through but strong enough to repel opponent pieces until the mid-game.

Mechanics: Pawn capturing, one-or-two first move
Resultant Behaviors: building a pawn wall, opening maneuvering room for more powerful pieces

Sins of a Solar Empire

To achieve the next tech tier, you need a certain number of research labs.  You can also only build a certain number of structures around each planet.  Since there are numerous structures you could build and limited slots to build them in, the only choices you have as a player are to colonize more worlds or upgrade more worlds to get more slots to build more labs to research more techs to protect all those worlds and structures you colonized or built.  Planets also incur a cost to operate until they are completely upgraded.

This is an example of completely complementary mechanics.

Mechanics: tech tiers need more research structures, only so many structure slots per planet
Resultant Behavior: colonize more planets, upgrade planets, and later, research more techs to protect your investments

Battlefleet Gothic

A game of space battles in the Warhammer 40,000 universe, whose table-top wargame is probably Games Workshop's most widely known offering.  I don't know much about the history of naval type war games, but I get a strong sense from BG that there is a lot of influence from past games going on.

In BG, you must always move your ships (unless a ship is under special orders that involve some tradeoffs) because of the huge amount of momentum they have.  This forces play to be dynamic and constantly changing.  Ships also are harder to hit from the front and ever harder to hit from the rear, so positioning is a vital component of the game.

By forcing the player to always move their ships, the game is forcing you to make tactical decisions every turn which it rewards you with by making ships have a varying degree of difficulty to attack based on relative position.

Mechanics: forcing the player to move, variable armor based on relative position
Resultant Behavior: fast-paced and tactical play

Monday, January 16, 2012

Galactic Civilizations II: Role Reversal

I'll begin the discussion of the writing in Galactic Civilizations II with two factions that are seminal in the development of the immediate background of the game's universe: the Drengin (DREN-jin) and the Arcean (AR-seen). factions that begin the back story, at least on the wiki.  I am no expert on structure or writing, but I am not half bad, and analyzing the bad is a fantastic why to learn what makes something good.

Drengin

Ostensibly, the Drengin are a cruel and deceitful empire.  They are said to be both incredibly evil and clever at the same time.  Their society is supported via the use of 'slavelings', and they are keen to use other species as such.  Even their technology is researched by slaves.  They are often characterized as 'clever' in their evil plots.

Comparable Species: Cardassians

Arcean

The Arcean are basically drawn as a foil to the Drengin; they are of a similarly warlike stock, but are more honorable warriors of tradition and galantry instead of warmongering overlords.  The flavor text describes them as being "[not] evil, they just don't care".  That is fairly vague in terms of their actual values, so I will assume that it means that they just act based on an alien morality, with an emphasis on honor and power.  They want to control the galaxy and seem to think they are the perfect species to do it.

Comparable Species: Klingons

The Arceno-Drengi War

Eons ago, the Drengin and Arcean came to blows; unsurprising since they both have a desire to be galactic conquerors.  Together they constructed the first stargates, some 300,000 yaers ago, but the devious Drengin decided to start a war with literally the only other superpower they knew of in the galaxy.  In 98,000 B.C.E..

The Arcean, being ready for them, deactivated the stargate on their end in the middle of the Drengin fleet's traversal, stranding them halfway to the Arcean homeworld.  The Arcean then destroyed the invasion fleet, and the two species went their separate ways.

The Drengin Enslave the Tori

In an unexplained manner the Drengin locate the fledgling Tori species; semi-aquatic and peace-loving.  They construct a stargate and send it hurtling through space towards Toria.  70,000 years later the stargate arrives and the Drengin swarm through it, conquering the Tori easily.  Some 26,000 years later, the Tori realize that maintaining a strangle hold on Toria through a stargate is expensive and that the Drengin must be over extended, and a surprise attack manages to kick the Drengin out of Tori space.

The Arcean Attempt to Trick Humanity, Screw up the Galaxy Instead

The Arcean run into the Altarians at some point, but the relationship becomes one of mutual respect, or mentorship.  Eventually the Arcean come across the Sol system, and send Humanity the plans for a stargate of their own.  Of course, with their eyes on conquering the budding race instead of allying with them, the Arcean's plans have no method to turn off the gate once activated.

Humanity does not notice this detail, and instead focuses on the physics and technology implied by the design.  Since they have already developed fully functional nuclear fusion, they are in a position to make the spatial warping mechanisms of the stargate into a portable device.  They do so, and construct the first Hyperdrive.  They quickly disseminate the design to the entire galaxy, effectively creating an arms race of colonization and military buildup.

Interstellar Travel: It Can't Work That Way

There is a huge problem of timescale, here.  In 298,000 B.C.E., the Arcean and Drengin make contact and design the first stargates.  That figure is taken from the fact that the Arcean and Drengin meet before Homo Sapiens walked the earth plus a hundred thousand years.  200,000 years later, in about 98,000 B.C.E., the Drengin start a war with the Arcean which ends badly for the Drengin.

When the two part ways, things start to get very odd indeed.  The Drengin discover the Tori; since there is no stargate to Toria, they must have found it via exploration.  It was by unmanned probe, and it occurred some 100,000 years ago.  70,000 years later the stargate arrives and Toria is enslaved.

Arcean and Drengin: Problems

The major issue here is that the Drengin have never demonstrated any cleverness and the Arcean are not shown to be the stubborn, honor and tradition bound race they are supposed to be.  Their dispositions as presented are quite the opposite.

The Drengin attempt to invade a far flung star system by simply sending it a complete stargate, which is slow and error prone and certainly not clever.  The Arcean take the sneaky approach and send only the plans, allowing the target to work themselves half to death to build a device that will spell their own doom.  Drengin come off as arrogant and brutish, while the Arcean have a candid and diplomatic approach.  The Drengin have crappy diplomacy, which no clever race would have.  It must also be mentioned that the write ups for the unique Arcean techs characterize Human engineering as not being clever enough.

Then we have the problems of distance and travel time.  We know that a stargate allows travel at 0.165 light years a week.  This is a fudgey measurement since it is adjusted for the warping of spacetime (yay plot devices).  That means that one year in a stargate journey translates to 8.58 light years.  We know that Arcean space and Drengin space are one year in a stargate separate from the Artificial Gravity tech flavor text, and that is likely between homesystems.  Problem is, when the Arcean deactivated the stargate on their end, the Drengin fleet were trapped thousands of light years away from home.  Even if adjusted parsecs are for the benefit of the star map and reperesent a full 3.26 lightyears in unwarped space, that still leaves Drengi and Arcea only 169 lightyears apart.

What's worse, the Arcean Empire manages to not only trap the Drengin fleet in the middle of nowhere, they get out to that fleet and crush it in a timely manner.  Quite a feet for a species who has a stated penalty to interstellar travel.  And if a Stargate can be deactivated in the middle of a journey safely, why are they still only point-to-point devices?  Seems like a cleverly designed network of gates would allow you to travel to most important system fairly quickly if you can turn the gate off in the middle of a journey.

So after that debacle, which among other things implies that the Drengin never arrived in the Arcean systems even though that same tech flavor text insists that they did, the Arcean never open their stargate to Drengi again.

So what?  The Drengin immediately after their defeat find the Torians and send a Stargate their way, fully constructed, and wait 70,000 years for it to arrive at Toria, a figure the Drengin are more than willing to accept.  That means that the Drengin would only have to travel at a speed of 765 kilometers per second to reach Arcea in the same amount of time in the worst case scenario of distance.  That's only about 50% more than the escape velocity of our solar system.  If the Drengin are so patient, and have the resources to build a stargate only to send it off to invade a planet in several millenia, why didn't they just attack the Arcean Empire again?

In all of this, no mention is made of exactly, or even vaguely, how interstellar communications work.  They seem to be instantaneous, though space travel is not.  And that brings up another issue.  The Arcean find Earth and send plans to a stargate through their remote probe.  How long did all of that take?

Well, when the humans recieve the plans, they invent Hyperdrive and give it to everyone.  By that time, the Torians have long been independent, so it has to be more than say, 140,000 years as the Drengin had to discover the Torians and that would take at least 70,000 years.  We also know that traveling via the stargate to Arcea from Earth will take 10 years, so the two are separated by 86 ly or 1695 ly.  Now, assuming the Arcean home system is similar to Sol and the probe is somehow able, after a very long journey, to manuver for orbital insertion into Earth's gravity, and with the benefit of instantaneous communications, but with finite fuel supplies and conventional propulsion, it'd be traveling at maybe 525 km/s (the escape velocity from our solar system relative to the Milky Way).  If we stick to adjusted parsecs being full parsecs in unwarped space, then it would take the Arean probe 1.02 million years to get to Earth.

In context, 1.02 million years ago was just after the extinction of Homo Erectus.  In the GalCivII backstory, its about the length of time it took Humanity in a very recognizable form to invent Hyperdrive.  It also means that between the time of the expulsion of the Drengin from the Torian systems and the time of the game, 860,000 years had past.

I'm not sure this makes any sense.  Are we supposed to believe that a mortal alien species can afford to wait a million years to interact with another species and still be interested in conquering them?  Or even 70,000 years?  And what were they doing that whole time? If Humanity managed to discover and perfect fusion technology in perhaps half of the time the other important species have been around, why didn't those species figure it out themselves?.  It seems highly impossible that a space-fairing race would spend that much time hanging around, waiting for probes to report, and not once become curious about how stars make energy and at least attempt to replicate it experimentally.  And no argument of a lack of curiosity is valid, since the Arcean have space probes that work thousands of light years away and over millions of years.  They are guilty of curiosity by association with such exploratory devices.

On top of that, these races had become accustomed to plotting things on a geologic time scale, and suddenly, with the power of  Hyperdrive, they become capable, and very eager, to develop at a more Human pace.  They even reproduce at a competitive rate, which is odd since the Humans live on such a hastier time scale it would be reasonable to assume that they could out-reproduce the other races.

Finally, we need ask how exactly the Drengin and Arcean fought battles in space without having any space weapons.  You need to research these weapons in the game, so how the Arcean fleet wiped out the Drengin fleet in deep space is a serious question.  Since energy production is the primary stumbling block in the game's narrative, one would assume missile weaponswould be the standard arms until the power needed to run rail guns and energy weapons was available, but we do not see this and the game's AI actually has a tendency to avoid missile technologies.

Sunday, January 15, 2012

Galactic Civilizations II

GalCiv II.  If you aren't familiar, GalCiv II is a turn-based strategy game by Stardock, released in 2006.  It's gotten Editor's Choice, top notch reviews, best Strategy Game, and that's just the awards listed on the Wikipedia page.

But really, it's a great game.  Its awesome, actually.  If you haven't played it, well, then you should probably just go buy the gold or platinum or other precious metal edition.  While its downloading, I'll mention that the shear number of options you have is mind-boggling; this game was made for serious strategy fans by serious strategy fans.  A friend of mine says it is "deep".  There are two written play-throughs that are simply a joy to read ( here and here ), and give you a taste of what you can do and some of the brilliance of the AI players.

But what a more casual gamer might not realize is that GalCiv II: Twilight of the Arnor (TA), the final expansion, is broken.  Okay, this game is pretty 'old' by now, and given some of the stuff I've found to help  in poking around in data files, I doubt that it is really news to anyone who has cracked the hood of the game or paid attention to the patches.

I certainly did not realize how far the rabbit hole of broken it went.  I got the game freshman year, back when it had no expansions.  That game was compelling and very fun, and very, very, very hard (for me, anyway, but that is a different story).  I always end up at least pondering modding any PC game I have; its in this programmer's blood.  And though I wasn't a very skilled programmer yet, looking at the data files of GalCiv II, I realized that something was wrong.  Nowadays, I call that feeling the 'stink' of bad code.

You can tell when code is bad by the data files that support the program and the type of bugs that are discovered.  For instance, in Maya3D, you can crash the application by entering a negative number of subdivisions in the Subdivision Surface modifier's dialog box.  If you know anything about how Maya was stitched together, you know that the front end is mostly a collection of scripts that get interpreted by the Maya kernel, where all the sexy stuff happens.  Thus, this crash is completely avoidable and, in a word, stupid.  No one thought to validate the field values before sending it off to the kernel, and since you're converting one type of geometry into another, the kernel eats that negative value and one can only assume it goes straight into the subdivision algorithm code and the whole program crashes somewhere between starting to generate the new geometry and displaying it.

That code smells.  It smells like dead animals.  You know its stupid and that only unclear thinking went into the system, idea and feature tacked on, one after another, with little control or overall vision.  With that in mind, I will present something from GalCiv II completely out of context:



        <Weapons ID="Beam Weapon theory">
            <Category>Trade</Category>
            <Cost>50</Cost>
            <Group>None</Group>
            <Alignment>None</Alignment>
            <WillingnessToTrade>80</WillingnessToTrade>
        </Weapons>



This is a snippet from one of the tech tree files in TA, specifically from the Iconian faction.  Notice anything odd?  Like, a Beam Weapon technology being categorized as Trade?

The categories of techs are used by the AI to aide in prioritizing research; they have nothing to do with the visual presentation of technologies (that's the Group).  The tech trees are littered with these sorts of things; if you want all the information on the tech trees and many other tidbits of "WTF?!", you can read this discussion on the GalCivII forums.  I had no part if uncovering this quagmire, mind you.  Those guys are the detectives, not me.

In short: miss-categorization of  techs in TA makes the AIs in the game act like morons.  They don't research their unique technologies, they don't get very far, they hit roadblocks before getting to the techs that they need to even contend for dominance.  Two of the AI personalities are broken, some tech-trees are basically engineered to thwart attempts by the computer to play well, and to top it all off, the AI is incapable of using spore ships or terror stars.  It just won't.  And those are big elements of the things TA provides.

It's getting late, so I'm going to turn in for bed.  Tolmekian, MarvinTosh, and qrtxian did the work on the techs structure, and next time I hope to get into the badness that is the writing in GalCivII.

P.S. GalCivII, like so many other fantastic, buggy, glitchy, sometimes horridly designed games before it, is still one of my favorites.  I love the Stardock guys for doing this game, and I speak so disparagingly of the guts because it warrants lamentation.  It is still a great game even with so many problems by the time TA was released.  I hope the Stardock guys don't hate me.