Monday, March 28, 2011

My sentiments exactly

"They probably taught you different in marketing, but renting property, it's never seemed an honourable way to make money to me," Yasar says.  "Using money to make money."

"Isn't that what this is about, getting finance to make more finance?"

"This is getting finance to make something that will change the world. Notice the two little extra words in there? 'Make something.'"

  - From The Dervish House, by Ian McDonald

This quote has been on my mind lately, as I consider new employers with the hope of finding something more fulfilling to do than leveraging technology to market products to people who really don't need them.

"Make something."

I heartily recommend, well, everything by Ian I've been able to get my hands on.  His treatment of a future India as told by River of Gods and Cyberabad Days was startlingly good -- not because I had low expectations, but because he starts with a culture which is already foreign to me and extrapolates it into places which you can't help but be changed by visiting.

Tuesday, March 8, 2011

KB2505438: Windows Update fail

Windows Update KB2505438 gives users the following description:  "Install this update to resolve issues in Windows."

Issues?

Issues.



I'd like more information, please.  Fortunately there's a "More information" link provided for those who'd prefer not to blindly patch their operating system with no prior notification of what is about to be changed.  Here's what happens when you click the link:

You are redirected to a parking domain which is not owned by Microsoft.  It comes complete with a catchy title:  "Bug free software just has random features."  The screenshot may be missing the full glory of this page because I refuse to display it in IE.

UPDATE:  This is apparently due to a typo.  Someone at Microsoft misspelled Microsoft.
More information:
http://support.micrososft.com/kb/2505438
What amazes me is that it's even possible to make a typo here.  There's no macro for the knowledge base domain name?  This just can't be stored as unconstrained text in hundreds of thousands of documents.  Can it?

Saturday, March 5, 2011

Minecraft procedural texturing success

Followup to the Temple of Rule 30:  I made another attempt at mapping the output of a 2D cellular automaton to 3D objects in Minecraft and had better luck with a different ruleset.  It can work, provided you choose the rules carefully and work only with large objects.

Here's a sampling of various block mappings used with the same algorithm on a 125 block diameter sphere.

Subtle & mossy
Nested bands of ore
Not-even-remotely-subtle edition
Pig approves.


With a little more work, I might be able to recreate Planet Bitmap from STNG...

Hmm, there's an idea:  Glowing planets in the night sky.  Pity the world is 30 million blocks wide but only 128 blocks tall.

Wednesday, March 2, 2011

Minecraft, Python, and the Temple of Rule 30

I've noticed in my recent job search that Python is a commonly requested scripting language.  I haven't really had much interest in learning it; several years of Ruby (on Rails), a long stretch of Perl, and various other languages at various levels of abstraction ranging all the way down to assembler have made it quite clear that there are only so many ways to express a control flow statement.  I feel that a computer language, as with any tool, should include staying out of your way as a central part of its design philosophy.  Ruby is very good about that.

So why learn Python?  Because it's frequently used as an embedded interpreter.  It's used to control and extend other software.  But what does this have to do with Minecraft?  MCEdit includes a Python interpreter, and I've been using MCEdit quite a bit.

I decided one day that I'd try to clear a large ziggurat-shaped space underground using more or less the same techniques used for TNT drift mining, only without leaving any of the intervening walls standing.  I'd clear the whole space and make the walls nice and tidy.

Right.

As amusing as it is to blast the hell out of stuff in Minecraft, clearing layers of 5x5x5 chunks became mighty tedious by the 5th layer down, at which point the floor was roughly 45x45.  Roughly, because some very large dirt and gravel inclusions were making a mess of things.  There was still a long way to go to bedrock.  I have my kinks, but holding down a mouse button long enough to remove or replace c. 73,000 blocks and calling that "fun" isn't one of them.  It was time to bring the power tools into the sandbox.

A long editing session brought the the pattern down to bedrock, exposing an existing railway and a bunch of deep caves I'd explored earlier.  I cleared out the lava and cleaned up the walls.  Here's the result.  The floor is 125 x 125, with torches in the middle of each visible 5x5 face.


Great!  All done.  The simple repeating patterns of light and dark and the hundreds of pinpoint torches looked quite nice.  But after riding through it and viewing the room from many angles, I thought it was missing a little something.  How about some texture?

This is where Python comes in.  Why not script a volumetric texture generator and use it to "paint" the world?  I had a vague idea that cellular automata might be up to the task, rather than using discrete samples of continuous functions.  Water and lava already appear to follow CA rules, and Minecraft is basically a voxel space you can walk around in.  This seemed a perfect match.  Elegant, even.

It's been a long time since I played with CA.  It's a topic I revisit every few years as a sort of touchstone for how insanely fast microprocessors have become,  like watching real-time fractal renders on a GPU while still having a memory of waiting for a single low-res Mandelbrot render to fill in one scan line at a time on workstation-class hardware.  Well, it's 2011, and now we have Golly and people simulating Conway's Life inside Conway's Life (sort of) just because they can.  I love it.

I experimented with Golly for a while and decided to implement a Generations algorithm with NumPy.  Generations is Life-like, but cells which are marked for death are not zeroed out immediately; instead they age for a certain number of iterations before they are removed from the grid.  This spreads out the active growth regions and tends to make the patterns flow rather than shimmer.

After a lot of trial-and-error, I was able to fill a 3D selection within MCEdit using two dimensions for the CA grid and one for time.  It worked, and I learned a bit of Python and NumPy in the process.

There was only one problem:  The results looked awful.

Within Golly, iterations of the Generations rule are expressed as video, with subtle changes in color indicating the changing age of each cell.  The result is a gnarly, mesmerizing wash of color.

Generations rule S2/B13/15 starting with only 5 living cells,
at 20, 100, 500, and 1000 iterations



But regardless of how I mapped the CA into the world, the subtlety was lost.  It always looked either streaky or random.  Part of the difficulty was the deliberate lo-fi look of Minecraft itself -- a smooth color palette isn't really possible -- but it was mostly due to the translation of time into depth.

Back to the drawing board.  I could continue to tweak the 2D CA and mapping rules to look for a pleasing translation, but a different approach might be more appropriate for this particular application.

How about a 1D CA instead?  I could run a 1D rule to create a 2D array and then project that into the 3D world.  This simpler approach actually looked much nicer in tests.  The most complex part turned out to be the projection of the texture onto the "front" of an MCEdit selection volume which has no knowledge of where the camera is located.  I handled this by requiring that the center of one side of the selection contain nothing but air; it's assumed that the camera isn't inside a solid object.

Here's the final appearance.  All the torches have been eliminated and the walls "textured" with glowstone and obsidian based on Rule 30.


Sort of a cross between TRON and the Luxor Las Vegas.  :)