Tuesday, 24 June 2014


Some things are impossible.

That shouldn't be controversial, but our culture is filled with messages that go against it. Nothing is impossible, you can do whatever your dream, don't give up, just try harder, believe that you can, have faith. Our fiction/mythology is full of people overcoming difficult odds - and impossible is just a harder kind of difficult, even more admirable to inevitably overcome.

And like, that's sometimes a good attitude to have, we've accomplished a bunch of stuff by being persistent and obstinate. "Try harder" can be pretty good advice. But sometimes things that look impossible really are. And if you're attempting something impossible, giving up isn't defeatism - it's the rational thing to do.
(IMPORTANT NOTE: even when something is technically possible, "try harder" can still be bad advice. We know about burnout and depression from working too hard, we know working "crunch time" damages people. Plus it's generally awful to tell someone to work harder from a position of privilege when they're facing obstacles you don't even know OKAY.)

Impossibility is beautiful, because it's so much bigger than possibility. Finding a solution to a problem is a small thing, you can just show it to me. But to claim that there is no solution, that no solution will ever exist, no solution can ever exist, that no amount of ingenuity and effort will solve it - that's enormous.

OKAY what does a genuine impossibility look like?
Guess I'll point you to some classics http://en.wikipedia.org/wiki/Seven_Bridges_of_K%C3%B6nigsberg, http://en.wikipedia.org/wiki/Square_root_of_2, http://en.wikipedia.org/wiki/Squaring_the_circle, http://en.wikipedia.org/wiki/Angle_trisection, you probably know about these already whatever. In general this is something that mathematics does, proving things impossible. And then because humans are bad at accepting impossibilities we still get amateur mathematicians (less charitably, "cranks") trying to square circles and trisect angles because hey the establishment thinks it's impossible but maybe if I just try really hard I'll find something they missed, never mind that it would take a lot less time to verify the proof.

Importantly, these claims are definite but conditional; they say "this is impossible with the methods of Euclidean geometry" or whatever but with different tools you can do the thing. You can't write this as a fraction but sure you can write it some other way, maybe you can build another bridge or a teleporter idk. That doesn't diminish their beauty - like there are infinitely many constructions you can do in geometry and to be able with just a finite amount of work to show none of them square a circle is pretty rad. But yeah it's a thing, the only way we get to be 100% confident that something is true is by tying it down with enough qualifiers. Mathematics is fairly special because we do have those qualifiers, most places we don't and so we can't unambiguously prove impossibilities. Science operates by inventing mathematical models and experimenting to test them against reality - we can prove impossibilities in the model but never be certain whether the world follows the same rules. So while actual definite impossibility exists and is beautiful, it is something alien, we mostly live in an ambiguous world of uncertainty. (Which is not to say things aren't impossible, just we don't get to know for sure.)

Okay this is a blog about games right.

Now games are often power fantasies. Everything in them was placed for us to play with: here's a ledge, you can jump to it / a door, you can open it. Everything you see is possible, it's there for you. If there's a door that's just scenery and can't be opened, that's a failure of the game - and players complain like anything. The "perfect" game is imagined as a wide open space in which anything is possible, that never tells players what they can't do.

Which is fine i guess. But games also have the scope to let things be impossible. They're self-contained systems with fixed rules we can know; so we can prove impossibilities. And I said that's beautiful so okay let's, how?

(Note that the process of creating complex software can obscure what the rules actually are, we can end up with unintended rules - bugs, glitches, exploits. So as @flantz often points out, players end up doing actual science in experimenting to discover the laws of the toy universe, rather than the mathematics of knowing the rules and deducing their implications. In a videogame, the actual rules are what's written on the software, not what the designer or the player had in their head. Board games though, the rules run in the player's minds so they literally are exactly what you think, it's pure mathematics.)

(Lots of videogames do let things be impossible FOR NOW. The metroid thing of areas being inaccessible until you've acquired a new ability. Decent compromise I guess.)

With puzzles, what I usually see people do first is just push buttons, try to solve them without having to think. A good puzzle takes a long time to solve that way but is quickly solved once you think of the right idea, to make you give up and switch your brain on. But if it takes too long to think of the idea you'll just start going through a list of all possibilities, which isn't interesting either.
Now what if it's actually impossible? It can't be solved by button-mashing, you're wasting your time. If the state-space is finite then it can be solved (proven impossible) by exhaustive search, but very slowly - if infinite it can't. A good impossible puzzle would require a long time to be confident it can't be solved by trial and error while being quickly proven impossible once you think of the right idea.

Okay I don't really like puzzles in general and this kind of thinking might lead to things I like more? Looking at a puzzle and not knowing whether it's even solvable, and thus which approach to take, kind of a delicious uncertainty. Trying all possible moves to rule them out is super boring though just as much as trying them all to find the right ones, so that really has to be avoided. But the classic "prove or find a counterexample" topology exam questions are the best so.

Vertex Dispenser was my attempt to put an idea from mathematics into a game somehow more interesting than just make a puzzle like everyone else does. It's this dense knot of ideas, the space you move through in an action game is also the territory you command in a strategy game is also the graph you colour in a puzzle game which feeds resource management for abilities in the action game / the negative space protects the positive and everything's connected. Too weird. Anyway I ended up putting in a bunch of conventional puzzle levels too, I wanted the last one of those to be impossible but was convinced not to. What I did instead was have the level be a collection of ten separate puzzles which you have to solve half of, the rest being impossible - so you have to recognise which ones are possible and solve them while not wasting time on the others.

Maybe that wasn't a good example but here's this idea of recognition. Actually formally proving something is a specialised skill most people lack (it's not scary but it's not instinctive), I'd love to see a game that teaches this but I don't know if you can do it in an interesting way without just being maths, also to verify proofs in software tends to require input in a way that's way less intuitive than what mathematicians usually do so yeah it'll be hard to make a good game out of that (someone do it please). But just requiring recognising impossible situations without proof is still pretty interesting, usually how this works is you find some invariant feature that the allowed moves can't change (parity's a common one), recognition doesn't have the beauty of absolute certainty because a modified trial-and-error approach will still work if you're right most of the time but hey compromise.

Corrypt was getting into this kind of area too - it starts solvable but you can enter unsolvable states and then you have to recognise them and undo, preferably without wasting time on

Wednesday, 11 June 2014

868-HACK prog costs

Hello I felt like writing something about tuning the costs of the 868-HACK abilities. This is maybe quite boring and nerdy and also it's like lots of words but you don't have to read it ok.

You can see some of the process by comparing the 7-day version 86856527 to the released version (yes it's only on iOS right now I'll do something about that soon) but there's lots of missing bits in between.

Okay the central activity in a roguelike is choosing between different resources to lose - a typical choice is whether to engage in melee (spending hp, risking death) or use an item/magic to avoid it. Classical roguelikes lack many choices about which resources to acquire, you just take what you find and figure out how to use it, but 868-HACK also has the "data siphon" tool giving frequent acquisition choices. I put two currencies (credits and energy) so there'd be a choice of which of those to acquire, but you're also trading those off against abilities and points. (In the original concept energy was for using abilities and credits were for spending between rounds to gain abilities, but it was cleaner to collapse that into siphoning and so the choice just became which abilities to spend them on.)

So okay there were a whole bunch of abilities (the game calls them progs, I'll call them progs now too since it's shorter though a little pompous) and they needed prices, and this is kind of too big a problem. The possibility space is just too large to think about: each prog has a 2d currency cost and also you can change what they do and what they are, how many there are, how they interact. Also working with small numbers rules out cheap statistical effects like "+5% damage"; every small change makes a big difference. Balance is hard. But there's no right answer, probably lots will do fine they'll just be different games.

I started by trying to distinguish the two currencies with a conversion prog (.EXCH) going one way but not the other (credits to energy). Initially gave you 3 for 4, a slightly unfavourable exchange rate, because I thought it should cost something to use to make you think about whether it was worth it. (Could have had a second one in the other direction at a different ratio - 2 for 3? - but also such a direct resource conversion isn't interesting to have very much of, just a little is good.) Eventually it became clear that it was usually a bad choice and it wouldn't hurt to push it up to 4 for 4. I realised there's still a cost to it - the siphon spent and the risk taken acquiring the ability in the first place, and the constraint of having to do it in blocks of 4 (consider: a 100/100 exchange would never be useful, even though it's the same ratio).

This imbalance between the two currencies helped guide later decisions. Because you have the possibility to turn credits into energy you can more likely avoid running out of energy - energy is more reliable, you can sink it into using a prog over and over again, so this determines the types of progs that should use it. If something's main utility is using it several times to set up a combo or get control of a bad situation (.PUSH, .PULL, .STEP) then it should cost energy; if it is interesting to use sparingly with precision after some setup (.DEBUG, .D_BOM, .CRASH) then it costs credits. (Of course you might like to use some of these latter progs with reckless abandon, but they're still valuable when you can't, so.) There ended up being slightly more progs costing credits than energy, which aligns with the idea that energy progs are each used more often (and means there's sometimes pressure to actually find something to spend that energy on).

Having a limited number of enemy types with specific counters was part of the initial concept. I expected to have multiple subtypes within those - several varieties of virus all affected by .ANTI_V or whatever - but keeping it focused with just one of each turned out really well. Started with a counter to each type all at the same price - .ANTI_V, .KIL_D (now D_BOM), .DEBUG, .DCRPT (now .SHOW) all at $$$, and these didn't change drastically. They're in the same currency to force a choice between them: you can't deal with every type at once.

The general pattern that started to come through was: credits for damage, energy for movement/evasion. Not everything fits that pattern but keeping it in mind made many other decisions easier - e.g. .WARP both attacks something and moves something so it costs an even mix, .REDUC and .DELAY are similar in that both make enemy spawns easier to deal with, but .REDUC's cost is weighted towards credits because it prevents enemies outright (pre-destroying them) while .DELAY just holds them at bay in a weakened state. Even though the currencies have different values, I treated it as meaningful for pairs like this to have mirrored costs ($$% and $%%) because it helped simplify the decision of where to put them (other such pairs are .WAIT/.UNDO, .ROW/.COL).

Originally .ROW and .COL only did 1 damage and cost $$% and $%%, and were quite a bit more tactically interesting to use than they are now but so efficient they completely overshadowed the other attack progs (especially since they don't depend on enemy type). I couldn't find a completely satisfactory fix; there wasn't room to weaken the effect and putting up the cost by 1 was enough to leave them pretty underpowered. What I ended up doing seems balanced (which is counterintuitive - an effect is too strong at cost 3 but double the effect is fine at 4? non-linearity, having the effect twice in one go is nowhere near as valuable as having it twice at carefully selected moments) but isn't as fun to play with - but balance makes the game better overall; conservation of fun. .COL costing mainly energy clashes a little with the principle of damage mostly costing credits so to compensate I pushed up the alert cost to 5 (vs .ROW's 4): breaking a pattern merits a higher cost.

.RESET explicitly converts energy to hp, but its efficiency varies situationally: it restores you to 3 so ideally you'd use it when on 1 to maximise the effect, but sometimes you must do it on 2 when you can't avoid being hit twice next turn, or when you only need 1 because you'll restore 1 on leaving the level. Usually (ideally) it gives 1 hp for each 2 energy. Several other progs can be thought of as converting currencies to hp - at different ratios under certain conditions, so how much 1 hp is worth is pretty variable. If there's an enemy one space away from you diagonally so you can't move without being hit, then .WAIT gives 1 hp for just 1 energy (by preventing subtraction rather than by adding). With .PUSH you can very often get a bit more than 1 hp for 2 energy (avoid a hit from a nearby enemy while inconveniencing other enemies). Occasionally you need to use $$$ for 1 hp (with .ANTI-V /.DEBUG/.D_BOM) but usually these can get you quite a lot more. So I think .RESET's 1 hp = 2 energy is kind of a bad deal, but it has reliability in its favour; to emphasise this I put the alert cost really low making it safe and accessible for beginners.

Some thought went into the order in which progs unlock. The initial set has no mixed costs; they're slightly more complex to use (they clash with everything, can't be used if either currency is exhausted), and it seemed like it might make the unlocks feel a bit more special by setting up a pattern then breaking it. Also all the attacks that are independent of enemy type have mixed cost (to compensate for them being more reliable), so this meant the initial set forces you to pay special attention to enemy types which might help with learning their behaviours. When you unlock a new prog you start the next game with it, giving an opportunity to try it out straight away - which meant .SCORE had to be in the initial set because starting with it would give a huge score advantage (some of the others are a bit of a concern too but that's the worst). A side-effect of that though is it's maybe easier to score before you've unlocked everything because .SCORE shows up more reliably, this is hopefully somewhat compensated for by not having .SIPH+. In general the game gets harder as you unlock more stuff; there are some stronger abilities but you're less likely to find something that combines well. I tried to keep the balance of credits/energy fairly even at each stage of unlocking, also tried to leave gaps and then fill them later so someone might have time to wonder what something might be before unlocking it, or when something obvious was coming; no idea if this worked at all.
(For reference, initial set is .WAIT, .SHOW, .PUSH, .STEP, .ANTI-V, .DEBUG, .D_BOM, .RESET, .EXCH, .SCORE and unlock order is .WARP, .POLY, .ROW, .DELAY, .UNDO, .ATK+, .PULL, .CRASH, .COL, .CALM, .REDUC, .HACK, .SIPH+)

  • Start by fixing some initial values to base things off (which could change later if needed).
  • Invent principles of symmetry to guide the rest. Symmetry is good because it cuts out a whole bunch of possibilities and also it might have some aesthetic value maybe?
  • Tools to convert between different resources are maybe interesting, but better if they vary situationally rather than just having a set exchange rate, and better the weirder the resources themselves are.
  • Be aware of non-linearity; don't assume the meaning of numbers scales in an intuitive way. It might be more than twice as hard to pay 6 as 3, doubling an effect shouldn't necessarily double its cost, etc.
  • Be aware of different types of cost - unreliability, difficulty of acquisition, opportunity costs - as well as the explicit numeric resources.
  • Breaking a pattern merits a higher cost.
  • The whole is more important than its component parts. Be comfortable making a component worse if it's better for the whole.
  • there's no perfect
  • What is balance anyway idk