Wednesday, 28 April 2010

Damage scale

In the course of designing a pen and paper RPG (ongoing for a few years now), I have sketched out the following damage scale:

1 A blow capable of temporarily incapacitating; a solid punch to the jaw or floating ribs, a gunshot wound (any location), a solid blow to any limb or the body from a melee weapon; first degree burns; tear gas
2 A blow rendering unconsciousness or blood loss causing unconsciousness; either a gunshot wound to the head (nonfatal) or a solid blow to the head from a melee weapon; strangulation (2 minutes); second degree burns; nonfatal exposure to chemical weapons
3 A fatal blow or blood loss resulting in death; or strangulation (10+ minutes); third degree burns; nerve gas
4 A fatal blow which severs the head or cuts the torso in half; fire or acid which chars the flesh of a corpse leaving no skin or hair
5 Repeated blows or explosives which reduces the body to lumps of flesh; this level of damage could be caused by an enraged mob to a helpless individual over the course of 10 or 15 minutes; fire or acid capable of consuming flesh but not destroying the bone
6 Mincer or grinder which reduces the body to a flesh paste; or in the path of detonation of a shaped charge; fire hot enough to reduces the body to ash or acid to dissolve it to soupy remnants
7 Thermonuclear explosion; chemical processing of body using for example concentrated acid; or specialized equipment capable of evaporating flesh
8 Disassembly by nanoscale machinery; exposure to surface of the sun
9 Disassembly to atomic components; exposure to core of a neutron star
10 Exposure to singularity; exotic methods of reducing to component quarks or strings

Care to guess what the game is about?

Monday, 12 April 2010

Roguelike poetry

Given the game is a collection of letters, I would have expected (never)more...

Sunday, 11 April 2010

Data design for Civilisation games

I seem to have Civilisation on the brain at the moment; and with the recent 0.6.4 release of Unangband out the door have been spending some time looking at the Freeciv project. If you're looking for roguelike game design, you might want to stick around though, because I'm going to be discussing data file design in some detail.

Freeciv is a Civilisation clone, written originally as an exercise in client server programming (There's a nice history summary at the bottom of this AI discussion). Its implementation of the various Civilisation games falls somewhere between Civilisation 1 & 2 as Alex Mayfield points out the last time I mentioned my Civilisation Revolution house rules. Luckily for me, much of the unit design is very similar to Civilisation Revolution so it seems quite possible that I may be able to get away with limited amounts of source code changes.

The mod system that Freeciv uses is quite similar to the Angband edit file system - with the exception of the format which is seems influenced by the Windows .ini file format. A mod in Freeciv consists of a number of rulesets which are used to initialize data structures with values and flags which impact the game play for that unit. A typical Freeciv unit may have the following format in the units.ruleset file:

[unit_warriors]
name = _("Warriors")
class = "Land"
tech_req = "None"
obsolete_by = "Pikemen"
graphic = "u.warriors"
graphic_alt = "-"
sound_move = "m_warriors"
sound_move_alt = "m_generic"
sound_fight = "f_warriors"
sound_fight_alt = "f_generic"
build_cost = 10
pop_cost = 0
attack = 1
defense = 1
hitpoints = 10
firepower = 1
move_rate = 1
vision_radius_sq = 2
transport_cap = 0
fuel = 0
uk_happy = 1
uk_shield = 1
uk_food = 0
uk_gold = 0
flags = ""
roles = "DefendOk", "FirstBuild"
helptext = _("\
This unit may be built from the start of the game. It is the\
weakest unit.\
")
Contrast this with an Unangband monster entry, and you'll see there is not a lot of difference, other than the format which defines how the values are read in:
N:24:Small goblin
G:k:y
I:110:8:20:16:10
W:2:1:0:4
M:0:0:1:0
B:HIT:HURT:1d5
F:DROP_60 |
F:OPEN_DOOR |
F:ORC | EVIL | IM_POIS |
F:HAS_SKULL | HAS_SKELETON | HAS_TEETH | HAS_CORPSE | HAS_HEAD | HAS_HAND |
F:HAS_ARM | HAS_LEG | HAS_BLOOD | DROP_MISSILE | DROP_TOOL | DROP_WEAPON |
F:DROP_CLOTHES | DROP_ARMOR | DROP_FOOD | DROP_JUNK |
F:SCENT | DWARF |
D:It is a squat and ugly humanoid figure.
One initial observation is the Unangband file format encodes a lot more information in much less space. We could reduce the total length of the Freeciv warriors entry to about half the current length by adopting a similar context-dependent format, as opposed to the more context-free format that Freeciv uses. We know every Freeciv unit has to have an attack/defense/move/vision/firepower and upkeep values, so there is no need to have each of these defined on a separate line: and the user interface itself can be used as a guide for how we can lay out the values more compactly in the ruleset file format.

This may not sound especially important, but from the perspective of quickly editting multiple entries - for someone trying to mod the game - screen real estate is a valuable commodity.

The second observation is that the Roles in the warriors unit in Freeciv are not intuitive, in the same way the Unangband flags are. You can guess straight away from looking at the goblin entry the ways that HAS_HAND and DROP_WEAPON might be used in the game. DefendOK may make sense, but FirstBuild? In some ways, this may be an issue with the fact we're dealing with an agglomeration of multiple individuals rather than a single entity, but it is worth bearing in mind that defined roles (and flags) may not 'natural' and may be worth redesigning.

There is a significant difference between the way roguelikes and Civilisation games play that is not reflected correctly in the similarity between the two file formats. Roguelikes rely on your ability to learn and understand special abilities and unique effects and which one to use at any point in time. The fact that small goblins are immune to poison makes a significant difference only if you are facing a small goblin, and have a choice between a poisonous and non-poisonous attack. So a binary flag is an appropriate way to reflect the criticality of this decision.

Civilisation games on the other hand, rely on the aggregation of small differences over a large number of units, and so scalar values are much more important than binary flags. The fact that a warrior can defend a city is much less important than the attack and defense values of that warrior: a difference of only 1 in attack strength is the difference between success and failure of a particular combat, but that combat may be played out multiple times in a single game, which converges towards an average result in a way that a roguelike does not. If you want to think about it another way, most roguelikes allow you to reset to your starting position of full health at any point during the game with a single item - Civilisation games don't allow you to reset to your full complement of warrior untis.

So while the Freeciv file format is undoubtedly a natural evolution from moving hard-coded game data to an external file the same way that Angband does, I believe there is significantly more value to be gained by extending the file format of Civilisation in interesting ways.

If you look at my Civilisation house rules, you'll see a lot of rules of the format 'with technology/civic/building', unit X gets Y, where Y is often a modification to an existing scalar value of some kind. Or more importantly, the set of units of type Z get this change, where Z could be all units, mounted units, pre-gunpowder units and so on. It would be extremely useful and flexible if we could encode this into the Freeciv ruleset without having to have flags refer to hard coded bonuses in the game code.

There's a couple of ways of considering how to do this. We could go with a full blown scripting model, where each unit runs a script to determine which modifiers apply to it's basic values, and the avaible technologies, civics, buildings and so on are exposed to the script system to check. However, I'm uncomfortable with a full scripting system, and I think we can do this in a simpler fashion.

Imagine a unit as a collection of scalar values and properties. Some properties are intrinsic to the unit ('on-foot'), some properties are dependent on the civilisation ('the-wheel-technology', 'democracy-government'), some are global ('nuclear-winter','global-warming') and some are positional ('attacking-city', 'defending-forest') or modal ('fortified'). A unit type then defines a set of rules where the unit having the matching property modifies either a scalar value through setting the value, addition, multiplication or scaled by percentage, or through the addition or removal of a property for that unit. We can use properties to also indicate that the unit is a member of another unit type, which also has a set of rules which further define the unit and so on.

We can then determine the unit scalar values by starting with the base unit type, and matching rules from that unit type and the rules from its properties, applying the effects of each rule exactly once.

For instance, one unit type might be as follows:

military-unit = {
can-attack;
can-defend;
fundamentalism-government:+1 attack;
...
}

We can also evaluate scalar values instead of properties.

military-unit = {
...
experience>=3:veteran;
veteran:+50% attack;
veteran: +50% defence;
...
}

One important extension to this is that the units have to be able to affect other unit types. For instance, aircraft cannot be attacked by ground units.

aircraft = {
*ground-unit:-can-attack;
...
}

And we have to be able to override this:

anti-aircraft =
{
*aircraft:ignore;
...
}

where ignore is a reserved value that prevents the associated property from being processed.

I'm still in the early days of sketching this out, but I hope this will be an improvement on the existing Freeciv rulesets. The implementation of this design will, of course, be another complication.

My question for you is whether I'm reinventing the wheel here? I believe this is a design pattern that multiple games must have confronted before, and there should be something that already does this work for me, short of going to a full scripting system like Lua.

Saturday, 10 April 2010

Request for donations for Angband site hosting

Takkaria is asking for contributions towards hosting the official Angband site:

Server hosting for rephial.org currently costs $38/month, which is a quite a bit of money. We started off on a lower-price plan but we received enough in donations to switch to a higher one for a while, which has made using the bugtracker much more bearable. Now we've run out of funds from the previous drive, so we're looking for more donations to keep things running as they are.

There's no pressure to, but if you would like to contribute to Angband development monetarily then please do at
http://rephial.org/donate. If you want to remain anonymous, that's fine by me, but I like to publish people's names to recognise their contribution.
I'd like a non-Paypal donation method if possible, as I'm unable to access Paypal and have been unable to for years.

Monday, 5 April 2010

Unangband 0.6.4 released

This is the "Once your variant gets a nowhere town, it will never leave" release aka "Wasn't this supposed to be out months ago?"

You can download the source code from http://prdownload.berlios.de/unangband/unangband-064-src.zip. You can download a precompiled Windows build from http://prdownload.berlios.de/unangband/unangband-064-win.zip, a pre-compiled Mac OS/X build from http://prdownload.berlios.de/unangband/Unangband-0.6.4-osx.dmg. A Linux version should be following shortly. [Edit: Now available at http://prdownload.berlios.de/unangband/unangband-064.tar.gz - thanks to Mike].

For more details, please see the official website.

I've not spent nearly enough time quashing bugs, but real life has left me pretty drained at the end of the working day. I'm sure my motivation levels will pick up soon enough - just need a little holiday from staring at the source code.

Sunday, 4 April 2010

One Man, One Vote

For anyone who's up for Civilisation Revolution challenge games, may I suggest the following: No Democracy challenge, playing on Diety. The only restriction is you may not use the Democracy civic - Greeks have to change away from that Civic on their first turn.

The game suddenly becomes a whole lot more balanced and interesting, as I suspected.

Saturday, 3 April 2010

Re: Engineering

I've came up with suggestions some time ago about what alternate weapons the Team Fortress 2 Engineer should have. But since then, Valve have released several subsequent updates which have considerably changed how the Sniper, Soldier and especially the Demoman play and a beautiful crafted fan page has suggested some alternate turret weapons. And, in case you've missed it, the last major update to Team Fortress 2 added a chocolate bar for the Heavy and several melee weapons (One for the Pyro and one shared between the Demoman and Soldier).

So the scope is there for the Engineer to have more than a few additional items added: either as a part of the update, or in further releases.

Looking back at the suggestions I made: the Quik-R-Ratchet, or a variant thereof has already been tested in beta as the PDQ; the Scout order book suggestion existed at one point as a backpack but was not adopted; the I-Spy-Shooter is fine, but not amazing - and having played my first 35 point Spy game yesterday, I now feel qualified to state its hard enough already to sneak up on an engineer that I think there are better alternatives; and the BRB still feels distinct enough to be useful - perhaps also allowing the engineer to teleport even if his exit is sapped.

I'm still not convinced that the engineer needs alternate buildings - the only one from the fan page that feels 'right' is the multi-mode flying turret - and Valve themselves have pretty much ruled out replacing the teleporter or dispenser. Buildings that provide various buffs (kritz, minicrits, invulnerability) make the buffs that other classes provide less special, and similarly turrets that provide alternate attacks lessen the uniqueness of class weapons. And anything that affects the small window of opportunity between backstabbing an engineer and having the turret turn and shoot you while you try to sap it, is going to affect the balance of Spy vs Engineer encounters - which of the ways of taking out turret emplacements is the most interesting and least frustrating for the Engineer.

Here are some more Engineer item suggestions:

Gone Again Guitar: While playing the Gone Again, the engineer and all nearby friendly buildings become invisible and do not have any effect or attack enemy players. The Gone Again plays as a taunt animation for a fixed duration with a cooldown. Why: There needs to be a guitar based weapon for the Engineer, and something which allows the Engineer to build in an open location and then draw in the opposition should be fun. Especially since you'll be able to hear him play, but not know where he necessarily is. Replaces the Shotgun.

Ranch Home Rivetgun: The Rivetgun is a ranged weapon similar to the medic's primary weapon, but with a slower rate of fire, much smaller magazine capacity and more damage per shot (about 25% more DPS than the medic). However, the Rivetgun also repairs friendly buildings it hits - at approximately the same rate as hitting it with a wrench. Why: this allows the engineer to repair their buildings while not necessarily next to them - letting them roam with confidence. Since the repair depends on ammunition, it should be a shorter term improvement, and this is balanced against wrenching because the Rivetgun doesn't resupply buildings or remove saps. Replaces the Shotgun.

The Cowpoke: The Cowpoke is a crossbow with a barbwire drawstring and a red hot poker for a bolt. The Cowpoke has better range than the Sniper's bow, but does less damage, and has a much slower reload. Friendly turrets turn twice as quickly when tracking targets branded by the Cowpoke. The Cowpoke replaces the Shotgun. I had planned on making this a melee weapon but realized that a) hitting a building with a branding iron doesn't make a huge amount of sense and b) making this a ranged weapon encourages the engineer to run forward and tag upcoming targets. Note that this doesn't prevent a Spy from disguising or turning invisible - just when the Spy becomes a valid target they get tracked that much quicker.

Stand Tall Spurs: The stand tall spurs allow the Engineer to pick up and move his buildings. If the engineer is hit while moving a building, the building takes damage as well as the engineer. The Stand Tall Spurs replaces the Shotgun - left click to pick up, and then place the building using the original building placement commands. There is a short set up time when the building is placed again (2 seconds) before it comes fully active.

Well-done Arc Welder: The Well-done allows you to buff all nearby buildings temporarily which reduces damage to them by 50% for explosives and 25% for all other damage types, but means you take twice as long to upgrade your buildings. The buff lasts for 15 seconds with a 45 second cool down and appears to be a shower of sparks coming off the affected buildings. Why: an invulnerability buff is tempting, but would completely stop an ubercharge against a building in it's tracks. Whereas a buff may tempt both the attacker and defender to hang around. By biasing the damage reduction against explosives, it reduces the effectiveness of classes the most which don't have to expose them to direct line of fire of the turret to destroy it. Replaces the Wrench.

Good 'ol Grappling Hook: I've waxed lyrical about the next for a grappling hook in Team Fortress 2 long enough - hit a building or map section and you are pulled towards it, hit an enemy player and they are pulled towards you. This would completely unbalance the Engineer, allowing them to aggressively move forward and put turrets in unexpected locations, as well as drag an opponent into their turret's line of fire. I think the craziness would be worth it though - especially after the fun I had with the Demoman replacement weapons. To balance it: the grappling hook prevents you upgrading any building or speeding up construction because it replaces the Wrench. I'd hate to have to contend with a level 3 turret somewhere I hadn't planned on looking.

Thursday, 1 April 2010

4/1 = Fooled?

I'm writing this in advance, so I'm unsure of the reaction to my leading you down the garden path to a mythical land of CGI dwarves. I hope you've enjoyed the process - I certainly had fun putting the story together, weaving together fortunate coincidences with real world personalities and outrageous lies. If you've read this blog long enough, you should recognise my penchant for mixing reality and mythology: my personal highlights have been reviewing an alternate reality World of Goo and projecting Eve: Online into the near future - but any review I've written has launched from a sudden thought into faraway fantasy. As the Toady One put it when I ran the idea past him, it's been 'intense'.

One regret I've had with this blog has been I never remember April 1st early enough: should I do so in the future, there are some well planned sucker punches taking advantage of the fact Australia is 16 hours ahead of anywhere interesting. But I'll leave the details until another day.

I've always found the art of hoax an enjoyable and fascinating experience. The best hoax I've been swept along for the ride with is Peter Jackson's Forgotten Silver - an underrated docudrama which for a magical moment on a Sunday evening captured the hearts and minds of most New Zealanders. My mum pointed out the flaws first: there are few lost cities on the west coast of my homeland, an island which has been inhabited for all of 600 years, but even once you've figured out the plot, a good shaggy dog story should throw you enough in-jokes to keep propelling you forward. I didn't have a Colin McKenzie dying on camera to finish up with, but a mashup of Team Fortress 2 and Dwarf Fortress provided enough ideas to keep me moving to a semblance of a conclusion.

The typical reaction to falling for a hoax is outrage. I want you to put aside that emotion as much as you are capable of and celebrate another - imagination. If you fell for my story, it is because the seeds I planted fell on the cherished soil of fertile and optimistic dreamworld. This should be something you should be proud of. You have the capability to rise above the mundane and cynical, escape the clay around your boots and float away on boundless escapism. You are a gamer.

Dwarf Fortress 2 open beta coming soon (design notes - part eleven)

PS: Frender, I really miss you. BFF?

Dwarf Fortress 2 open beta coming soon (design notes - part ten)

I've got plenty more design notes, but I think you should just get over to the official announcement where you can register your interest.

Dwarf Fortress 2 open beta coming soon (design notes - part nine)

Everyone starts with the camera beard hat unlocked. You may have guessed that we're going with a steam punk theme, and there is nothing more steampunk than a camera beard hat. I'll say it slowly for you. Camera. Beard. Hat.

If you've linked to this announcement from Boing Boing, you may need to get some tissues now.