The best kittens, technology, and video games blog in the world.

Saturday, April 19, 2014

Fun and Balance minimod for EU4 1.5.1

Kawaii ne? by KayVee.INC from flickr (CC-NC-SA)
Here's just a slightly updated version of my Fun and Balance minimod.

  • all files updated to 1.5.1 version
  • non-accepted culture penalty scaled down from +5RR to +4RR (vanilla has +2RR). It was just a bit too much.
  • religious center missionary strength modifier down from -5% to -2%. That's a modifier Rome and Mecca got around 1.4 patch, I hate it, and I'm really tempted to just kill it completely, since it makes Rome close to impossible to convert even with very big stack of positive modifiers. Rome has such a high base tax (which only grows as game goes), and such a small and unlikely to be accepted culture, that it's very difficult to convert anyway, even without this penalty. Mecca has lower base tax, more common culture, but it's Sunni for an extra penalty, so it's also pretty hard to convert. Why either of them needs such extreme penalties to switch makes no sense.
Everything else worked sensibly, so I'm not introducing any major changes. Perhaps larger rebalancing will be due once 1.6 is out, we'll see.

Beeminding the unbeemindable

It's going to be pretty awesome a couple decades in the future when all this will just be common knowledge, but we're just starting all this and we all need to go through the process of discovery what works and what doesn't individually.

And we should definitely hold ourselves to a much higher standard than "doesn't suck any more than it would otherwise". It's a good thing I don't have that particular problem, for which I don't really have a good solution, and I'm perfectly aware how poor track record of all existing "solutions" is when they are put to actual rigorous trial.

Anyway, as I said before, things that have good beeminder goal and measure go well and quite reliably so for me, but everything else - well, sometimes it does, often it doesn't. And I have a huge number of extremely important projects I need to keep pushing forward, and many of them haven't been moving as much as I'd like. Of course I can take the nuclear option of just dropping everything and taking a few months off mo get things I want done, but it's a good idea to try a few less drastic courses of action first. And for that matter to make sure if I ever go all the way, it will be highly efficient use of my time.

Idea #1: Per-project measures. One way would be to setup twenty or whatever number of measures, one for each project, but that's a ridiculous overkill, especially on beeminder which doesn't work that amazingly for things that move forward less often than once a week. One sort of workable thing would be to setup tracking for top 3 projects, and for the rest, well, "it won't suck any more than it would otherwise". I never seriously attempted that, and even beeminder discourages having too many beeminder goals.

Idea #2: Tracking time. What I actually tried at first was getting pomodoro timer and counting time spent on any project on the projects list, with beeminder target. This was a miserable failure, since time has very little relationship with progress, and such system just assumes single-tasking and no interruptions - both things which are just completely incompatible with my reality. It was a miserable failure for me.

Idea #3: Track everything. For this I skipped beeminder, since I wanted tracking, not necessarily a target, at least not initially. Everything, on my lists or not, which changed state of the world in direction I wanted, got a +1. It was extremely broad definition on purpose, and I did it for a month with +163/day average. And things were sort of moving forward fast, just not the important things. I'd say it way not very successful, and I don't think adjusting point criteria or explicit target would make much difference.

Idea #4: Priority tasks. Finally I took the opposite approach, lowered all other beeminder targets by about 1/3 to make sure I have time for it, set up a very short list of extremely high priority tasks, with a target of 1/day. 3 weeks later, it's not amazing, but it's been working considerably better than any of my earlier attempts, which were total failures. My first idea was to limit the priority list to just 3-5 items, but it has tendency to grow, and I have to trim it back regularly, moving things back to regular todo lists.

That's it for today. No real solution, but I hope my self-experiments will be useful to others as well.

Sunday, April 13, 2014

Zombie Survival Guide review

I feel a headache coming on! by ucumari photography (Valerie) from flickr (CC-NC-ND)
I was really happy to get my hand on a book that claimed to be a compendium of knowledge necessary to survive close encounter with the living dead - The Zombie Survival Guide: Complete Protection from the Living Dead by Max Brooks. Unfortunately while the guide has many good points, it also commits far too many mistakes to be a reliable source, so I feel obligated to write this review and refutation, which will hopefully prevent countless unnecessary deaths by naive civilians trying to follow flawed advice.

Zombie Science

The book nearly implies without stating it outright that zombies violate Law of Conservation of Energy. Let's get serious here - zombies don't feel tired, they don't feel pain, they don't waste energy on all the functions necessary for long term survival of the body, so they can keep going far longer than a human, and it might seem to a naive observer that they can go forever, unless they rot away away.

This is of course a total nonsense, a captured zombie could be used to build a perpetual motion machine by just keeping in environment where body rot is unlikely. All zombies will run out of energy eventually. Assuming an average human is 80kg, 60% water, 20% body fat, 20% lean mass, and uses 2500kcal/day, that person will be left with literally not 1 gram of tissue in their body in 83 days. Even if we assume zombies can be far more efficient by shutting down nonessential body functions, a lot of this mass is still necessary for structural purposes. There's pretty much no way a zombie can remain active for more than a few months - not years like the author frequently claims.

A zombie could plausibly remain in a semi-dormant state for much longer, but visions of multi-year zombie sieges author sometimes draws need to be treated as fairy tales. If you can survive 3-6 months, you're basically saved.

The author makes other claims about zombies - that they're slow, clumsy, can't climb, can't throw things, can't use tools, can't coordinate, are not afraid or aware of fire and so on. These should be treated with caution. They might be true of a typical zombie, but how confident are you in risking your life on a bet that zombies you're facing are of the most vanilla variety? Different people had different abilities in life, and while zombification definitely generated massive brain damage, what was left might just be an exception. So prepare accordingly, but always have a backup plan just in case.


It's hard to describe advice about weapons given by the book as anything less than ridiculous. It's centered around use of silencers and long distance headshots. Both aspects are completely ridiculous.

Contrary to Hollywood portrayals, "silenced" weapons are still quite loud - and if zombies are attracted to slightest sound like the author portrays them to be (advising not even talking loudly just in case zombies might overhear that), any use of silencers is completely futile. And for untrained civilians able to reliably shoot a (even slowly) moving target in the head from long distance while shitting their pants? Such attempts are just the best way to waste all your ammunition.

Fortunately there are far more realistic solutions to the zombie menace - like shotguns. Sure, they are loud, but your chance of hitting zombie's head from a short to medium distance when your life is in danger is far better than with anything else unless you had years of training.

And contrary to author's claims, I would not completely ignore all targets except the head. Severed zombie head might be dangerous for a while, but your priority is survival, and it won't chase you. Mobility kill is good enough to save your life. Any hit that severs spinal column, shatters limb bones, breaks major muscles, and so on can ensure the zombie thus hit will not be following you. That's why grenades, molotovs, and all kinds of explosives are your friend. Of course the author is right - don't be stupid and approach the immobilized zombies, but your priority should be survival, not being a hero.

What to do if you have no firearms? If you had adequate training and quality equipment available, a polearm or a sword might be very viable - but let's be serious here, that's even less likely than sharpshooter training. If you have nothing better available, improvised spears are relatively easy to make, and can be adequate protection of last resort - they were used successfully for thousands of years against much bigger, stronger, and faster wild animal, than a stray zombie. Anything shorter like improvised knives and swords, baseball bats, hatchets, crowbars, and so on leads to far too great risk of infection even if you manage to eliminate the attacker, so only use in real desperate situations.
Abby contemplates the meaning of string by DirtBikeDBA (Mike) from flickr (CC-NC-ND)


The best thing you could possibly get, if your budget is unlimited is a shark suit. It costs about $5000 and protects from shark bites. Zombies have basically human anatomy, and any armor that protects you from sharks will also definitely protect you from zombies with a huge margin of safety.

If you don't have that kind of money to spare, or zombies caught you unprepared, you should still try to armor up. Any kind of motorcycle helmet and heavy leather clothing (of the kind bikers wear) will offer at least some degree of protection from zombie attack. It's not going to make you invulnerable of course, but every little helps.

Short Term Survival - Get on the Roof

I feel the book covers that well - just get on the fucking roof, and get rid of the ladder. Zombies can't use ladders, can't climb, and even struggle with staircases, so heigh is your saviour.

I'd put much more trust in doors than the author. Plenty of doors are flimsy and will fall in minutes to even a single zombie, but depending on where you live, heavy fire doors routinely installed in all new buildings can stop zombies just as well as fires. Not forever perhaps, but your priority is not to die now. Time is on your side, and even if hundreds or thousands or zombies might be in the neighbourhood, they can't all try to break the doors at once due to physical constraints and zombies' lack of coordination.

Hopefully you'll only need to survive for a few days, and then help will come. But what if help doesn't arrive?

Medium Term Survival - Zombie Demographics

The author inexplicably ignores demographics of zombies, but that's the key to your medium term survival. There are currently about 47 humans per square kilometer. Even in the worst kind of outbreak, where very few people survived, most will likely die without turning into zombies, and every day, significant percentage of zombies will die to delay, loss of energy, accidents, human resistance and so on. Within weeks their numbers will fall real low - even in apocalypse scenario after 3 months it's difficult to imagine more than 1 zombie per square kilometer worldwide, falling to maybe 0.1 per square kilometer after 3 more months.

So what do you need to do? Get the hell out of the city. A single zombie or a handful is not very dangerous, and in the countryside that's the most you're likely to encounter. It's only in densely populated urban areas where you're likely to find literal hordes.

In apocalypse scenario, you won't really have to worry about food and supplies - zombie numbers are falling rapidly, and any store will have huge amounts of nonperishable food for the few survivors. Store trips are extremely dangerous places in the first days of the outbreak, especially for stores located in more populated areas, but a couple weeks or months in, in broad daylight, with prior reconnaissance and cleanup of the surroundings, it's manageable level of risk.

Long Term Survival - Rebuilding Humanity

It's exceedingly unlikely that any kind of outbreak would get all of humanity - most likely it will be geographically isolated and even if a large region falls to the zombies, the military will soon intervene (hopefully not with weapons of mass destruction or carpet bombing), and thing will go back to normal before a year passes.

Still, if we're considering apocalypse scenarios, we might as well consider the worst case of all.

And here the author goes completely off base - recommending setting up the new society for your group in tho most inhospitable environment possible - like deep Siberia, or a desert, or even a jungle. That's just insane. Zombie numbers will be falling rapidly, so your first problem is shifting from eating non-perishable pre-apocalypse food to growing new food - and for that you'll need either coastline for fishing, pastures for livestock, or decent arable land (wildlife hunting can supplement your food, but it's unlikely to work as its primary source) - it won't give the yields modern agriculture, but then the number of survivors will be much less than seven billion.

Bandits are a risk of course, but people can and will defend their homes, and bandits won't last very long in such an environment, just like they didn't in ancient times. Historically, small scale bandits mostly robbed travellers, not farms - you need a small army to setup a successful long term farm robbing operation, and if you have an army you might just as well call yourself President for life, wipe out all other bandits, and start collecting taxes. Of course history doesn't reliably tell what might happen to the society after a catastrophic zombie outbreak, but it very reliably predicts what's going to happen if a bunch of fat urbanites try to set up new life in environment where even natives living there for generations can barely make ends meet.

It's still far safer to deal with some potential bandits than with near certain starvation.

History of Zombie Outbreaks

The book also narrates important historical zombie outbreaks. Since it's based on inference from highly unreliable information, definitely don't take them at face value (especially the alleged multi-year siege), but it's still interesting to read, and can better prepare you for the day zombies come for you.


4/5 stars - It's really important that someone finally wrote such guide, and it contains a lot of useful information, but using it as your sole source is going to get you killed.

Saturday, April 05, 2014

Review of Ruby Under a Microscope: An Illustrated Guide to Ruby Internals

Cat Pimp by nicora from flickr (CC-NC-ND)

I've been digging my way out of an overwhelming pile of book at pace of about 3 a month - a pace at which I have no chance whatsoever to ever catch up with all the absolutely must read stuff. One book I recently found in my pile was a review copy of Ruby Under a Microscope: An Illustrated Guide to Ruby Internals I got a few months ago, which turned out to be by far the best Ruby book I've ever read.

I'm a little jealous of how easy kids have it these days. I learned Ruby internals back in the 1.6 days - that was the time when most programmers have never even heard of this "Ruby" thing (I'm not kidding you here). To learn anything about Ruby internals you had to dig through macro-heavy and very idiosyncratic C codebase (C/C++ codebases tend to be highly idiosyncratic in general, much more than Java or Ruby or Python codebases), and what little documentation there was was mostly in Japanese. And here someone bothered to write a quality book that explains it all, and well just like that. I've learned a lot about 2.0/2.1, JRuby, and Rubinius from it, even if I was already very familiar with 1.8 series (and had some nonzero level of familiarity with others).

I can see two target audiences for this book. First, advanced Ruby programmers who want to learn Ruby internals - to work on one of the Ruby implementations, or write complex C extensions, or to heavily optimize performance of their Ruby apps.

And second, people who want to write their own programming languages. Ruby implementation is uniquely well-suited for study if you're such a person. It's relatively simple, but implements a highly modern language with all the goodies. Studying something like JVM is basically a waste of time - it's a monstrosity implementing a monstrosity, and half of the features you'll absolutely need in your language you'll have to brutally hack into an unsupportive environment, instead of just cleanly implementing them from first principles. And trying to build your language on top of JVM/LLVM or whatnot, while highly pragmatic, robs you of all the learning experience of writing your own first VM - something I believe any serious CS student should go through at least once.

The book itself assumes you're reasonably familiar with Ruby, but nothing out of ordinary, and as far as C goes it assumes you understand pointers, struct declarations, and basic syntax, and that's about it. That makes it surprisingly approachable considering its subject matter, but I found it really useful even already being familiar with all that (or how it was a few years ago at least). It doesn't bore you with compiler theory, but focuses on actual solutions to actual problems, and invites you to think about how things could possibly be solved. Contrary to what you'd expect, it's meant much more for a cover-to-cover reading than as a reference manual - it's over 300 pages, but it's very heavily illustrated, so it doesn't take that much time.

One big weakness of the book was its chapter about Garbage Collection, which spent far too much time on GC theory and far too little about explaining the interesting bits (like write barriers implementations). I don't think it kept up with standards set up by the rest of the book. And of course many subjects could use some elaboration, but you only get that many pages, and its priorities are relatively sensible.

I'm not sure how complete the book is for someone with no prior exposure to Ruby from the inside - it seems to cover all the basics except maybe C extensions (which would require a lot more C knowledge than the book assumes), but even if something you need to know isn't covered, the hardest part is getting started without being overwhelmed by all the interconnected pieces, and the book will definitely give you that.

If you're in one of two audiences I mentioned, it's practically a must read. I don't think it's terribly useful for people who just hack some Ruby on Rails at work, and aren't terribly interested in going deeper. Sample chapter is available on author's website if you're interested.

tl;dr 5/5 stars