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

Friday, November 23, 2012

Random campaign scenarios for Medieval 2 Total War

Total War games have somewhat limited replay value, since campaign map is the same every single time, and there are only so many mods you can play.

In my Concentrated Vanilla mod I tried to make things somewhat more interesting by introducing large number of tweakable settings - so for example in one campaign cavalry would be really nerfed and I'd need to play infantry game, some other time mining income was far greater than any other income so a small number of key settlements held key to victory, or I removed distinction between cities and castles and so on. Every campaign slightly different.

That still doesn't get us very far, since campaign map looked the same each time.

Here's the campaign map (it's like vanilla map except a bunch of extra regions added to fill some gaps):



The first thing I've done was add scenario builder to Concentrated Vanilla script, and used it first to make life much more difficult for Byzantium (which also started at war with all its neighbours). It was some serious fun, especially early game.


I could of course keep making new scenarios manually (it's not that hard), but then I got an even better idea - why not assign settlements to factions at random?

I started a campaign and I'm writing AAR as I go (sadly I didn't have much time this week).


I'm playing as Portugal (white with blue borders), which starts in Arhus, Alexandria, and Cagliari. You can get details in AAR.

This is fun and somewhat bizarre experience, but then it's a bit too easy - AI is very confused with its provinces scattered all over the map, and it's too easy to attack AI, take its one province, and then get it to agree to ceasefire since you're not longer neighbours. Rinse and repeat.

So I tweaked the scenario generator. Instead of allocating settlements randomly X% of the time it allocates a settlement next to one already allocated, otherwise (or if none are available), it picks a random one.

75% cluster, 25% random:

67% cluster, 33% random:

50% cluster, 50% random:


These maps are very interesting, and probably won't lead to AI problems like with my AAR.

Technical details


As for some extra details - settlements are neighbours if they have either land link or land bridge, so Denmark is neighbour of Sweden (land bridge), but Cyprus isn't neighbour of anything.

In my AAR playthrough I put minimum number of settlements at number of family members, since I had no other way to deal with them, now they'd just be places somewhere near existing cities.

If faction gets more cities than it had originally, extra cities get filled with some basic units (IIRC I set it to 2 Spear Militia or something similar + 2 basic missile units for all factions).

Muslim and Orthodox factions get more settlements on average, since otherwise it would be too easy for Catholics.

The script can be tweaked to always allocate some settlements to some factions (like Rome to Pope), allocate different units based on settlement size and type, and do other interesting things.

All navies are disbanded to simplify matters.

I could generate correct maps for campaign start menu, but it's better for suspense not to reveal factions' locations there just yet.

There are some bugs to fix (Durazzo gets skipped always, churches should get demolished if faction of different religion gets settlement).

Can it be used it in other mods?


The obvious question is - can you use it in vanilla, or other mods?

In principle it should be possible, as long as the mod is not too heavily scripted (like Third Age).

There would need to be a lot of tweaking for each mod. Things like lists of factions, protected regions and factions (here - Americas, and aztecs/timurids/mongols), what kind of units should factions get, etc. These aren't particularly complicated issues, but each mod needs to solve them differently.

The scenario script is not separate from the rest of Concentrated Vanilla, but if you need some assistance with porting it to another mod, we should be able to sort things out somehow.

I don't see any major reasons why it couldn't be adapted to run on anything from Rome to Medieval 2 to Kingdoms, with some work.

Future possibilities


In theory it would be totally possible to go further with it, and make fully random maps for Medieval 2, with one of random map generating algorithms other strategic games use.

I don't have any immediate plans to go there, but one day, who knows?

When can I play?


I'll release it sometime soon, there are still some bugs to be fixed, and I need to figure out some kind of user interface so non-programmers can run the script.

If you're very impatient just email me and I'll send you what I've got.

Wednesday, November 07, 2012

Think Like a Programmer by Anton Spraul - book review

In The Night All Cats Are.. Err.. Gray? by meantux from flickr (CC-NC)

The book "Think Like a Programmer" tries to teach people relatively new to programming how to approach problems and program solutions.

The idea is good, but the book has one massive flaw - it uses C++. I'm not going to kick the dead horse and repeat all reasons why C++ is horrible in general - but it's especially horrible for teaching problem solving to beginners.

Irrelevant low level details caused by limitations of C++ keep getting mixed with solutions of discussed problems throughout the book. Many problems like constant sized arrays, pointer lifetime management and so on, lack of usable containers, I/O, and string functions in standard library and so on simple don't exist in civilized language.

And sadly such basic ideas as:
  • experiment with your problem in REPL
  • start with writing unit tests for your problem
  • check if standard library can solve part of your problems
  • check if any easily installable third party library (via CPAN, rubygems, or whatnot) can solve part of your problem
are completely alien to C++ thinking.

Other than this one huge flaw the book is really nice. All code is very nicely formatted with inline bullet point references and shading for commentary, all problems are explained with liberal use of relevant diagrams, methodology of breaking problems into steps and solving them separately is executed quite well, and even various pain points of C++ tend to be handled as reasonably as they can.

Other than choice of C++, the only other problem is that while problems tend to be broken into small steps to be solved one by one, solutions to these small steps are then typically put together into one big lump of code instead of being left alone as separate functions or methods, and this code tends to be much more complex than it should be. I blame C++ for that as well.

I urge the author to write a Python or Ruby version - or at least Java version for that matter. Using C++ in a book for beginners mostly just shows the basic problem solving mistake - not choosing the right tool for the job, and it really distracts from what the book is supposedly trying to do.

Summary

If you're a beginner to programming and your school or university forces you to learn C++ in 2012 this book might be really useful to you. Also find a lawyer and sue your school for emotional trauma caused by C++.

If nobody makes you learn C++, I'd skip it. It's very C++-centric, and many of its lessons are not directly applicable to more sensible languages.

If you know a bit about programming from point of view of a high level languages, and are trying to learn C++ now, it might actually be reasonable supplement to C++ textbook.

If you're coming from reasonable C to C++ world, you probably won't find much of it useful. You'll presumably know most of it already, and advanced C++ issues like boost libraries won't be even mentioned here.

And in interest of full disclosure, I got this book as a free review copy.

Elections happened and Intrade lost

Cat with turquoise eyes by Tambako the Jaguar from flickr (CC-ND)

So elections happened, and Intrade lost big.

There's no need defending them that they still had Obama as leading candidate. Here are some of their minor markets one day ago:
  • Obama to win Florida - 32%
  • Obama to win 320 or more electoral college votes - 26%
  • and so on
Intrade massively overestimate Romney's chances and possible margin of victory and underestimated Obama's.

Meanwhile it seems that Nate Silver got 49.5 out of 50 correct, since he gave Florida exactly 50.0% chances.

Anyway, I'm sure Nate Silver will be getting more congratulations than Obama over the next few days, that's not what I want to write about.

Markets vs Models

My post from two days ago caused a bit of confusion, and perhaps I wasn't entirely clear (but look at the kittens!).

I'm not claiming that yesterday's elections were a definite resolution of markets vs models question. Such resolution is in principle impossible.

Even if Nate Silver gave Obama 99% chances, and Intrade gave him 1%, even that wouldn't really be definite.

First - we have a independent sample size of one. There were multiple predictions made by both Intrade and Nate Silver, but they are not independent at all. By any measure probability of winning Ohio and probability of winning elections were very highly correlated, so we have just one observation.

Second - even if both Intrade and Nate Silver keep predicting subsequent elections, these are not independent events at all! Pollsters, polling aggregators, and market participants will keep changing their methodology based on how their previous predictions worked, so every new prediction is dependent on all previous predictions.

And third and worse of all - we don't even have independent sample size of one. Market participants had full access to Nate Silver's predictions, and could have priced them in, so that's not independent at all.

It's somewhat better in the other direction since Nate Silver claims to have made his model long time ago, and not to have made any tweaks, but then Intrade numbers were widely quoted, and they might have affected both voters and polling organizations, affecting inputs to Nate Silver's model. Compared with other problems this one is probably the least important, but in principle nothing at all is independent!

What was Intrade thinking?

Intrade numbers were so strangely optimistic about Romney it's difficult to take them at face value. Any of these alternatives makes more sense than Intrade traders honestly and rationally expecting Romney to have 30% chance:
  • Deliberate market manipulation on Intrade
  • Completely irrational bubble
  • Traders believing in some kind of vast left-wing conspiracy by pollsters, who all lie about voters' preferences 
  • Traders believing in some kind of vast right-wing conspiracy by voting machine manufacturers or some other kind of massive pro-Romney voting fraud
I'm not joking about these two conspiracy theories - they were both pretty widely discussed all over Internet and apparently some "fair and balanced" cable news stations.

Nate Silver's model actually included some small voting fraud effect of Republican voter suppression efforts, but Intrade traders would have to believe in something much greater than that to reach these numbers.

I think the most likely answer to what happened was some combination of market manipulation and bubble. We know there were attempts to manipulate Intrade by Republicans in both 2012 and 2008 elections.

In theory such efforts should always fail - if there are enough people who care only about making money - and this tends to be a safe assumption on most markets - they'd take advantage of such manipulation attempts and market would go back to rational equilibrium.

However if there's a sufficiently large number of people who take high Intrade prices as solid evidence that actual chances must be high - they can create positive feedback which turns any movement (either random or deliberate) in prices into long term price change.

This sounds speculative, but I have no other explanation for why Intrade's odds of Supreme Court overturning Obamacare increased from 2:1 to 4:1 while nothing whatsoever was happening! Someone pushed prices for whatever reason, people saw that prices are increasing and assumed that this someone has either insider knowledge or some kind of insight, and jumped the bandwagon.

No kind of rational market process can generate both 2:1 odds and 4:1 odds with zero new information.

Now stupid kind of market manipulation - throwing ton of money on the market very quickly - will probably end up being defeated since it's too obvious to everyone. But if you push the market slowly then you might very well generate a lot more positive than negative feedback.
kim by Abdulmajeed Al.mutawee || twitter.com/almutawee from flickr (CC-NC-SA)

The case for manipulating prediction markets

That's for some speculation on why market manipulation might work in practice better than in theory, but in leaves a big question - why?

After all even if you successfully manipulated the market, you're very likely to still end up losing money on election day, and most voters don't pay much attention to Intrade.

But there's one route how Intrade odds can plausibly affect the results:
  • Candidate manipulates his odds on Intrade
  • Candidate appears more likely to win to donors, volunteers, journalists and so on
  • Candidate gets a lot more donations and coverage
  • More campaign money and more coverage affect voters
  • Polling shows this
  • And there's positive feedback look
I don't think this would matter too much in presidential elections, but in primaries perceptions of candidates' seriousness is a huge deal. Intrade's preferred candidate Mitt Romney won against everybody else even though he never lead in any polls, and it was clear that he was very far from what the Republican base wanted.

So was Romney campaign or his supporters manipulating Intrade during primaries (and later during elections)? I doubt we'll ever see any hard evidence, but this scenario is broadly consistent with data.

I'll just leave it here as an interesting scenario to think about, not any serious conspiracy theory.

What does it mean for the future?

Actually not that much.

After this loss, Intrade traders in future elections will probably pay a lot more attention to models like Nate Silver's and election fundamentals, and will be much less likely to jump on any bandwagon of either deliberate market manipulation or random bubble.

Unless you're willing to outspend every single market participant put together, successful manipulation is only possible if you can get bubble going, and traders will probably now be much less willing to put too much weight on Intrade prices.

For prediction markets enthusiasts, this isn't even much of a problem in theory - Intrade is very far from a perfect market, with all kinds of transaction costs, and other limitations, so even if Intrade was definitely proven to be biased and bubble-prone (and we have no such proof, just some suggestive data points) - they can keep insisting better prediction market would still be "rational".

Like belief in Efficient Market Hypothesis, belief in rationality of prediction markets is simply immune to data.

Anyway, that's probably the final post about politics, I'll be back to your regular kittens and technology posting soon. (especially once Raspberry Pi I ordered arrives)

Monday, November 05, 2012

Tomorrow is the most important election in history of the future

Mao gets things done by davekellam from flickr (CC-NC)

Tomorrow millions of Americans will choose between rule guided by wisdom of the crowd embodied in free markets and rule guided by wisdom of elite experts embodied in technocrats' statistical models.

And by that I mean obviously Intrade vs Nate Silver.

What government is all about

Make no mistake - this isn't some obscure issue a few wonky bloggers care about - this is one of the biggest issues the future will face - the problem of predicting itself. Governing is fundamentally about just two things:
  • Determining how you value various possible outcomes - how much do you care about low unemployment vs economic growth vs showing off your military power vs not offending God with too much gayness vs other such important outcomes of government policy.
  • Predicting how various choices made by the government will affect these outcomes.
Whenever there's full agreement on both, there's really no controversy as for what government should do. You apply Bayes' Theorem and it will tell you precisely which of many possible policies to adopt.

Whenever there is disagreement, it must mean either different values, or different predictions of the future, or both.

Values

Contrary to what you'd expect agreement on values is the easy part. Most things affected by government policy are economic in nature, and people mostly agree on the same things being good - like higher incomes, lower unemployment, cheaper energy, better education, healthier environment, less poverty, and so on - they might disagree on relative weights to be given to these issues, but there's a natural utility metric - one happy voter is one point of utility - so you can just estimate how median voter feels about various issues to get a pretty good starting point for the compromise.

This won't resolve some conflicts, like the one between "people against murdering unborn babies" vs "people against forcing women to carry their rapists' babies", or whatever were the politically correct terms for them these days. Well, too bad, but there's literally no solution that will make everybody happy anyway. Such problems are fortunately fairly rare, and it's not like the government is doing a great job handling them anyway.

Predictions

A much more common and more important source of disagreements about the future is with predicting outcomes of various policies.

If one seriously believes that tax cuts for the rich lead to economic renaissance, and that welfare just makes people lazy, then Romney's policy makes perfect sense.

And if one believes that Obamacare will make healthcare available to everyone at lower cost, and that massive budget deficits saved the world from the Second Great Depression, then Obama's policy makes perfect sense.

There's little difference in values here - both Romney and Obama and most of their supporters want high economic growth, high employment, affordable healthcare, and fewer financial crises - but they have very different ideas on what's the best way to reach such goals.

Dewey by angela n. from flickr (CC-BY)

How to predict the future?


So the problem of governing reduces to problem of predicting the future. And only two serious approaches exist - prediction markets and experts' statistical models.

Prediction markets like Intrade, or for that matter - stock and bond markets - sound a lot like gambling to many, but that couldn't be further from truth. Every transaction on prediction markets is a disagreement about the future - with winner taking loser's money. If you truly believed that Ron Paul was going to win Republican primaries, or that Nokia's N series was going to destroy iPhones, or that deficit spending would result in hyperinflation, you can put your money where your mouth is (on  respectively Intrade, stock market, and bond market) and if you were right then you could be an overnight millionaire. Or if you were wrong, you'd lose your money.

This is a pretty good motivation, and prediction markets tend to be pretty good most of the time. It's really most unfortunate that we don't have any widely traded prediction markets for economic growth, unemployment, and other such macroeconomic indicators, but markets we have tend to perform quite well.

The only second approach is statistical modeling based on reference class forecasting. You accumulate a lot of data about the past, and based on assumption that the future is likely to be broadly similar to the past you can make some really good predictions. This is far from automatic exercise and requires a lot of judgment as to which variables are relevant and how they might be connected, and in the end you often get pretty wide margin of error - but if reference class forecasting tells you we don't know better that's probably because we don't.

I'm completely ignoring all so called "experts" who don't base their predictions on any statistical models and just talk out of their ass, and all claims of "markets" that are not backed by actual money on the claim. These have track record more dismal than asking my cat's opinion.

So how do we decide between prediction markets and experts' statistical models?

Intrade vs Nate Silver

Unfortunately we have very few serious statistical models, and very few serious prediction markets, and even less overlap. Pretty much the only area where we can compare them against each other is predicting outcomes of American elections. And unfortunately for us, in the past they've been mostly in very good agreement with each other.

However, something really interesting happened. As of today, prediction markets and statistical models disagree more than at any time in history. Here's quick summary of Obama's vs Romney's chances of victory (normalized to 100%):
  • Intrade (popular vote by at least 0.5%) - 58.1% to 39.1% (1.48 to 1)
  • Intrade (electoral college) - 67.3% to 32.7% (2.06 to 1)
  • Intrade (Ohio) - 68.7% to 31.3% (2.20 to 1) 
  • Iowa Electronic Markets (popular vote) - 74.0% to 26.0% (2.85 to 1)
  • betfair (electoral college) - 79.3% to 20.7% (3.83 to 1)
  • 538 (popular vote) -  80.2% to 19.8% (4.05 to 1)
  • 538 (electoral college) - 86.3% to 13.7% (6.30 to 1)
  • 538 (Ohio) - 87% to 13% (6.70 to 1)
Don't be misled by the fact that they both predict Obama's lead - they differ so drastically in predicting how big is the lead it's as if they were seeing different elections. 538 offers odds more than three times Intrade's. Difference is very similar for popular vote and for Ohio winner.

If Romney wins after all, this will be a stunning victory of prediction markets over experts' models, and Nate Silver will most likely go back to baseball statistics.

If Obama wins, especially if he wins by a big margin, it will be a major defeat of prediction markets, especially Intrade.

Now you may not think a single such outcome matters much, but I have a bunch of completely unscientific anecdotes regarding their past performance.
Literary cat by SuziJane from flickr (CC-SA)

Intrade and Obamacare Supreme Court Judgment

Intrade was really bad at predicting Supreme Court judgment, it peaked at about 80%. And Intrade turned out to be completely wrong.

The worst thing about is was not so much wrong prediction - it was how it went up from 65% (2:1) to 80% (4:1), doubling the odds, with zero new information becoming available. It was just Intrade bubble - people were estimating odds higher because they were going higher, unless someone had insider information to Supreme Court justices, which in this case at least we can safely say didn't happen.

It completely baffled Nate Silver as well, who responded with much more reasonable 1:1 odds based on statistical analysis of past information, and turned out to be much closer to being right.

Intrade and Gadaffi

Here's even more baffling one - market that Muamar Gaddafi will no longer be leader of Libya by 31 December 2011.

Not only it didn't go up to 100% after fall of Tripoli, when Gaddafi was reduced to being a mayor of Sirte at most, it actually fell down, because it turned out into market for "what the hell Intrade admins meant by leader of Libya", and it stayed there for days.

It wouldn't be the weirdest thing to ever happen if some rebels with big Intrade investment made sure the market was judged correctly by putting a few bullets in Gaddafi's head.

This shows how difficult it is to run prediction markets for anything will less defined outcomes than winners of Oscars or elections. Uncertainty over interpretation of market rules might be greater than uncertainty over interpretation of outcomes. And unfortunately most important things in life are less clear than election winners, so if prediction markets can't handle them, they're of not that much use.

Republican Primaries

Here's a very interesting case. Intrade was always far more pro-Romney than polls during primaries.

Polls disagreed widely on who was leading Republican primaries - with just about everyone including Herman Cain having their time as the top candidate - except Romney who was always number two. Meanwhile Intrade didn't doubt Romney for a moment, and Intrade was right.

Nate Silver even wrote a post why on we shouldn't underestimate Herman Cain's chances, which looks really silly in retrospect.

Tomorrow

Regardless of tomorrow's winner - be it Nate Silver/Obama or Intrade/Romney - we will learn something important about which way of predicting the future is more reliable - and I'm sure the future will care far more about this than about pretty minimal differences between Obama and Romney.

Post Scriptum



To make things even more clear, as of Tuesday morning UK time, 538 updated its predictions to 92.0% to 8.0% (11.5 : 1).

Intrade and Betfair are completely unmoved. (I don't actually know how often Betfair updates its odds, but Intrade is live).

Wednesday, October 17, 2012

Highlights from CA modding summit

Miyako wearing chanchanko by Takashi(aes256) from flickr (CC-SA)

This is a very late post since the summit was three weeks ago, but better late than never.

I did some liveblogging during and immediately after the summit, if you want every detail, go to these three places:
Here I'll summarize the most important things. If you have any questions, ask away.

Modding Kit on Steam

There's now a bunch of modding tools released for Shogun 2 only, and available on Steam. Included is some way to build campaign maps, most of models, and some of minor formats etc.

There will also be Steam Workshop integration for easier distribution of mods.

It won't work on Empire or Napoleon, but it might be useful in reverse engineering them.

There now also official wiki. Only time will tell if it attracts much information about modding. The problem was too many wikis and fora, not too few of them. (relevant xkcd)

Still missing

There was nothing about any game before Empire, and very little about Empire/Napoleon.

Even for Shogun 2, a lot of formats are still missing.

There's no information about UI layout files (which we partially decoded), sources for .luac files (which we can partially decode), sound bank (again, partially decodable) etc.

One minor thing I asked for was .sav file format used by Rome and Medieval 2, but they don't have any documentation. I made some effort to decode it recently, but to be honest my hopes are not terribly high.

Another interesting thing CA guys said was that all damage calculations figures for all games community reverse engineered are wrong, and real calculations are far too complicated to release.

Rome 2

There was a short video of Rome 2 battle, short fragment of which later released to the public.

Judging from the video Rome 2 will have:
  • ridiculously huge battle maps
  • much more people per unit
  • surprisingly good unit pathfinding in complex streets, serious weakness of previous games
  • naval invasion as part of land battles, including sieges
  • much more interesting siege equipment on both sides, there's even some partial defensive palisade attackers can hide behind
  • full screen tactical map (bird eyes's view) - I'm surprised it took them so long, it was badly needed, especially in naval battles
Rome 2 will still be a 32-bit only game. They have 64-bit build, but don't plan releasing it. Feel free to spam them with requests of course. :-p

An interesting technical hint was that they're no longer using .lua for Rome 2, but who knows really.

There was also a mention of builtin console feature for debug build, I really wish they shipped with it enabled by some config flags, but my hopes aren't high.

Planned release date is a bit before Christmas 2013.

Blinkenlights at London Hackspace

I paid a visit to London Hackspace yesterday hoping to play with laser cutter and 3d printer. And of course due to my luck neither laser cutter nor any of 3d printers they had worked, so I decided to do something else and play with electronics.


That's not terribly complicated, but it's my first ever thing using 555 timer circuit.

Due to power cable shortage I had to use red cable for both Vcc and Gnd, I'm totally aware it goes against the most important thing in circuit design - color coding your cables.

Long time ago I made a somewhat serious attempt at building a computer, but it never got past ALU phase since just wiring all the damn things was taking forever.

Here are some photos:


I'm somewhat tempted to give it another go someday, especially if I can find either how to print PCB or find some other way to deal with wiring, since the wiring was the biggest problem as you can probably see on the photos - elegant schematics turned into Flying Spaghetti Monster.

Anyway, London Hackspace is open for visitors every Tuesday evening, so if you live in London or are just passing by it's a good idea to drop by and see what's there.

I haven't decided if I want to get seriously involved or not, but I plan to at least give it another go - maybe the next time laser cutter and 3d printer will be working, or I'll find someone knowledgeable about PCB etching (since they have etching station over there too).

Actually does anybody know if laser cutter can be used to make PCBs? It sounds like it should since it can make both traces (by cutting a bit into top copper layer) and holes (by cutting all the way through) and with careful positioning it might even be able to do the same to the bottom layer in matching way. It sounds a lot less messy to just cut it with lasers rather than mess with ton of chemicals, but maybe it doesn't really work as well I as hope.

Thursday, October 11, 2012

Medieval 2 Total War Concentrated Vanilla 0.53

Filipe the Archer by Friday Felts from flickr (CC-NC-ND)

A new Concentrated Vanilla released. It's a fairly minor update:
  • Game's main menu now has yellow "Concentrated Vanilla" label added, so you won't have trouble figuring out if it installed correctly.
  • Rebel settlements start with slightly fewer units, since AI had too much trouble dealing with them. They still have a lot more troops than vanilla so they won't be too easy to take.
  • Some bugs with rebels having units without proper textures fixed.
  • New settlements of Sijilmasa and Belgrade made smaller since they were causing trouble to AI.
  • Artillery accuracy scaled down a bit from 2.5x to 2.25x vanilla values.
  • Upgrading units' armor and weapons now costs nothing extra, since you're already paying one turn's upkeep by having them sit idle in a settlement.
  • Mercenaries pools in Concentrated Vanilla are larger and replenish faster. This makes war feel different depending on location, but unfortunately it can easily lead to all factions relying heavily on mercenaries and reduced differences between factions. Therefore mercenary recruitment and upkeep costs increased by 25%. They're still very often a bargain.

Peasants

One thing I've been pondering but haven't implemented is finding some use for peasants. Currently they see zero play since Militia units are far better and easier to recruit.

Would it make sense to make Peasants recruitable as mercenaries in large numbers in every region as a way to pad army size quickly?

Or maybe add a garrison script that automatically adds some Peasants to defend a settlement whenever it's sieged (for both AI and player, but not rebels)? This would be similar to what Matchlock-armed Citizens do in Empire.

I've heard that garrison scripts can result in excessive slowness (due to Number of Settlements x Number of Factions x Number of Settlement Levels x City/Castle triggers), but maybe it can be dealt with.

Both ways make historical sense, and would see Peasants see some action without reducing the need for any other unit type, or affecting game balance too much.

What do you think?

Source Code

The mod is released with source code, but no tutorial how to use it. Someday I plan to write a post how to make your own mod with tweaks to Vanilla or Concentrated Vanilla, but go on and play with it now. I'd love to hear from anybody who tried.

You'll just need some version of Ruby, text editor, and sources below.

Credits

Concentrated Vanilla 0.53 uses some files from the following minimods:
  • Sinuhet's Battle Mechanics
  • Lusted's Better BAI/CAI
  • Agart's Cities/Castles Strat

Links

You can download mod here.

You can download sources here.

If you're interested in how this mod evolved, posts about previous versions (with links inside):

Saturday, September 29, 2012

Soup Page Rank


katie drying my soup pot by jodimarr from flickr (CC-NC)

Inspired by jrmy (who also introduced me to soup long time ago) I downloaded soup.io's friend graph, and did PageRank calculations on it. Well, one variant of PageRank, there are sure countless such.

There's a grand total of 46827 soups in the graph. I'm sure there are a lot more soups nobody follows, just like there are ton of websites nobody links to, and quite likely a few that should be included except soup returned error or timed out when I tried to fetch them.

Nodes in the graph are individual and group soups. Links go from person's soup to each soup they follow (be it individual soup or group soup), and from group soup to each of its member's soups.

Here are top 100 most influential soups (most of them are cats and funny things, but some might be NSFW):
  1. sb77 – 48.423
  2. cats – 41.209
  3. soadysta – 39.766
  4. mnq – 38.84
  5. maraskowa – 37.048
  6. Aluslaw – 35.235
  7. kitchen – 34.867
  8. noisetales – 34.864
  9. updates – 34.827
  10. atheism – 34.633
  11. inwebwetrust.pl – 34.612
  12. copywriter – 34.332
  13. 18alexa18 – 33.489
  14. skins – 33.076
  15. pl – 32.789
  16. hogwart – 30.631
  17. delikatnienie – 30.308
  18. retaliate – 30.107
  19. copyright – 30.066
  20. sexy – 29.998
  21. smacznie – 29.685
  22. raczkowski – 29.028
  23. monroewiecznamonroe – 28.575
  24. cytaty – 28.422
  25. pomyslowo – 27.426
  26. couples – 27.041
  27. nameherhope – 26.702
  28. redheads – 26.555
  29. travelling-without-moving – 26.396
  30. inspiration – 26.394
  31. plotkara – 25.847
  32. thebigbangtheory – 25.643
  33. comics – 25.414
  34. EineFragevonStil – 25.319
  35. Mefir – 25.221
  36. typography – 24.811
  37. lugola – 24.791
  38. Hollywood – 24.707
  39. wishlist – 24.669
  40. mendel – 24.661
  41. funga – 24.615
  42. twice – 23.511
  43. ohmygodthebritish – 22.987
  44. urbanart – 22.913
  45. mhmazidi – 22.649
  46. krzysk – 22.544
  47. sherlock – 21.968
  48. soup.c3o.org – 21.706
  49. nikotyna – 21.465
  50. Funk_Up – 21.409
  51. fapfapfap – 21.358
  52. House – 21.262
  53. networking – 21.189
  54. ToCoZrobieWWolnymCzasie – 21.177
  55. irmelin – 20.863
  56. czerski – 20.521
  57. sober – 20.34
  58. TARDIS – 20.32
  59. charlottinka – 20.167
  60. niceandsexy – 20.1
  61. CocaineGirl – 19.856
  62. iblameyou – 19.489
  63. colours – 19.172
  64. Kabrioletta – 19.128
  65. soup.towo.eu – 19.001
  66. nimfomanka – 18.951
  67. tomash – 18.937
  68. eterycznie – 18.916
  69. ekelias – 18.906
  70. antiprodukt – 18.572
  71. iloveyou – 18.483
  72. yourheartbeat – 18.425
  73. nierobimi – 18.268
  74. himym – 18.245
  75. playboy – 18.115
  76. pimpmyheart – 17.806
  77. letshavesex – 17.768
  78. Disney – 17.678
  79. wstawieplywaizabasienazywa – 17.666
  80. fakeplastic – 17.533
  81. insanedreamer – 17.284
  82. kniepuder – 17.277
  83. Sayid – 16.96
  84. sowaaa – 16.958
  85. mublag.boinkor.net – 16.937
  86. wishyouwerehere – 16.928
  87. coffee – 16.87
  88. oll – 16.804
  89. tattoosbyanyone – 16.586
  90. ilovestrawberries – 16.53
  91. Warhol – 16.528
  92. foods – 16.381
  93. acid – 16.361
  94. starwars – 16.338
  95. inspiro – 16.101
  96. fasel – 15.82
  97. gifluv – 15.785
  98. chudosc – 15.764
  99. wieczyslaw – 15.684
  100. fus – 15.612
My soup is not terribly high rank of 1.384, but it doesn't matter since it's still totally awesome :-p

A big downside of this metric is that it only considers who friended whom, and completely disregards any activity, so even inactive soups can still have very high ranks. For example czerski moved to tumblr forever ago and his soup is still 56th on the list.

Using patterns of reposts as links (from most recent 100 or so posts for each soup) would probably result in much more meaningful ranks, but that's something for the future.

Wednesday, September 26, 2012

Return to Ravnica Sealed Simulator



jalousie by milomingo from flickr (CC-NC-ND)
Orzhov Cat Spirit

I made Return to Ravnica Sealed Simulator, based on my previous simulator for AVR and M13.

Here it is - RTR Sealed Simulator.

It doesn't have guild packs, since I still haven't figured out what they contain precisely, and I'm a bit busy with everything since I just came back to London. Maybe I'll figure them out before prerelease, otherwise I'll just leave them.

Unlike for AVR and M13 times, for RTR it seems other websites have been much faster to add new set. Even Gatherer (which most sites use as a source) has RTR cards already, and it's still a few days before Prerelease, while Card Gallery I use for my source took a lot of time even after all cards were spoiled, so I couldn't update my simulator very quickly. Previously it was more than a week between Card Gallery and Gatherer.

If Gatherer keeps getting updates fast enough, perhaps there won't be much need for my simulator in the future.

Sunday, September 16, 2012

Reply to Cheimon's feedback on Concentrated Vanilla

Wonderful cats at the Mosaic Feline Rescue (Ann Arbor, Michigan) by cseeman from flickr (CC-NC-SA)

I got some detailed feedback on my Medieval 2 mod, and I thought I might as well reply here, since it's pretty long and it might be of some interest to others.
I have been playing Concentrated Vanilla for quite a while now, and felt like giving some more feedback to see if that ends up with a higher quality mod. I've been playing as Russia. 
First, the strong rebels. I'd like to re-emphasise that I reckon it's too strong: certain factions really depend on an early rush of taking different settlements (Russia, notably, starts with just Novgorod, and to take the rest of russia takes many years. Lithuania and various other rebels survive into the 13th century as independent kingdoms, which doesn't really feel like vanilla. It's crippling to some nations that start off small, essentially: they can't grow and the AI wastes their armies on sending them piecemeal. It makes for interesting gameplay, but AI doesn't like it and I don't feel that it concentrates the vanilla experience. It just makes the first section of gameplay last an extra 50-70 years in a campaign.
I've noticed that rebels are too strong, and I plan to scale them down just a bit for the next release.

In my experience factions like Russia benefit tremendously from increased campaign movement speed, whenever I used higher values Russia (as AI) was a superpower, with values closer to vanilla it barely expanded at all.

And regardless of AI expansion, vanilla rebels were far too weak for human player - it took zero effort to blitz a lot of rebel cities with minimal loses with just your initial armies.
Cannons are fantastically powerful. This is brilliant. I use them in all my armies, along with cossack musketeers.
I'm glad you like it. In fact, I might have made them a bit too powerful, and perhaps I should roll that back a bit.
Pikes are also very powerful, which might or might not be good. They're vulnerable to missiles, but because the AI never tries to exploit this, it ends up making them very powerful indeed. Playing as Scotland was very easy for this reason: even a simple unarmoured pike unit could hold the line nicely against superior warriors from the Holy Roman Empire.
I did some Pikemen vs Militia testing as AI-vs-AI and AI-vs-player (they had a bit different stats back then, but close enough). They seemed reasonably balanced, it's just amazing AI stupidity that makes them look so overpowered or so bad depending on who's playing.

This is somewhat inevitable - the game needs to have units with very powerful abilities balanced by big downsides to keep things interesting - but AI tends to be much worse than humans at taking advantage of these abilities and minimizing these downsides. This applies to pikemen, cavalry, crossbowmen, and just about any nonbasic unit. Tactical complexity usually leads to AI disadvantage.

I'm somewhat annoyed by AI stupidity here too, and if I figure a way to make Pikemen less exploitable without making them completely useless I'll add it.
Sallying out is really, really easy to exploit...indeed, you can't stop them from going out. Russia overcame the enormous rebel hordes purely by sending out armies of archer militia with minimal infantry and pelting them to kill most of them before they were well out of the gate. My later gunpowder armies tend to treat sieges as a field battle where they're bunched together: get some cannon and lots of musketeers and make them run away before they touch the line or get organised. It's horrendously effective and it's weird to see that they don't try using the walls and streets, which would be much better.
This is a complicated issue. I didn't enjoy vanilla sieges much. They're repetitive, pathfinding in cities is buggy as hell, and there's not much tactics you can use if all units just form one big disorganized blob regardless of my orders (especially on higher unit sizes). I've tried huge number of very different settings to make sieges fun, and none were without downsides.

Concentrated Vanilla started by making settlement defenses far more powerful - towers always on, double rate of fire, much stronger walls and gates, really weak battering rams. This meant that it was really hard to take a well defended city, but it didn't mean that much if AI routinely leaves its cities with minimal garrison. Meanwhile, player's cities were almost completely impenetrable to AI, even if AI had 5:1 advantage in forces.

I tried to tone that down, and increase size of free garrison and even give free garrison to castles instead, but AI again was too dumb to take advantage of it, while it made defending them too easy for the player.

Then I tried to make AI sally out more, and it was a lot of fun when both armies were about even, or when my army was somewhat weaker. Whenever I attacked with similarly sized (or even better smaller) army, I'd have a big field battle followed by storming the settlement defended by whoever remained on both sides. If I attacked with overwhelming army, it was going to be a very bloody assault, with defenders having very powerful support from the walls.

Sallying out decision is controlled by sally-out-ratio parameter in data/config_ai_battle.xml. In vanilla it's 2.0 and AI sallies out only when defenders are at least 2x as powerful as attackers - which is to say never since why would player attack at some odds? After a lot of experimenting I arrived at current value of 0.65, which makes AI behave right.


This all depends on AI being able to judge balance of forces. If it's mistaken, it will make some really stupid sallies. I have very little control over how AI measures army strengths - it's derived from unit statistics somehow, but I don't know the formula, and even if I knew it I'm not sure which replacement formula would be better - army strengths are just highly dependent on context.

What you're describing sounds a lot like AI misjudging power of your army and then making a "sensible" decision based on this ratio.

For a quick workaround you can edit data/config_ai_battle.xml. I doubt there's any solution to sieging problems without some serious problems and without big potential for exploitative strategies.

If it's only late gunpowder armies with ton of artillery are so exploitable, it's not really a big deal since campaign tends to be mostly resolved by then, and it's even quite historically accurate.
I'm assuming it's impossible to make carracks travel faster over the ocean like you've made agents so much faster. It'd be nice if you could, since planning the response to aztec sieges years in advance doesn't feel right.
This is pretty much impossible in M2 engine (Kingdoms engine has a few ways to tweak it), especially not when they're transporting any units. Maybe giving generals trait "traveling at see" with big movement points bonus then removing it when they're on land would work.

Ships still get the same speed bonus as units, and they get the usual x2 speed bonus if they're carrying crusading armies, so it's far less of a problem than in vanilla for fighting on European seas. Americas will probably see as little play in Concentrated Vanilla as they did in vanilla - many mods simply remove them completely since they're so useless.
Characters don't seem to age properly. Is this deliberate, or a bug?
It works just as in vanilla, which is to say incorrectly. Each turn takes 2 calendar years, but characters only get half a year older. This seems fixable by scripting, but it would probably require some really serious rebalancing, so I just skipped it.

The only change I made was making initial Pope and priests older to make papal elections more frequent.
Cities are great and one turn building works very nicely. Given how useful chivalry is, I haven't yet seen a need to take taxes from anything but 'low', but that might just be me.
That's surprising, since I tend to have it on "as high as possible without city rebelling" usually other than for tiny town which really need population growth bonus.

What do you need chivalry for that much? Isn't dread far more useful?
The rebel version of Russia's 'Spearmen' Unit, frequently used in rebel armies, has no texture and appears as white. Any chance of implementing a fix? It must have been done by some modder or other.
I gave rebels some extra units without actually checking that slave faction has textures for them. In games based on Rome engine units have per-faction textures so it's more work to give unit to more factions.

In Empire engine there are shared unit textures so that's really easy to do - at cost of all units looking pretty much identical.

Anyway, that will be fixed in the next release.
Any chance of adding a message when a princess comes of age? I often miss them, and they get bad traits the older they get, like 'man-hunter' that makes them far less useful.
That would be a good idea. I didn't touch event notifications in the mod, so you only get notifications you'd get in vanilla.
Lands to conquer did a really nice job of making merchants make a decent amount of money without feeling overpowered (like Darth's merchants were). I think he did increase trade resources, which would speed up the campaign, which doesn't have to be bad.
I tried that - increasing trade resources makes regular naval trade just ridiculous. It's too easy to be flooded with money with no idea what to do with it late game already.

Merchants annoy me due to micromanagement more than balance.
As I said before, outlying provinces are great for merchants...while those mines do make a chunk of money, historically money also came from trade in chocolate and tobacco and slaves etc (which are there), and you're also losing about half of that money from mining to corruption. They're nice, but they're not worth going out of your way (ie fighting aztec hordes and spending years at sea) to get at the moment.
Was colonizing Americas ever profitable in any mod? I honestly admit I did zero balancing of Americas, since campaign never gets there.

Colonizing other resource-rich places like Timbuktu and Middle East is still extremely profitable, and you can fight corruption with law buildings, good governors etc.

Corruption is moddable by SIF_CORRUPTION parameter in data/descr_settlement_mechanics.xml if you wish to do so.

I never had any problems with it - are you moving your capital every now and then somewhere closer to the center of your empire? It will suck otherwise if it's on the opposite corner of the world.
If starting positions are more equal, you could safely reduce the peacefulness of Lusted's AI. The computer is very hesitant to declare war: you can practically ally with everyone in the game before they've got around to infighting, and it makes Europe in particular a very static place to be...as do the impregnable rebel settlements, but I've already mentioned those.
Which difficulty level is it? AI diplomacy is extremely dependent on difficulty level - it's meant to be quite peaceful on medium, quite hostile on hard, and extremely hostile on very hard.

AI also becomes far more hostile whenever it neighbours no rebel settlements to take. And since they last a bit too long, AI stays peaceful a bit too long.

If you play peripheral faction like Russia or Scotland, the game would be fairly peaceful anyway. Try playing as some mainland Catholic country and annoying the Pope sufficiently...

Starting positions were never equal in any Total War games, and it would be very strange to do so. If some faction is consistently far too powerful it would be a good idea to tweak that, but I never observed that (other than for whichever faction I'm currently playing)

It will take some time until I release the next version of Concentrated Vanilla, since I need to play at least a short campaign to test its balance, and I don't always have time for that.