Tab Completion

I'm Tab Atkins Jr, and I wear many hats. I work for Google on the Chrome browser as a Web Standards Hacker. I'm also a member of the CSS Working Group, and am either a member or contributor to several other working groups in the W3C. You can contact me here.
Listing of All Posts

An Abbreviated History of Al'Kemizri

Last updated:

I love the Civilization franchise for a lot of reasons, but one of the biggest is that it gives me a framework to hang alternate histories off of. AltHist is one of my favorite story types, in any genre or style, and writing my own as I play the game brings me a frankly ridiculous amount of joy. The last game I played ended up with one of my favorite histories ever, so I thought I'd write it up.

In several places I'll provide some game-related or meta-commentary on why or how something was happening. When I do, I'll put it in *(parenthesized italics)*. Also, the story will likely be somewhat disjointed snippets, as that's how I think it up anyway; I don't have nearly enough time or skill to knit it into a coherent linear story.

If you recognize some city names, it's because I was playing as the Indonesians, just with a custom empire name. I liked the city names well enough to keep them unchanged.

The World, and Kemizri's Founding

Our history starts on the super-continent of Eros: two continents, Westeros and Easteros, joined by a long, narrow desert isthmus. Westeros is a large fat rectangle, slightly tilted, so that its north-western corner joins with the northern ice-pack, and its south-eastern corner is hot, wet tropical jungle. The isthmus extends from the northeast corner to meet Easteros, a similarly-sized rectangle that is tall rather than wide, running from the lower arctic to the southern temperate zone. Right below the isthmus, in a bay between the continents, was a continental island, the only one of significance in the entire continental shelf.

*(Literally, a single tile, the only land in the entire world not connected to one of the two continents. The Indonesian special power is to get unique luxury resources from founding cities on non-origin continents; until I discovered deep-ocean sailing and visited the other continent, this tiny tile was literally the only suitable land in existence, so I settled it quickly. It wasn't the best city location, but the isthmus coast was within range with a bunch of resources, and most of the water was coast rather than ocean, so it wasn't that bad, either.)*

The Kemizri civilization was founded in the jungles and rainforests of southeastern Westeros, and quickly spread to the island in the central bay and the isthmal coast north of it. Kemizri civilization developed in two very different directions, almost forming separate civilizations entirely.

The western half, the Jakarta region, took a slower, pastoral approach to life. The forests were very fertile, and provided the region with ample food, allowing priest/intellectual/artist classes to form early and strongly influence the culture.

The eastern half of Kemizri, consisting of the island of Surabaya, the shallow coastal waters around it, and the isthmal deserts to its north known as the Spice Coast, were significantly different. A strong sailing tradition developed out of necessity: Surabaya was relatively small, but had abundant fish; the Spice Coast had room, but little life to fill it, and made up for it with abundant earth resources. This relationship created a vibrant trading culture that would come to dominate Surabayan life long into the future. Except for some border regions where Kemizri bled into Songhai, most foreigners only contact with Kemizri was with Surabayan sea-traders, leading to the common expression "Where there's coin, there's Kemizri".

Early Religion

Archeological evidence suggests Jakarta was actually host to the very first semi-organized religion. The citrus farms of southwest Jakarta led to a fertility-based sun-worshipping belief system. This focus on the sun and astronomical phenomena seems to have helped them plan plantings and harvests, leading to greater yields and increased growth in the area.

*(I chose Sun God as my founder belief, for the +1 food on citrus resources, which I had several of in Jakarta's reach.)*

This sun-based religion seemed to agree with the Kemizri, for it spread through the civilization, though it mutated significantly as it did. In coastal Jakarta it took on a more philosophical bent, in Surabaya it became a religion of the sea and sky, and the Spice Coast developed an ascetic, divine-vision&endash;based variant (likely aided by the hallucinogenic succulents native to the area).

This diversity of belief, while helpful for early spread, was eventually troublesome, as it prevented the Kemizri mystics from forming an organized front as foreign religions began to intrude.

Neighbors and History up to Medieval

To the west of Jakarta were several minor states, and the Songhai caliphates. They were largely friendly; a trading relationship quickly sprung up, trading the abundant cotton from the Songhai plains for the rare spices that grew only in Surabaya.

To the north of Surabaya, on the northern coast of Easteros, was the fledgling Roman empire. They were much less friendly, frequently rattling sabers over the natural resources of the Spice Coast that Kemizri claimed. The Romans were rather war-like, attempting to invade Jakarta several times but always foiled by the great inconvenience that the isthmus posed to troop movements, enabling Jakartan archers to pick off enemy armies as they trickled in, rather than ever facing a significant force at once.

Repeatedly foiled in their territorial ambitions in Kemizri lands, they eventually turned their eye westward and attempted an invasion of Songhai over the northern sea. This... went even worse for them. Their troops were routed by Songhai's far more experienced coursers, and then chased back across the bay, where Songhai laid siege to and quickly conquered all of Rome.

To the east, in central Easteros, the Mongolian nomads were a minor power. They too held a friendly trading relationship with Surabaya, and being completely unfamiliar with sea-borne combat, never attempted anything hostile. They would have one day competed for space with Rome, but Songhai was not interested in further expansion after the conquest, and Mongolia was not stupid enough to provoke such a power. Instead, Mongolia remained a relatively isolated backwater, occasionally making trouble for its neighboring minor civilizations, but otherwise staying off of the world stage.

The Ascent Of Islam

While Kemizri was the first to develop early religion, neighboring Songhai was the first to refine it, turning their traditional beliefs into a coherent system we know today as Islam. They developed a strong proselytizing tradition, with their Sufi nomads spreading the words of their Prophet far and wide.

*(The jerks quickly developed their religion twice, grabbing Itinerant Preachers for the second, which greatly expands the range that religion emanates from cities.)*

The philosophical traditions of Islam meshed very well with the traditions of Jakarta, and were quickly taken up by the region. Eastern Kemizri resisted much more strongly; the restrictions on commerce were irksome to the Surabayan traders, and the reliance on a clerical class conflicted with the personal revelations of the Spice Coast mystical traditions. In response, Kemizri religion was finally organized, blending together the disparate traditional beliefs of Eastern Kemizri into a semi-cohesive whole known as the Doctrine Of The Heavenly Gate. (The "Gate" referred to the Sun, said to be the gateway to Heaven.)

*(In game, I went with Church Property, because duh, and Divine Inspiration, which gives faith per world wonder, because I was really feeling the pinch from Islam and was quite behind in faith generation.)*

This effort was, unfortunately, ultimately fruitless. It was around this time that the Roman Conquest happened, and Songhai wasted no time in spreading making its new territories Muslim. With Islam to the west and north, and gradually spreading to the Mongol nomads in the east, Surabaya was forced to give up and officially adopt Islam as well. Heavenly Gate continued in a somewhat underground fashion, but mostly as a "sea religion", spread by and among sailors who rarely if ever saw an imam.

*(This gave me the "Converted!" Steam Achievement, for having my religion-founding city convert to a foreign religion. I... never expected to get that cheevo legitimately. Hey, it's a silver lining.)*

Of the two halves of the empire, Jakarta had a much more highly-developed artistic community. Most of its art was rooted in its sun religions, though, even after the conversion to Islam, which made it much less attractive to the rest of the continent. Surabaya's considerably less respected art community adapted to the continent's taste much more rapidly, and thus became the face of Kemizri art, to the extreme consternation of Jakartan artists.

Near the end of the Medieval era, a new sect of Heavenly Gate appeared and became briefly popular. Drawing inspiration from the dominant Islam, it focused more strongly on religious texts and art, and made a brief breakout in Surabaya and the nearby coastal regions. Islam was at this point unafraid to throw its weight around, though, and within a century Heavenly Gate had been pushed back underground.

*(I finally enhanced my religion and picked up Religious Texts, the best for late-game religious domination. There weren't many Follower beliefs left, as I was the last religion in the world to be enhanced, so I grabbed Religious Art for the Hermitage boost and thematic flavor.)*

*(For serious, tho, Islam had a bunch of prophets and missionaries hanging around when I tried to develop a stable geographic core for Heavenly Gate. It was so frustrating seeing my progress wiped out in only a few turns. >_<)*

The Kemizri Renaissance

After the excitement of the Roman Conquest, life settled down on Eros. Everyone was friendly, trade was plentiful, and the continent was united under a common religion. The Songhai caliphates were the undisputed military power of the region, but they had no reason to use that military. Surabaya developed a moderate Navy around the 1200s to deal with a major piracy problem off the Easterosi coast (several bandit strongholds developed along the central desert coast and severely disrupted shipping for a few decades, suspected but never conclusively proved to be funded by Mongolia), and maintained a presence in the waters all along the coast to ward off further pirate camps from developing.

Unsurprisingly, Kemizri was the first to develop deep-water vessels capable of crossing the ocean. Having saturated the markets across the continent, Surabayan traders were desperate for new locales to trade with. They were thus the very first to encounter the considerably more conflict-torn continent of Archeope.

Archeope was almost exactly opposite Eros, centered in the southern hemisphere on the opposite side of the world. It was shaped like a broad, fat lambda, with its feet curving around to almost meet on opposite sides of the antarctic pole, its center in squarely in the temperate zone, and a narrow head reaching into the tropics. Because both feet thrust into the antarctic ice-pack, they formed a central ocean separated from the rest of the global waters. (Eros almost had that, with its Northern Ocean, but Easteros's north coast was only barely arctic, and thus was always traversable.)

The western leg held the German empire, tilted more towards the center, while the eastern leg spawned the Zulus. The center originally held the Ottomans and Aztecs, but they were both conquered before I arrived.

Both the Germans and the Zulu were none too welcoming; while they were happy to see new trade with someone other than each other (having had a bunch of back-and-forth territory exchanges over the centuries), they made it very clear that there was very little land that wasn't considered the property of one or both of them.

But very little isn't zero. On the far western edge of Archeope, nestled between the minor nations of Bratislava and Antananarivo, was the glorious and unclaimed Mount Fuji, along with a bit of free coastal land. After establishing strong trading relations with the neighboring minor nations (and the others across Archeope, which were mostly concentrated in the lambda's "head"), Surabaya established the semi-independent colony of Medan.

Medan was a jewel. The Pacific Ocean coast, which spawned such terrible hurricanes in Mongolia, was placid and cool off of Medan, due to the antarctic current. The backdrop of majestic Mount Fuji was not only beautiful, but trapped the wet ocean air and kept Medan well-watered with plentiful rains. There were even exotic spices growing there, unknown to the rest of Archeope!

*(Woo Indonesian powers!)*

Around this time Surabaya organized its trading network into a loose world congress, the League Of Free Trading Nations, intended to help harmonize relations between nations and promote the progress of science and trade. The League's headquarters were, of course, in Surabaya.

The First World War

The serenity of the Renaissance did not last very long. The last territorial dispute between the Germans and the Zulus in the 1800s was a decisive victory for Germany, giving them full control of the old Ottoman and Aztec lands and pushing the German/Zulu common border eastward. This nearly doubled the empire's population, and the Germans quickly exported their cleverness and work ethic to the acquired territories. This resulted in them advancing technologically at a frightening pace, and at the beginning of the 20th century early German tanks were massing at the Zulu borders.

The war was fairly quick, as wars go. Horses and rifles simply weren't a challenge for armored tanks and machine guns, and the resulting treaties the Zulu were forced to sign were devastating to them - they gave up two thirds of their remaining territory and kept only a small coastal territory.

The seemingly effortless success of the war energized the German populace, and the leadership rolled it into an expansive vision of Manifest Destiny, belligerently speaking about the rights of Germany to all of Archeope. Troop movements near Medan in the 1920s revealed their hand, and was only avoided through fevered diplomatic negotiations, which resulted in Kemizri gold funding a final Zulu war (a quick and bloody victory for the German Empire). This "Necessary Bribe" was not popular back home, but in the few years of tense peace it bought, the homelands began throwing together a larger navy. No bribe could put off the inevitable, though. In 1935, Germany officially declared war on Medan, claiming it as ancestral territory of the German people.

Germany was a great power at this point. Its military tech and overall army were far beyond even the Songhai caliphates. It had an entire continent of well-developed cities churning out units, to throw at a single small territory, of a militarily weak nation, whose main territory was half the world away. Victory seemed a foregone conclusion, the war declaration almost an afterthought. "We will be greeted as liberators", their politicians proclaimed, "and free them from the Islamic tyranny. German Christendom über alles!"

What they did not count on was the strength of the trading ties Surabaya had established over the world, nor the geographic hazards the Medan/German border brought into play. Zululand was mostly easy plains and light hills, trivial for tanks to roll through. Medan sat on a coastal protuberance, exposing relatively little of its face to the continent, and Fuji sat right in the middle of that, leaving only two narrow coastal pathways to the north and south. Any army attempting an invasion would have to split itself in half, greatly limiting the force that could be brought to bear at a time.

*(It was pretty perfectly placed - 3 of its surrounding hexes were ocean, and Fuji was right in the middle of the three land hexes. There was a single hex to the northeast and southeast to approach the city from, meaning at most two attackers at once.)*

As well, Medan's neighbors, the minor nations of Bratislave and Antananarivo, declared fiercely in their defense, vowing that no German troops would be allowed through their territory (which Germany would have to pass through to reach Medan) without a fight. Germany began its assault of Bratislava, and the war was on.

*(This was the other perfect piece of the war. There was technically one tile of direct Medan/German border that they could have sent troops through, but Germany could not resist attempting to invade the minor nations. Whenever it tried to send troops around the north, they'd get diverted and try to take Bratislava. When it tried to send troops to the south, well, Antananarivo was right there, they can't not try and take it, right? And Bratislava especially was super defensible, with only a single adjacent land hex, which Germany often filled with a machine gunner (a ranged unit, incapable of actually taking a city). Without them repeatedly taking the brunt of the invasion force, I'd have lost this war quickly.)*

The war went on for over a decade, with the Germans bogged down in the Bratislavan hills. The Surabayan navy provided desperately-needed fire support, bombarding troop formations near-constantly. Bratislava and Antananarivo both fell repeatedly to German troops, but the bravery and skill of Surabayan sailors liberated them each time, causing further delay for the German offensive. Through all this, German troops only even set foot on Medanese soil once, during a protracted retaking of Bratislava where the way was clear for a few years. In the nick of time new fleets arrived from the homeland, tho, and they were fought off.

The strength and bravery of the Surabayan navy, and the sacrifices and stubbornness of the Bratislavans and Antananarivans in defending their trading partner, was holding off the German advance. But the stalemate couldn't last forever. Germany was remembering that it wasn't just a land power, and the new ships coming out of the Ottoman coast were frightening steel destroyers, overpowering the outdated Surabayan wooden frigates. Cannons really weren't a match for sea-borne artillery, and the war seemed to be turning back to Germany's side.

*(I retook Bratislava three times, and Antananarivo twice, liberating them back to independent countries each time. They were amazing.)*

Resurgence of Heavenly Gate

Throughout this World War, there was one notable participant missing. The Songhai caliphates had made a token war declaration in support of Kemizri, but other than a single weak fleet which held back merely to monitor the war's progress, the caliphates didn't lift a finger in defense. The unity of Dar al-Islam was suborned by geopolitics, as Songhai prepared itself for the inevitable German domination of the Archeope continent.

This, understandably, caused great consternation among the religious communities of Medan. Muslims were supposed to stand together in common defense! Especially when religion was so explicitly used as a justification for the war - Germany alleged that Medan's Christian communities were being oppressed by the Muslim majority, as one of its cassus belli.

There were also unpleasant racial overtones mixed into this debate. Both Germany and Songhai, centered in cold temperate climates, were predominantly white nations. Kemizri, being a tropical nation, was predominantly black (and much of Medan's population was from Kemizri immigration, so it leaned heavily that way too). Seeing the caliphates seemingly agree to allow another white empire to conquer their black Muslim brothers did not sit well with many Medanese.

Standing in stark contrast to both apathetic Islam and hated German Christianity was the unofficial religion of the Surabayan navy, Heavenly Gate. The appeal of a religion that was both "native" and actually seemed to care about them was too strong to resist, and Medan had a religious revival near the end of the war, with it and its neighboring allies mass-converting to Gatism.

This was the spark that lit a great fire later termed the Great Revival, as the religious fervor spread through Surabaya's trade network. Most Kemizri trading partners followed along and converted to Gatism, Surabaya's own underground Gatist community exploded, and even Mongolia was infected with the new faith. In less than two decades, Islam had shrunk from a world-spanning behemoth to being just the continental religion of Westeros and the Roman territories.

*(Really, I'd just forgotten that I could buy Prophets with faith, and so had been accidentally stockpiling it for centuries. I'd already been saving some prophets (gifted to me by city-state allies), so when I could suddenly buy three more, it was time to bust the fuck out. I was a little scared that Islam would just re-convert a bunch, but it looked like they'd spent their load on conversions back during the Renaissance, and couldn't really afford prophets or missionaries any more.)*

With Islam's shackles on trading and commerce thrown off, Surabaya became the epicenter of a financial revolution. This sudden influx of new cash was vital in ending the world war and repositioning Kemizri as a world power.

*(FINALLY, Church Property started flexing its muscles. The extra 50 gold or so per turn was really useful at fixing up my navy and converting more city-states into my allies.)*

The End of the First World War

Jakartan scientists had been desperately trying to replicate Germany's successes at industry and engines through the entire war, and with the country's coffers suddenly overfull, increased funding led to a breakthrough in ship-building tech. While the Germans were once again sieging Bratislava, the navy around Medan was quickly and quietly upgraded from frigates to the frightening new battleships. The seamen adapted immediately to the new cannonry, learning to push them to operating efficiencies beyond the engineer's dreams, and began finally making headway against the German invaders.

*(All that bombardment levelled up my frigates so much that, right around the time I discovered Battleships, they had all picked up the Range upgrade. Going from a 2-range frigate to a 4-range battleship (battleships themselves coming with a 3-range, +1 from the upgrade) with double the attack strength meant I could finally go on the offensive, as I could now attack cities from outside their defense range.)*

The new cannons made quick work of the Bratislava siege. Leaving behind a small defensive force, the newly-invigorated navy pushed onward, to the German-Ottoman territories that were producing most of the German navy. Extended shelling, and a desperate focus on reducing Germany's capacity to make war, reduced Ankara and Bursa utterly to rubble; a more moderated offensive merely captured Istanbul and Edirne and revitalized the Ottoman government as an ally.

With the entire western seaboard of Archeope now out of German hands, the focus turned to the east. After a quick diversion to reclaim Bratislava again, the fleet circumnavigated the continent and took a few years to easily liberate every Zulu city within reach of the battleship cannons. Peace talks began in 1943, with Germany agreeing to stop all aggression and pay significant reparations.

*(They gave me all of their luxury resources, yesssssssss. And all my new Zulu puppet-cities quickly started pumping out a ton of science, gold, and culture. Kemizri is finally rivaling Songhai and Germany!)*

With Zululand and the Ottoman empire no longer under Germany's thumb and eagerly trading with Kemizri, Heavenly Gate spreading throughout the world and promoting heavier trade, and the Surabayan navy throwing around their fierce reputation as the undisputed masters of the seas, Kemizri's reputation in the world increased dramatically. It went from being a small trading nation, practically a caliphate of Songhai, to being a vibrant and powerful player on the world stage, able to rival or beat any other country with its dominance of trade and sea-based military power.

The Modern Age, and the Ascension of Kemizri

Of course, you can't keep an aggressive empire down for long. The reparations bankrupted Germany, and sent it into a terrible depression. The German people blamed Kemizri, and its leaders fanned that unrest and turned it into political power. Barely a decade after the cessation of hostilities, Germany, with a newly rebuilt panzer army, declared war on the Ottomans. This was clearly a proxy war with Kemizri, and they responded in kind, declaring war against Germany in support for the Ottomans.

World War 2 stretched on for quite some time; Germany still held a decisive tech advantage and had finally cracked the airplane code, using bombers liberally. But they were entirely without any coastal cities, and thus had nothing to counter the Kemizri navy. The result was an odd stalemate - every territory that Germany tried to invade was coastal, bringing their armies within range of Kemizri cannons, but the remaining German cities were all too far inland to reach with the navy, and Kemizri had next to no ground forces. Aside from a quickly-reversed blitzkrieg that temporarily took Antananarivo, Germany made absolutely no progress in the war, and eventually their economy and national spirit broke from the never-ending wastage of lives and materiél. After a desperate and horrifying last-ditch nuclear attack against Medan (the Germans having split the atom during the war), they finally gave in. The peace accords ceded the rest of Zululand, shrinking the empire to the historical boundaries of native Germany, and laid even heavier reparations on the country.

*(They literally nuked Medan and then offered generous peace terms in the same turn, bastards.)*

Meanwhile, Eros was in a second renaissance. Kemizri's newly-opened trading relationships with the non-German half of Archeope continued and grew stronger throughout the war, with the attendant cultural intermingling resulting in massive technological strides that finally brought them into the modern era. *(And, finally, forced them to reluctantly adopt the combustion engine. Not entirely certain how they had battleships without it, but hey, tech trees are weird.)*

The League Of Free Trading Nations now had true teeth internationally, and just in time. Songhai's gradual cultural ossification culminated in them forming an officially fascist theocracy, and saber-rattling a bit. Not one to be threatened (and secure in their defense by the rebranded Free Trade Navy), the League (in truth, Surabaya) declared Gatism the world religion, and began pursuing an explicit doctrine of freedom and liberty.

*(Germany and Songhai were both dedicated to Autocracy now, while I went for Freedom and rushed Treaty Org (+4 influence with city states every turn you trade with them). Oh god, finally the League was firmly under my control. Repeating World Islam and replacing it with World Heavenly Gate finally shifted the balance of power in Easteros; combined with Religious Texts, Gatism now emits 7.5 pressure per city, drowning out Islam's 4. Gatism's hold on Mongolia tightens, and the Roman territories finally get more Gatist pressure than Islamic. Finishing off the conversion of the minor powers means that Surabaya is no longer inundated with trading-derived Islam pressure, and is no longer under threat of a slight Islamic majority.)*

A quick diversion is in order, as Mongolia suddenly held some interesting relevance. As Surabaya was their main trading partner, they signed the Declaration of Liberty as part of the League, officially embracing freedom and democracy. But Songhai was not willing to give up cultural hegemony over Eros; a number of public assassinations of pro-freedom governors, only barely concealing their Songhai connections, led to the Mongolian government imposing martial law "for the protection of the populace" and quickly passing a number of laws restricting religious and political freedom and tightening relationships with the Roman-Songhai territories. The metropolitan north, with more direct ties to Surabaya, erupted in unrest, which quickly moved into an open civil war. It lasted two years, and ended with the creation of the independent Republic of Beshbalik, which became a member state of the League.

*(Mongolia immediately declared for Freedom as soon as they went entered the Modern age, to match me, their best friend, but Songhai's cultural influence was too strong, and they switched to Autocracy not too much later. They were now trapped, with the two highest-culture civs both neighbors and pulling them in opposite directions. I didn't even realize was was going on; there was still some unsettled territory in Easteros, so I figured they were just having some barbarian problems, not a literal civil war, as I'd never seen that happen before. Having their biggest city defect to me was another first! Very exciting times.)*

The End of the Game

The rest of the modern era was a predictable slide to Kemizri dominance. Germany tried another war against the Ottomans, and again made no progress due to their troops being shelled to death as soon as they came within four hexes of the ocean. Unfortunately, they took Antananarivo while I was distracted, and while I was liberating that, they slid some troops into the Ottomans and took over both cities. I was on my way to retake them when they offered peace terms (again, immediately after nuking one of my cities), and as they were offering more interior cities that I still couldn't hope to take myself, I had to accept.

So currently, in the year 2065, Germany is left with Berlin, Hamburg, and two blockaded Ottoman cities which'll I'll retake as soon as the peace treaty ends. The Ottomans are actually still alive - in the middle of this last war, they sent out a settler and founded a small city on the east coast of Easteros, just outside Mongolian territory. I wish them well, as I'm keeping those coastal cities when I retake them this time. It's too annoying to keep a tiny ally alive when a land-hungry militaristic neighbor is around. I could produce some artillery and tanks and roll through the rest of Germany now, but there's not really any point; I've already won, and I might as well let them keep their dignity.

And that's the history of Al'Kemizri, the most interesting empire I've ever had the pleasure of playing in Civ.

Tips On Keynoting, from Chris Coyier

Last updated:

Last year I was asked to keynote SassConf (it was incredibly great! everyone should attend this year!). I'm an experience public speaker at this point, but I'd never keynoted before, and I was pretty nervous about it, especially at a conference slightly outside of my tech comfort zone.

So I asked Chris Coyier, who's keynoted from hell to breakfast, what to do. His advice was really helpful (and I should have followed it even more closely). I just ran across it today when searching my email, and thought it could help other people too:

You're right in that often keynotes have a different vibe from the rest of the talks. They are often stories, personal experiences, walks through history, and more often than not, focused on inspiration. The idea being - "isn't it weird and cool that we're all together in this room? Let's consider a reason why that might be - and go get em tiger!" I can imagine you telling a cool story about how you got into CSS and how that lead to being possibly the most influential person in the future of CSS today. Or perhaps how you feel about CSS as a language. What it means to the web, what it means to the world, it's successes and failures. And perhaps where it's going, but light on the feature-by-feature rundown. Or maybe attempting to answer the question: is CSS going to be around in 10 years? 20 years? Is there any way to answer that question without gut instinct?

Obviously some of this, especially the second paragraph, is kinda specific to my own situation, but it's still all good general advice for anyone wanting to give a keynote, or anything similar. Hopefully this helps someone else!

Depixelating Pixel Art

Last updated:

For my future use, I distilled the algorithm for depixelating pixel art into its component steps, minus the explanations and figures.

I've also copied this over into a GitHub project, which will host the code when I write it.

General Algorithm

  1. Construct a graph where each pixel is a node, connected to its 8 neighbors.

  2. Remove all edges between nodes with "dissimilar" colors. (In YUV, colors with dY>48, dU>7, or dV>6.)

  3. Examine all four-squares of nodes:

    1. If all four are fully connected, remove the diagonals. (It's a block of the same color.)
    2. If they're only connected via diagonals, use feature detection to tell which diagonal to keep:
    3. Compare the length of the curves (valence-2 nodes) that each diagonal is a part of. Cast vote in favor of the longer one, with weight equal to difference.
    4. Compare the size of the connected graphs each diagonal is a part of, in an 8x8 window. Cast vote in favor of the smaller component, with weight equal to difference in size.
    5. If either diagonal connects directly to a lone pixel (valence-1 node) cast a vote in favor of it, with weight 5 (empirically determined).
  4. You now have a fully planar set of disconnected graphs.

  5. Chop each connection in half, associating each half with its closer point. Construct a Voronoi diagram from each of these points+half-connections. Quantize the Voronoi to a quarter-pixel grid.

  6. Simplify the Voronoi diagram by collapsing valence-2 nodes into lines that connect their higher/lower-connected endpoints.

  7. You now have the basic depixelated shape.

  8. Walk the graph of cell points (nodes). Ignoring junctions separating similar (connected) cells, find all runs of valence-2 cell points and turn them into quadratic b-splines, with control points set to the nodes.

  9. Simplify all 3-spline junctions.

    1. If one of the splines is a "shading spline" (separating two areas with YUV distance <= 100) and the other two are "contour spline" (YUV distance > 100), connect the two contour splines into one.
    2. Otherwise, find the two splines which connect with an angle closest to 180deg, and join them together.
    3. Keep in mind that the end-point of the non-connected spline of each triad will need to be adjusted to lie exactly on the curve defined by the connected splines.
  10. You now have a relatively smooth depixelated shape.

  11. Detect "corners" that shouldn't be smoothed away. Corners are all runs of 4-5 points that are related by the following 5 relations (plus rotations/mirrors):

    1. (0,0) (.25, .75) (.75, .75) (1, 0)
    2. (-.25, .25) (.25, .75) (.75, .75) (1, 0)
    3. (-.25, .25) (.25, .75) (.75, .75) (1.25, .25)
    4. (0,0) (0,1) (1,1) (1,0)
    5. (.75, -.25) (.25, .25) (.25, .75) (.75, .75) (1.25, .25)
  12. Optimize all remaining nodes by minimizing an energy function over them. Each node contributes the sum of:

    1. Curvature. Integrate the curvature function over the segment influenced by the node. Can use simple numerical sampling here.
    2. Position deviation. Take the fourth power (empirically determined) of the distance between its current location and its original location.

The energy function is non-linear but smooth, so you can do local modifications by randomly selecting nodes, randomly jiggling them to find a lower-energy state, and repeating until satisfied. Paper doesn't specify how many iterations they used.

  1. Rejigger the "corner" nodes to match up better with the energy-minimized nodes and minimize cell-shape distortion. Paper is unclear here: use harmonic maps; it's solving a simple sparse linear system; [Hormann 2001] has a full explanation.
  2. Remember to rejigger the endpoint of the non-connected spline in each triad connection!
  3. Render the graph accordingly. [Nehab and Hoppe 2008] Each reshaped cell diffuses its color from its centroid, constrained by the spline boundaries? Simpler if you assume that all color differences are significant; you get more contours, but they're all solid-color and look pretty good. (And can actually be done in SVG, which doesn't have diffusion-based paint servers yet.)

DONE.

Future work

  1. Detect dithering patterns used in color-constrained graphics, and consider them part of a single solid-color region.
  2. Detect "corners" (junctions where long straight lines meet) and increase the multiplicity of the knot vector to get a sharper corner.

Refs

NEHAB, D., AND HOPPE, H. 2008. Random-access rendering of general vector graphics. ACM Trans. Graph. 27, 5, 135:1–135:10.

HORMANN, K. 2001. Theory and Applications of Parameterizing Triangulations. PhD thesis, University of Erlangen.

Switching Your GitHub Repo To Use Only The gh-pages Branch

Last updated:

(This is a simplified version of the advice on Oli Studholme's blog, cut down to just the parts that I've actually needed. I do this often enough, and always forget the steps, so having it put down here is useful for me, and maybe for someone else.)

So you want to serve your repo from the http://user.github.io/repo url, and don't have any reason to separate a "code" and "serve" branch. In other words, you want your GitHub repo to only use the gh-pages branch, not master. Here's an easy guide to making that happen.

First, if you already have a gh-pages branch, make sure it's synced up to master, showing exactly what you want. If you don't, type:

git checkout -b gh-pages
git push origin gh-pages

Second, go to GitHub, settings for your repo, and switch “Default Branch” to gh-pages.

Third, delete the local master branch with git branch -d master.

Finally, delete the remote master branch with git push origin :master.

Done. You now have only the gh-pages branch, and it's the default one that git will use when talking with GitHub.

A Quick Primer on P and NP

Last updated:

(This is a quick gloss over the problem, intended to give someone a good idea of what's going on without bogging down too much in details. Pretty sure I've gotten it right, but if I'm slightly off about something, don't worry about it.)

So, a lot of problems sit in P or NP complexity classes. This classifies a problem based on how quickly the time-to-solve increases as the size of the problem increases. Adding two numbers is linear - double the size of the numbers, you double the running time. Multiplying two numbers is (roughly) square - double the size of the numbers, you quadruple the running time. Bruteforcing a password is exponential - double the size of the password, you increase the running time by ~60^n (where n is the original size).

Linear and square are both "polynomial", or in P, because the relationship between problem size and running time can be written as a polynomial equation where the problem size is the base and the power is a static number. Adding is "size^1 = time", multiplying is "size^2 = time". Password cracking is not polynomial, because its equation is "60^size = time" - the size is a power, not a base.

NP doesn't quite stand for "non-polynomial", but it's often described as such, and that's pretty close to what it means. There's an extra wrinkle, though. NP actually stands for "non-deterministic polynomial", which means that if you had a magic 8-ball that you could ask yes/no questions of and it always gave the right answer, you could solve the problem in polynomial time. Bruteforcing passwords is like that - if you can just ask the oracle "is the first letter A? is it B?" etc, you can figure it out in linear time (roughly 60*N, rather than 60^N). A lot of exponential problems are like this - there's not actually that much work that goes into solving it, it's just that you don't know where to do the work, so you have to try every possible combination. The oracle fixes that.

An alternate definition of NP is that it requires at least polynomial time to solve, but only needs polynomial time to verify the solution. Again, passwords are like this - if someone claims they know the password, you can tell if they're right by just checking it against the real password, which is linear time (checking each letter).

The definition of NP technically covers everything in P as well. There's another category, NP-complete, which means "the hard part of NP". Most of the time, when people say "NP" they actually mean "NP-complete".

Quick diversion - it's still an open question whether P and NP are equal to each other. It might be that, with very clever algorithms, password cracking can be done in polynomial time. Most computer scientists don't think so, but we haven't yet been able to prove that it can't be done. (We can prove that some complexity classes are definitely different, but P and NP haven't been achieved yet.)

So, we don't yet know whether the NP-complete category is part of P (if P=NP) or is a hard chunk separate from P (if P!=NP). We do know, though, that some problems are definitely in NP-complete - they're the "hardest possible" problems in NP. (though, again, they might still turn out to be in P as well). We started out with 21 examples of NP-complete problems, and now we mostly add new ones by proving that you can transform the new problem into an NP-complete one and vice-versa (in polynomial time).

The NP-complete category is useful because it's big and connected, so that if anyone can ever prove that any single NP-complete problem is in P, they prove that they're all in P automatically.