2010-02-23

Garbage collection considered harmful

I think garbage collection is one of the biggest disservices modern programming languages brought upon us. It is touted as a silver bullet and apparently no new language can live without it. Java, Python, PHP, ActionScript, VisualBasic, C#, Ruby, ...

Why do I think garbage collection is evil?
  • the problem it promises to solve isn't actually solved. You can still easily get memory leaks by building circular references or forgetting to unregister event handlers. However now these leaks are much harder to track down and fix.
  • the problem of memory management, i.e. efficiently using the available memory is made tremendously harder. You give up all control over when or even if your objects get collected. There is no easy way to make use of the problem domain knowledge the programmer has and the garbage collector hasn't. If I know in advance I'll need a lot of memory the next frame it makes sense to clean up ahead of time. The garbage collector can't know this and will be caught off guard, causing performance drops. Also, how much memory is wasted for "zombie objects", that just linger around, waiting to be collected? Trying to fine tune an application's memory profile and reducing it's footprint feels like having to work blindfolded, in a straight jacket with your feet stuck in the mud.
  • as far as I know no one has figured out yet how to combine garbage collection with deterministic destruction. Destructors in garbage collected languages are either non-existent or worthless because you don't get any guarantees when or if they'll execute. This kills one of the most useful programming idioms ever invented: RAII, or Resource Acquisition Is Initialization. You acquire a resource in a class' constructor and release it in the destructor. There is a well defined sequence of events and the destructor is guaranteed to be called, you cannot forget to release the resource. And before you say garbage collection makes alloc/release patterns obsolete think again. There are other resources besides memory that follow the exact same pattern with potentially catastrophic consequences if you forget to release them: file handles, network connections, vertex buffers, audio loops, database connections, database transactions, locking textures, mutexes... I'm sure you can think of more. And this is not even accounting for application specific logic like undo/redo patterns.
  • this is related to the previous point about RAII. Without deterministic destructors writing exception safe code becomes very hard indeed. Instead of having all your classes clean up automatically after themselves you have to manually remember to bracket everything with try/catch/finally clauses. As a direct consequence you'll need absolute information about what code may throw exceptions and when. Knowledge that often has nothing to do with the problem at hand, is easily forgotten and is often buried under layers and layers of code. Hence Java-like crutches of requiring exception specifications for every method.
  • you lose value semantics for everything but the simplest native types. There is a distinct divide between native types like int and objects. While the former are passed around by value the latter can only be passed by reference. This causes lots of confusion and ugly hacks (Java's int vs Integer) and often forces you to write less efficient code.

Contrary to popular belief memory management is not a problem in C++. In fact, in modern C++ you hardly ever allocate memory directly. I can't remember the last time I had to search for a memory leak but I do have to minimize memory usage of my programs constantly. Yes, even in times of multi gigabyte RAM machines you easily exhaust that memory when dealing with lots of concurrency or just large complex problems. Now garbage collection solves a problem I don't have (leaking memory) while making a problem I do have (using too much memory) infinitely harder to solve. And before anyone says I just haven't discovered my leaks yet - some of my stuff has to run 24/7 under heavy load, even small leaks will quickly become apparent in such a situation.

Trusting the garbage collector to solve memory issues for you is like sitting in a burning house, closing your eyes to the problem and repeating to yourself: "Everything's gonna be fine. Everything's gonna be fine." until you go up in flames. Memory leaks aren't the problem, using too much of it is.

Summary: I hate garbage collection and the sooner the world rids itself of that addiction the better.

2010-02-10

Operation Survival Server

Being a persistent multiplayer game Operation Survival needs a server running the show in the background. My first gut reaction was to use Apache and build the game logic on top of that. There is a host of programming languages to choose from and if that wasn't enough I thought I'd just implement my own cgi or plug-in module. Use an XMLRPC API to service game client requests and we should be all set - right?

Pondering this for a while I came to the conclusion that it would be a terrible choice. To start with I don't really need an HTML server for the game, so Apache won't help all that much. Of course the game will need a website, forum and all that stuff as well, but handling the actual game logic, database persistence and interactivity has nothing whatsoever to do with HTML. Second, a regular connection to your web server is stateless and one-way. Stateless means the client needs to re-authenticate (supplying its session id or user credentials) with every request. One-way means there is no way for the server to initiate communication with the client. This is essential though! Imagine how real time updates as you'd need them for a chat would work: The client has to poll in regular (short!) intervals and ask the server for new data. Most of the time the server will just answer: "Sorry dude, no news.", creating unnecessary traffic. Now imagine a thousand clients asking the server every half second. This quickly gets out of hand.

So what I really need is a persistent two way connection where clients only authenticate once for a session and the server can send data on its own initiative. That's a socket connection or socket server.

There are several free, open source and commercial offerings in this field. Unfortunately most of them are written in Java. I really don't like Java (a rant for another day) and since the most important ingredient for success of a hobby project is motivation, working in an environment you don't enjoy constitutes a really bad start. My language of choice is C++, so I'll want to have a server written in C++.

The server will have to implement pretty much all of the game logic (never trust the client), will have to do all authentication, database connection management and socket connection management. It'll have to run 24/7, be parallelized (in order to handle multiple simultaneous connections well and take full advantage of today's hardware) and be reasonably efficient so it won't break down too quickly under load. It should be stable and resilient against the most common types of attacks (SQL injections, floods, spoofed packets, ...). It should be able to compose individual messages into larger packets in order to bundle traffic into few packets per second/per client. It should be able to gracefully deal with error states like unexpectedly disconnected clients, slow connections or garbled packets.

Since browser games must be considered a service as opposed to shrink wrapped product, programming and content creation tasks once the game is successful will be at least as important as during initial development. This means hot-patching and updating the server with new content and bug fixes should be painless and without interruptions of service. C++, being a statically compiled and linked language, isn't very good for this type of problem. However, all things considered, I still believe it to be the best choice. I hope to work around it's limitations with a very data centric design and maybe one of these entity systems that seem to be all the rage amongst game developers lately.

Tall order? Probably. Fun? Sounds like it to me ;-)

2010-02-01

Flash, Silverlight, JavaScript, Java, Unity - oh my!

I have decided to make Operation Survival a browser game. Given my design ambitions. I think that is pretty much the only viable choice. The next thing to decide is what exact technologies to use client side. The game requires some interactive 3D graphics (the globe and the isometric tactical view) and should look and feel like a dynamic game not like a static website. My options pretty much boil down to the following:

  • JavaScript: There are huge differences in performance and feature sets as implemented by the various browsers. People are still trying to figure out the best way to achieve even the most basic of tasks. It does not offer a good development environment I'd feel comfortable with. It doesn't offer the breadth of libraries other languages do and it doesn't support socket connections which will be required for client server communication.
  • Java: A fully featured "real" programming language with a huge selection of libraries and development tools. However, the browser experience leaves a lot to be desired and lives a niche existence. Java applets feel slow to load, slow to display and don't integrate well in the browser. Still, there are good examples as well and Java would certainly be a viable choice.
  • Unity3D: Very cool technology. The only one of the bunch supporting 3D acceleration. The development environment and content creation tools are top notch. It runs on the iPhone. Unfortunately it requires a custom plug-in thus presenting an extra hurdle. It's also not as mature as the others and the plug-in crashed my browser the first time I have tried it. It is not yet widely adopted and probably needs a big killer application to spread (what videos did for Flash).
  • Silverlight: Microsoft's offering trying to go against the dominance of Flash. Best of breed development environment in the form of Visual Studio. A choice of solid programming languages like C#. Hasn't spread nearly as far as Microsoft would have hoped for. I never could get the plug-in to work with FireFox. I also doubt Microsoft's ability and willingness to really offer wide platform and browser support. They are in a conflict of interests there - support Apple (Safari, iPhone)? Google (Chrome, Android)? Linux?
  • Flash: The dominant platform for rich Internet applications. Runs pretty much anywhere. Offers a decent standardized programming language with ActionScript 3.0. Unfortunately it is controlled by single company, Adobe, as well. However, I don't think Adobe is in a conflict of interests as bad as Microsoft is. There is a free command line compiler and usable free open source development IDE in the form of FlashDevelop. There are tons of libraries for graphics, user interface and even 3D. Market penetration is close to 100%. Everyone who has ever used online video from Youtube and the likes will have flash installed.
  • HTML(5), WebGL, ...: Although these sound very promising and some amazing demos of their capabilities exist they are not nearly ready for prime time yet. It remains to be seen whether they'll ever reach wide spread adoption and whether they actually offer what I need. My experience from working with HTML, CSS, JavaScript (i.e. Ajax) is that you spend the majority of your time fighting the tools and limitations of the environment rather than progressing with your actual content.

Given these observations I think Flash is the right choice. Write once, deploy everywhere is a huge advantage over write once, test everywhere like you had to do with HTML and JavaScript. It does require a plug-in, but the most ubiquitous and unobtrusive of the bunch. It is closed source and controlled by a single company, but again, I think the lesser evil of the given options.

So Flash/ActionScript it is.

Next up: What's it gonna be for the server?

2010-01-25

Operation Survival - design guidelines

One of my goals for Operation Survival is to make the barriers to entry as low as possible. This means a couple of things:

  • The user shouldn't be required to install anything, the game should just run.
  • There should be no platform or operating system requirements. In an ideal world it'll run on any device including PCs, smart-phones, consoles, eBooks, TVs and microwave ovens.
  • There shouldn't be any user interface surprises. My grandma's poodle should be able to pick it up and play.
  • The setting and genre should be somewhat familiar from other fiction. Originality is great and all, but I don't want to require the player to learn the inner logic of a wholly unfamiliar universe. I'd much rather take the real world and twist that in subtle ways. I think the cliche alien UFO conspiracy theories offer plenty of fertile ground for that.
  • Sign up and payment options should be as transparent as possible. There should be an easy transition from interested visitors, just wanting to grasp what the game is all about to fully invested hardcore players spending their life in the game world.
  • The game should be fully localized, no need to communicate in broken school English.
  • There should be an easy and obvious way to get support and provide feedback at every point during the game.
  • It should be easy for players to bond and build communities. Every effort should be made to create a newbie friendly, non-hostile environment.
  • ... I have probably forgotten quite a few more.

With such an ambitious set of goals it is obviously impossible to fulfill them all equally well. There will always be trade-offs and compromises and lots of the issues are a matter of personal opinion to begin with. Nevertheless, I think it's a good idea to state some guiding principles when fleshing out the design further, so that's what I'm trying to do here.

Considering all of the above and the fact that the underlying game design is fundamentally multiplayer I believe a browser based solution is the only way to go. Browsers are ubiquitous, the back button and links the universal user interface primitives everyone on the planet understands by now. Browsers run everywhere. Everyone that uses one is already connected to the Internet and thus able to play multiplayer. Browsers shoulder the burden of guaranteeing security. Everything that runs in a browser window is assumed to be safe while downloads are seen with skepticism by even the most naive of users.

So a browser game it is.

I'll post my thoughts on the other points soon. In the meantime: What do you think about those axioms? Anything missing? How would you weight the priorities?

2010-01-24

Operation Survival - humanity's last stand

I have a pet game idea and design lingering at the back of my head for close to 15 years now (I'm getting old I suppose). That idea was the reason for developing BlackFish, an isometric 3D engine. Back in the days we used C++ and DirectX7. Anyways, I still like the concept very much and nobody has produced the game in the meantime. So I have decided to give it another go.

If you know the old UFO XCOM series by the Gollup brothers you have a pretty good idea of what I'm aiming for. The game is a perfect blend of a base building, resource management and turn based tactical combat simulator. The premise is that the earth is under attack by aliens invading with small fleets of UFOs, performing various reconnaissance, raid or research missions - conducting nasty experiments with cows and such alien stuff ;-) The back story is not entirely original but very well done and plays expertly with real world conspiracy theories and ufology.

The game is roughly divided into three major parts:

The geoscape, a view of the whole world, floating in space like the vulnerable blue marble that she is. You choose where to build your bases in this view which affects which countries will pay you for protecting them. You also coordinate UFO intercept missions by launching your fighters after them. This part plays in real-time.

The battlescape, a 3D isometric view of tactical combat missions. After a UFO has been shot down or landed you send in your ground troops to clean up the place. The action is turn based and you coordinate up to around a dozen soldiers to find the surviving aliens and either stun and take them hostage or simply kill them. The missions are usually set in some idyllic small town with the UFO crashed in a corn field nearby. There is a strong role playing component as all your soldiers have names and individual abilities and stats.

The last part are the various resource management screens available from the geoscape view. You build out your bases with better radars, more research laboratories, better alien containment facilities, ground-to-air rocket defenses, living quarters for your soldiers and similar buildings. You also coordinate researching the found alien artifacts and interrogating kidnapped aliens. Once you understood parts of the technology you can start using and building it yourself.

In my eyes even to this day this is the greatest game ever made. The atmosphere it managed to create was just phenomenal. The genre blend worked perfectly and didn't feel tacked on or misplaced as is often the case with similar experiments. The scale was nailed wonderfully by contrasting the whole globe view with the handful of soldiers combat missions. You really felt responsible for the earth as a whole and bled with individual soldiers at the same time.

I'd like to update the original concept a bit because I believe it would make a perfect online multiplayer game. I imagine a continuously running, real time geoscape with hundreds of players. Every one manages a single base and flies intercept missions from that base. This would be a "massively" multiplayer part and allow for global events like coordinated alien attack waves which have to be fended off. The game would run in a browser and allow for very casual play sessions (during work ;-) ). You log in, play through some short aerial UFO dog fights, give some research and construction orders and log out again. Base building and research works as in most text based browser games which use real time as a resource (i.e. constructing a new laboratory takes 3 days). When you have the leisure for a longer play session you sit down to play a tactical mission. These would be turn based as in the original with some crucial changes. Most importantly they'd be multiplayer. The player who shot down the UFO "owns" it. He sends out his ground troops and may invite additional players to join him in combat. Once all players have joined the mission starts and lasts between half an hour to several hours. There is no load/save, death is permanent. This calls for careful balancing and ways to rescue dying soldiers as long as you still have some men standing but I hope to make the player really sweat for his men. There is a global ranking system with military ranks from private to general and you'll have to balance risking your top men in missions vs being overtaken by other players.

I think this design will fix lots of current multiplayer game offering shortcomings and make them work to its advantage. One is the investment of time. Current games are either very casual without any persistent state except for the high score (think connect-three flash mini games), require massive investments of time (world of warcraft) or don't allow you to invest more time when you actually want to because you have to wait around for the next event (text based browser game with real time resources like OGame). Operation survival tries to work on all of these time scales, adapting to and respecting the players busy life. Another point that really bugs me is the competitive nature of most multiplayer games. Often the player who invested the most time (grinded the most) automatically wins. Skill is a secondary issue, if at all. This leads to strong players totally dominating and exploiting new comers (farming n00bs). This again leads to lots of bad blood and grieving players and creates a high barrier to entry. Existing player protect their investment and actively discourage newbies. Operation survival has no means of direct player vs player offensive actions. All players pursue the common goal of protecting the earth. The only competitive aspect is in the various rankings and ladders. You want to be the one having the general, produce the most research, own the most resources, shoot down the most UFOs etc.

While lots of this may sound very derivative of the original UFO (and it should!) I do have lots of detailed ideas to make this work as a multiplayer game. More in the coming months...

This is a very ambitious project and will probably never see the light of day. However, it's fun aiming for the stars and working on it. My hope is that it'll eventually pick up momentum and I'll find supporters. After all, the original game was a labor of love of two guys as well. Maybe technology and productivity advances made since then allow the updated design to be realized by a small team as well? Today's expectations for browser game visuals and production values are around the level of the original UFO I'd say.

Dream big.

2010-01-16

Book review: ActionScript for Multiplayer Games and Virtual Worlds

This book is a huge disappointment. Despite the trendy topic and the promising title it completely fails to deliver. The crucial hint is the fact that the author is a founder of Electrotank. Because of that the book has become a thinly disguised advertisement for Electrotank's server product. Nowhere in the title or on the cover flap does it hint that all examples, text and code are basically useless without the commercial Electroserver. It would have been fair to distribute the book's content as free sample programs and tutorials with the server instead of selling it as a fully priced stand alone product. The way it stands it feels like a shameless rip-off.

There are lots of major shortcomings with the content. Despite dealing with network games there is basically no treatment whatsoever of networking protocols, encryption or compression schemes, redundancy or other such "minor details" that make networking code a hard problem. Instead it is assumed that all of these things are magically dealt with by the server product. In the same vain there isn't a single example of actual server code! There is a passing mention that you'll need to write plugins to handle the server side of things but you are only presented with half the game. Now to be fair the book is about ActionScript and you don't usually write the server parts in that language, but since the server is a non trivial part of any multiplayer game it would have been fair to spend a few words on that.

The chapter on security does mention many of the important topics that plague online developers. However, it stops well short of actually offering solutions to these issues. The advice can basically be summed up as "don't trust the client!". Cross site scripting, packet injection, SQL injection, hacking the client's memory and data encryption are all mentioned in small half paragraph passages. While the problems are well stated they can at best serve as entry points for google searches and in themselves offer very little actionable advice.

Many of the code examples in the book are worthless because they show long lists of member variable assignments. I knew how to do that, thank you. The interesting part is not how to assign _x = 12; The interesting part is how that object actually synchronizes itself with the server and other clients. An apparently unimportant detail that gets skimped over because Electroserver will magically solve that for you. Similarly, some code examples which are actually useful miss the topic of the book. A* pathfinding or rendering an isometric view, while well presented, have little to do with multiplayer.

Last but not least there are the factual errors. Things like a set of equations, which, when you actually solve them, present results such as "server time = server time + offset". Huh? Or errors in diagrams where a bar chart is shown and a line supposedly marking the median (not mean, mind you) which doesn't fit any of the values.

While it is clear that the author is knowledgeable on the topic and brings a lot of experience the resulting book is unfortunately quite shallow and superficial. It also seems as if the author deals with games in quantity, not quality. This is understandable, considering he's in the business of selling a back end product and that lots of low quality games is where the flash game industry as a whole is currently at, but it's nevertheless lamentable. I personally would have hoped for someone who lives, breathes and loves games and doesn't treat them as a commodity.

2009-09-30

id software is at it again

Siggraph paper about their new texturing algorithm. Way cool. Now that engines are almost up to rendering every last blade of grass and every pore of my skin the question becomes: who's gonna model/paint all of that? Reconstruct reality? I predict an interesting future for a blend of procedurally generated content and real 3D data acquisition. Play games on google earth or the procedurally generated Fuel? Mix! Augmented reality! Fun ;-)

2009-06-14

Battle at Kruger

Action, Thrill, Supsense - and all without special effects.

2009-05-21

Dabbling with Flash/ActionScript

For a couple of years now I have the outlines of a webgame design lying around. Working title "Operation Survival - humanities last stand". It's supposed to be a persistent multiplayer online game involving tactical fighting to defend the earth from alien invasion. It's a bit more involved, but I won't go into that right now. Anyways, I have been playing with various implementation ideas and wanted to show you one that ultimately got discarded.

The idea was to have an animated battle in space with two motherships facing each other and launching fighters/rockets/lasers at each other. Controls are indirect, with the player specifying target types (mothership or enemy fighters) and the AI duelling it out. Fighters have flocking behaviour to fly in formation.

The game design calls for something more "down to earth" so to speak, so while this prototype might eventually have become fun it's not suited for this particular game vision.

If you wanna play with it go here [2025 update: SWF has long since died ;-/]. Launch some fighters by clicking on the round brown mothership targetting icons in the lower left (the energy bars were meant as an auto retreat threshold - once a fighter's energy drops below that value it tries to escape back to the mothership). The white fighter type will follow your mousecursor around to test the flocking algorithm.

2009-05-12

Zugspitze Hike

We went hiking on the Zugspitze 2 weeks ago. Richy put some fotos online here: http://picasaweb.google.com/Greadle/20090501Alpen?authkey=Gv1sRgCOm17tzJ-ITSYA# We went through the Höllentalschlucht which was still officially closed due to large amounts of snow and ice and bridges still being taken out for the winter.

2009-05-02

OGame

I have started playing OGame a couple of days ago. Apparently it's one of the biggest browser games with around 2.000.000 players. It's a bit dull so far but maybe we can make it interesting - join me in universe 57. I'm already thinking of ways to automate it, a habit which got me kicked out of the last browser game I've tried - my AI was getting too good too fast and the admins took note ;-) Anyways, either we'll have fun playing or we start an AI war...

2009-04-27

Average US home has more television sets than people...

The average American home now has more television sets than people. That threshold was crossed within the past two years, according to Nielsen Media Research. There are 2.73 TV sets in the typical home and 2.55 people, the researchers said.

In the average home, a television set is turned on for more than a third of the day — eight hours, 14 minutes, Nielsen said. That's an hour more than it was a decade ago. Most of that extra TV viewing is coming outside of prime time, where TVs are on only four minutes more than they were 10 years ago.

The average person watches four hours, 35 minutes of television each day, Nielsen said.

One new Nielsen finding — that young people aged 12 to 17 watched 3% more television during the season that ended in May than they had the previous year — is a particular relief to TV network executives.

For a few years, Nielsen had been finding that TV viewing among teenagers was flat or even declining, a trend blamed on the Internet or the popularity of electronic games and other devices.

Numbers from 2006 - I can only assume it has gotten worse in the meantime. Ouch!

2009-02-24

I hate Vista!

Argh. The law of leaky abstractions at work. In a misguided attempt at making user's life easier Microsoft introduced aliases for "c:/program files" and other critical windows folders in Vista. This way localized versions of windows (e.g. "c:/programme" ) should be able to deal with badly written programs that have the install destination hardcoded and don't account for regional naming differences. It's an ugly hack to fix an ugly problem. However, the frickin fix doesn't even work. And when it fails it fails badly. I currently have a program I can neither uninstall nor reinstall (it's installer silently fails and rolls back). Worse: it isn't even possible to delete it manually. I can delete it from c:/programme but if I then copy a fresh install to the previous location I get a "cannot overwrite c:/program files/bla" error. Ok, try to do it with administrator privilidges in Safe mode: no deal! The fucking thing is undeletable.

Now the best thing is that the program we are talking about is Mozy - my backup solution. It installs a service, a shell extension and a file system monitor. Things that are often characteristic for malware. I had tried Microsoft OneCare as an antivirus solution some weeks ago and that decided to interfere with mozy. Now although I have long since uninstalled OneCare mozy is still crippled - hence my rant above. Even better - OneCare cannot simply be installed like any normal piece of software, no, it forces you to uninstall any other AntiVir solution you may have already had and to top it of: you actually need to download a removal tool (!!!) in order to get rid of it again. This is fucking ridiculous. If it wasn't for Visual Studio, which is great and which I am using on a daily basis, this would have been the final straw for my emigration to linux.

So fuck you Microsoft for providing me the disservice of this hidden "convenience" folder aliasing Anti-Feature.

2009-01-13

"Verschrottungsprämie"

Armes Deutschland. Pro Kind 100 Euro, pro Auto 2500 Euro. Wenn das eine Investition in die Zukunft sein soll will ich in dieser Zukunft nicht leben. Sagt doch einiges aus über die gesellschaftliche Wertschätzung - des Deutschen liebstes Kind - sein Auto.

Herdentrieb hat schon recht:

Was soll zudem dieser Fokus auf die Autoindustrie? Warum überlässt man nicht den Verbrauchern, wie sie ihr Geld ausgeben? Der Markt für Autos ist im Grunde gesättigt – wir brauchen sicher andere Autos als bisher, aber ganz sicher nicht mehr so viele wie in den vergangenen Jahren. Nehmen wir einmal an, dass jeder, der einen Führerschein hat und fahren kann, auch ein Auto besitzt. Das kommt bei 41,2 Mio. zugelassenen PKWs etwa hin. Bei einem Durchschnittsalter des Bestands von acht Jahren ergibt sich eine durchschnittliche Lebensdauer der Autos von rund 16 Jahren, was wiederum bedeutet, dass der jährliche Ersatzbedarf ein sechzehntel von 41,2 Mio. beträgt: Das sind im Gleichgewicht 2,6 Mio. neue Autos pro Jahr. Da deren Haltbarkeit ständig zunimmt, dürfte die Zahl in Wirklichkeit sogar noch niedriger sein. Warum sollte es eine Katastrophe sein, wenn sich die Neuzulassungen auf diesem Niveau einpendeln. Im Jahr 2007 waren es noch 3,15 Mio.

Abgesehen davon, dass jede andere Branche berechtigterweise eine ähnliche Förderung ihrer Produktion verlangen könnte, macht es aus ökologischen Gründen keinen Sinn, die Leute zum Autofahren zu animieren. Sollte das Konjunkturpaket nicht auch eine Umweltkomponente haben? Ich plädiere erneut dafür, die Mehrwertsteuer für einen Zeitraum von drei Jahren um drei Punkte zu senken, damit die Kaufkraft der Haushalte wirksam gestärkt wird, und im Gegenzug die Steuern auf den Energieverbrauch dauerhaft zu erhöhen, mit einem Nettoeffekt von 15 Mrd. Euro für die ersten drei Jahre: Die Umwelt würde sich freuen und die Abhängigkeit von Energieimporten würde sinken, abgesehen von dem kräftigen allgemeinen Nachfrageschub, den die steuerliche Nettoentlastung auslösen dürfte.

2008-09-21

Ninja Peas

I have participated in one of the game prototyping challenges over at DanC's Lostgarden. The game (I'd rather call it a toy) is about peas thinking they are ninjas. They climb up blocks you place for them and jump from the highest points they can reach. If they survive they'll score points for every bounce - the higher the fall better. For detailed game rules and all the elite ninja moves the peas can do visit Dan's description of the game design.

Keys:

  • ESC quits the game
  • Space spawns peas
  • Left mouse places a block
  • Right mouse deletes a block
  • Mousewheel or arrow keys cycle through available block types

That's about it.

Full source is included. Depends on a couple of external libraries. Do whatever you want with it - would be cool to send an email my way telling me whether it was useful.

There are a couple of known bugs, mainly that some impacts don't register properly, peas can get stuck when "overbuilt" and that peas will sometimes float through blocks until they are back on course. It's fully playable though and all basic game mechanics work as intended.

2008-06-26

Wanna go for a swim?

An article about plastic pollution in our oceans.

Except for the small amount that’s been incinerated—and it’s a very small amount—every bit of plastic ever made still exists.

Seriously scary stuff. Why do we wrap candy in packaging that'll survive the product and it's consumer by hundreds of years?

2008-04-13

Stephen King on video game violence

Stephen King on video game violence:

Could Massachusetts legislators find better ways to watch out for the kiddies? Man, I sure hope so, because there's a lot more to America's culture of violence than Resident Evil 4.

What really makes me insane is how eager politicians are to use the pop culture — not just videogames but TV, movies, even Harry Potter — as a whipping boy. It's easy for them, even sort of fun, because the pop-cult always hollers nice and loud. Also, it allows legislators to ignore the elephants in the living room. Elephant One is the ever-deepening divide between the haves and have-nots in this country, a situation guys like Fiddy and Snoop have been indirectly rapping about for years. Elephant Two is America's almost pathological love of guns. It was too easy for critics to claim — falsely, it turned out — that Cho Seung-Hui (the Virginia Tech killer) was a fan of Counter-Strike; I just wish to God that legislators were as eager to point out that this nutball had no problem obtaining a 9mm semiautomatic handgun.

2007-07-14

Virtual Architecture

While reading the The Phaidon Atlas of Contemporary World Architecture. Comprehensive Edition (with a weight of 8kg the heaviest book I own ;-) ) I thought it would be a real shame if all our virtual architecture, i.e. computer game levels, especially 3D maps and buildings, will be lost forever once the corresponding games cease to work on new hardware. Alas, this being the internet, someone has thought of this before. I for one would like to see a museum of computer game architecture. Think of the floating in space jump pad levels of Quake3, the organic "in an alien body" maps of System Shock 2 or the rotating maps of Unreal Tournament. Or the more realistic maps of the various World War 2 games or Halflife. Not to mention the online worlds in World of Warcraft, Second Life or the Sims. There are tons of very creative examples like this. Would be a shame to lose all that creativity. Architecture is architecture after all. The virtual kind may have different constraints and trade-offs than the real world one, but just like the real thing it's a mix of art and craft.

Either that or I'm just nostalgic for countless lost hours sank into self made levels for DooM 2, Duke Nuke'em and Quake 3.

2007-04-07

Never buy anthing that says Sony on it ever again...

Argh! There is lots of bad stuff to say about Sony, like it distributing rootkits for the good of the customer, but this time it's personal. I was dumb enough to buy a portable minidisc player (before all the mp3 players came out). The hardware is kinda ok, but the software must be the most hideously rotten piece of fucked up shit ever let lose on humankind. Of course it's your only option to use with the hardware. Of course it's windows only. Of course it has to scan all your drives in order to "register" your music. Naturally it only writes Sony native formats. Of course it doesn't read ogg vorbis. Of course it crashes about once a minute. For updating it you can of course be expected to install Internet Explorer (Sony's page doesn't like FireFox) and restart your computer about 500 times. Also, a simple download cannot be done without ActiveX and Flash activated. etc etc... It's just unbelievable that they should get away with it. Die Sony! Die, die, die!

Go Apple go! Drive em into the ground.

2007-03-28

Not Not Start a Startup? Not?

"If you took a nap in your office in a big company, it would seem unprofessional. But if you're starting a startup and you fall asleep in the middle of the day, your cofounders will just assume you were tired."

Paul Graham in his latest essay "Why to Not Not Start a Startup"

2007-03-20

BinNavi in action

Although I've written large chunks of this software I'm not a typical user of it (i.e. I'm usually producing my own bugs instead of taking someone else's apart in binary code). All the more interesting to see what kind of (freaky I might add) stuff folks pull off with it. Ero published a nice article where he shows some debugging work, stringing together a PE executable with a hex editor of all things!

2007-03-11

Beauty in the Asphalt Age

A couple of "human flowers" - highway interchanges viewed from above. The last one is from the movie "Alpha Dog". More in the "Museum of Ridiculous Highway Design". Apparently abominations like these are but a small sacrifice for "personal freedom"...

2007-03-07

Sexually Satisfied Chickens

Today he missed the rising sun by three hours. He met his day in the shower, washing his hair with shampoo that was guaranteed to have never been put in a bunny's eyes and from which ten percent of the profits went to save the whales. He lathered his face with shaving cream free of chlorofluorocarbons, thereby saving the ozone layer. He breakfasted on fertile eggs laid by sexually satisfied chickens that were allowed to range while listening to Brahms, and muffins made with pesticide-free grain, so no eagle-egg shells were weakened by his thoughtless consumption. He scrambled the eggs in margarine free of tropical oils, thus preserving the rain forest, and he added milk from a carton made of recycled paper and shipped from a small family farm. By the time he finished his second cup of coffee, which would presumably help to educate the children of a poor peasant farmer named Juan Valdez, Sam was on the verge of congratulating himself for single-handedly saving the planet just by getting up in the morning. He would have been surprised, however, if someone had told him that it had been two years since he had set foot on unpaved ground.

- Christopher Moore, Coyote Blue

2007-02-17

Rush Hour

the freeways are a psychological
entanglement of
warped souls,
dying flowers in the dying hour
of the dying day....

what you see on the freeway is just what there is,
a funeral procession of the dead,
the greatest horror of our time in motion.

- Charles Bukowski

2007-02-10

Mirror, mirror on the wall...

Pollution in China, already at disastrous levels, is growing faster than anyone could possibly control it. English Der Spiegel article on China

And what are we doing? Investing money into the "emerging markets", feeling disappointed when they don't reach our 30% p.a. growth expectations. Poisoning themselves to death is alright as long as we profit and the dirt stays on the other side of the globe. Now that the first clouds drift over Europe and Japan people at least start noticing...

China is expected to trump the biggest current polluter, the US, in the very near future. I bet you a thousand carbon credits that will be used as an excuse to pollute even more, not less. The argument you hear even now goes something like this: Why should I cut back on my emissions or my environmental footprint - look at them, they are even worse than me! If I change, that won't make a difference anyways. You'd think this argument is so obviously flawed noone would fall for it. Yet at the same time you hear it again and again. People driving their fucking cars everywhere because "what difference does my Prius make compared to his evil SUV?" I don't need to change my habits. Not me. Not me.

By this logic you can justify any crime because there'll always be one that is worse...

There is an analysis of this phenomenon in mathematical game theory: Cooperation would be for the net benefit of everyone, yet it's for your own short term benefit not to cooperate and thus it never works. Unfortunately nature suffers from exactly this phenomenon. For the global good of the planet nations should be able to agree on environmental policy yet it's in everyone's short term interest to let "the others do it" and boost the local economy instead.

Everyone will cry foul at China once we finally reach the tipping point. Yet they are only repeating our mistakes. If we were allowed to make them and if we have the right to our standards of living - why shouldn't they? It's gonna get real nasty once the roles reverse - imagine the reckless USA having to play economic catch up with China. Uh oh.

A new coal fired power plant per week - I bet you we'll be building nuclear power plants by the dozen in the name of ecology and green energy before I turn 35. Just so we stop the immediate threat.

Us fucking hypocrits.

2006-11-07

The Cryptonomicon

I just finished reading Neal Stephenson's Cryptonomicon. It's a daring story with lots of characters and parallel plots all revolving around cryptography, gold treasure hunting and second world war action. This in itself is not really compelling. What is though, at least for me, is that this is a book by a geek for geeks and about geeks.

It's written by a geek because Stephenson has a way of playing language kungfu that seems to scream look at my wits/IQ and goes off on weird tangents all the time. It appeals to the inherent multi-tasking addiction in your average nerd in that you can ponder some off-hand remark and fancy idea thrown at you in a subordinate clause while continuing through the main thread.

It's written for geeks - who else would want to read detailed descriptions of crypto-systems as part of a novell? But that's actually besides the point. The real reason is that geekdom is characterized so well in this book that you could actually use it as a definition. The leading characters are all more or less socially inept almost to the point of autists or Asbergers and at the same time math geniouses living in their own alternate realities. I laughed out loud at a scene at a dinner table where Randy, chronically forgetting all the unimportant details about the people around him, like - say - names, blurts into the discussion after enduring silently for a while and turns it into a heated debate. The sarcastic remark is that "normal" people flock into "consent groups" soon-after, because a real argument is too strenuous.

And it's about geeks... well, just take the title for a hint.

I really enjoyed it.

2006-09-07

Genetic Sudoku Solver

I wasn't in the mood for "real" work this afternoon so I decided to bug my girlfriend instead. She has developed a serious Sudoku addiction lately and solves them by the dozen. I thought it was a beautiful problem for a genetic algorithm to solve so I gave it a shot. The whole thing took little over 3 hours to code, starting from scratch using only the STL and MFC. The result won't win any beauty prices and is most certainly not the fastest or most intelligent solver out there - but it works.

I've used the most basic of all GAs, implementing truncation selection for selecting suitable parents. Childs are created by using the first n blocks of one parent and the last 9 - n from the other. Mutation is archieved by simply swapping random fields in a block. The fitness function counts how often a digit appears in a row or a column, every deviation from one counts as an error.

Sudoku is a pretty hard problem for a GA because it has many solutions with the same error count, i.e. the same fitness. Such a multimodal error function needs a GA that is better capable of exploration vs exploitation than mine. Using truncation selection for inheritance is pretty bad, cause it will not usually try enough approaches and easily get stuck in local minima. I "solved" the problem by simply using a high chance for mutations and thus a high random factor.

You can tell that the GA isn't very good for exploring because it is highly dependant on the initial parameters and population. Usually, if you choose the right GA for the problem at hand, GAs are pretty robust and don't change much with respect to initialization.

As it is, the algorithm needs a couple of seconds and about five to ten thausand iterations to solve a moderately complex sudoku. For the fiendish and extra hard problems it'll take minutes and several hundred thausand iterations.

Anyways - that was fun ;-)

2006-07-01

Spam with bugs - LOL ;-)

I have received a very well done eBay phishing spam mail that made it through both of my spam filters. I took the time to actually read the thing. It has a pretty long winded explanation of why I owe eBay some money and goes on to say where I should transfer it and how much. The line stating the amount due contained a pretty funny error:

Faelliger Gesamtbetrag:
||%RND_FIRST_DIGIT50,68

%RND_FIRST_DIGIT ?! LOL! I owe someone a random amount of money ;-) I can only assume that the original spam mail was generated in a different language (most likely english) and a different character set. I guess the dollar symbol was supposed to be replaced by a euro one and the parser choked on that. And, btw, we put our currency symbol at the end of the number, not in front anyways.

On another note I stumbled across some malware recently that infects your machine and goes on to encrypt random pieces of your data. It then pops up a dialog telling you your data is being held hostage and that you have to pay a certain amount to get the password to unlock it again. I found this a very creative idea and wonder if they actually do earn money with it? More original than just deleting and destroying stuff randomly in any case.

I guess with good open source encryption like: http://www.truecrypt.org/ it would actually be quite simple to write such a trojan that would work very well indeed.

2006-05-23

Cool Algorithms

I have been busy at work recently building neural network ensembles for solving quite a complex prediction/classification problem. There are two major issues to solve for my particular problem:

1) How do you reduce the dimensionality of your input data to something manageable while still maintaining the relevant information?

2) How do you find a set of neural networks that each produces good results individually while making it's prediction errors in disjoint areas of the input space, thus archieving maximal benefit from grouping.

In my research for 1) I've stumbled across two majorly cool algorithms: Isomap and Locally Linear Embedding. Both of which try to solve the same problem: Finding the inherent dimensionality of a dataset hidden in a high dimensional input space (finding an embedded manifold). As a simple example you can view the 2D still fotograph of a three dimensional object as a vector of pixels. This vector will have an insanely high number of components (i.e. dimensions), your average digital camera has millions. On the other hand the real world object they describe usually has far fewer degrees of freedom, thus needing far fewer components to be described. The aforementioned papers both have very cool graphical examples for this.

Unfortunately both algorithms suffer from the fact that you cannot train them on one dataset and subsequently apply them to another, unknown, one. Real world problems are often of this nature though... Still, I think they are among the coolest ideas in recent years and definately a worthwhile direction for more research.

I also investigated Self Organizing Maps, but they suffer from the same problem like LLE and IsoMap and additionally also include quantization as a necessary step, thus corrupting your data more than necessary.

In the end, I settled for boring old plain vanilla principal component analysis, which manages to simplify my data at least a little bit.

For the second problem ((2) mentioned above) the primary issues are how to determine network topology in the first place and how to compare networks against each other. I implemented a genetic algorithm growing thausands of networks, thus solving the network topolgy problem in some pretty brute force way. Comparing network quality is more difficult than it sounds though, the standard mean squared error usually used in training backpropagation nets isn't very useful for this. I ended up creating a gini curve/coefficient for my alpha beta errors (it's a two class classification problem) and, more importantly, scatterplots of the output neurons' activation. The latter plots are very interesting, creating funky curves for certain training configurations and transfer functions (radial basis functions are most freaky). They also offer insight into the particular training samples a net makes errors on, thus allowing an optimal strategy for choosing a set of nets.

Fun ;-)

2006-03-19

Reduction

Late at night I'm lying awake reading. My girlfriend curled up close to me, sound asleep. Her slow breathing and the soft rustle of pages turning the only sounds reaching me in my little island of light. I'm through with the book, thoughts wandering in comfortable idleness. Everything seems slow, silenced, numbed in happy melancholy. The book is over, the story ended. I start wondering about the author and read the cover flap:

  • BuschnicK is.
  • leaving.
  • working.
  • having.
  • teaching.
  • winning.
  • publishing.
  • living.
  • writing.

The author's description flap reduced to the verbs. Reduction. Time is a glacier.

2006-03-12

Good Will Hunting

One of the companies I work for has a contract for a project which is clearly military in nature. I refused to work on that project for moral reasons, as did many of my fellow colleagues. Anyways, the ensuing discussions reminded me of an excellent movie:

From the movie Good Will Hunting. Will is a young maths genious and is being interviewed for a job at the NSA:

Why shouldn't I work for the N.S.A.? That's a tough one, but I'll give it a shot. Say I'm working at N.S.A. Somebody puts a code on my desk, something nobody else can break. So I take a shot at it and maybe I break it. And I'm real happy with myself, 'cause I did my job well. But maybe that code was the location of some rebel army in North Africa or the Middle East. Once they have that location, they bomb the village where the rebels were hiding and fifteen hundred people I never had a problem with get killed. Now the politicians are sayin', "Send in the marines to secure the area" 'cause they don't give a shit. It won't be their kid over there, gettin' shot. Just like it wasn't them when their number was called, 'cause they were pullin' a tour in the National Guard. It'll be some guy from Southie takin' shrapnel in the ass. And he comes home to find that the plant he used to work at got exported to the country he just got back from. And the guy who put the shrapnel in his ass got his old job, 'cause he'll work for fifteen cents a day and no bathroom breaks. Meanwhile my buddy from Southie realizes the only reason he was over there was so we could install a government that would sell us oil at a good price. And of course the oil companies used the skirmish to scare up oil prices so they could turn a quick buck. A cute little ancillary benefit for them but it ain't helping my buddy at two-fifty a gallon. And naturally they're takin' their sweet time bringin' the oil back, and maybe even took the liberty of hiring an alcoholic skipper who likes to drink martinis and play slalom with the icebergs, and it ain't too long 'til he hits one, spills the oil and kills all the sea life in the North Atlantic. So my buddy's out of work and he can't afford to drive, so he's got to walk to the job interviews, which sucks 'cause the shrapnel in his ass is givin' him chronic hemorrhoids. And meanwhile he's starvin' 'cause every time he tries to get a bite to eat the only blue plate special they're servin' is North Atlantic scrod with Quaker State. So what do I think? I'm holdin' out for somethin' better. Why not just shoot my buddy, take his job and give it to his sworn enemy, hike up gas prices, bomb a village, club a baby seal, hit the hash pipe and join the National Guard? I could be elected president.

2006-02-26

Camera Calibration

I'm working on a side project of mine involving a webcam, a projector and shadows. Anyways, webcams only have very small lenses and thus a strong fisheye distortion effect towards the edges. I needed a way to get rid of that. I dug out my copy of the excellent open source OpenCV image library and found a nice little function to do that for me. You can see the result in this post. The first image is the original, distorted one, the second is the undistorted version and the third shows the calibration object pattern detection.

Next step is getting rid of the trapezoid distortion which should be far easier since it only involves a linear transformation as opposed to the radial lens distortion. Finding suitable reference points will be interesting though (or pins as such fix points are called in GIS applications).

2006-02-25

Notes on the human visual system and perceptual image analysis and segmentation

This is intended to become a loose collection of links and notes to gather my thoughts, ideas and resources on the topic in one place. Usually I have an unorganized mess of scribbles on various post-its, hyperlinks sitting in emails, browser favourites and text files. Also, this collection is intended to provoke feedback and get your neurons going, maybe we could spark some new ideas.

Human perception, especially vision, is still an active research area and many things are yet unknown. On the other hand it is of tremendous interest to decipher nature's tricks. With today's computing power and camera systems lots of highly useful and practical applications could be built - if only we had the right algorithms to deal with the data. One of the most important and relatively low level vision tasks is segmenting an image into it's semantic parts and components. Human's do that tremendously efficient and fast, without even concious thought. Computers on the other hand are still relatively inept at this task and only perform well for certain small subsets of the general problem. So the first thing should be trying to understand how humans do image segmentation.

Theories about the human visual system (some proven and true, others not) and ideas of how to emulate them algorithmically:

- different light wavelengths provoke reactions of varying intensity on the retina. For example we can distinguish different shades of green far more easily and in greater fidelity than any other color. Evolutionary this makes perfect sense, considering that the great outdoors living habitat presents itself primarily in greens.
Conclusion: model the colorspace accordingly, i.e. vary the dynamic range (bitdepth) used for representing signal strength in certain wavelengths. In the simplest case this means having more bits available for representing green than for any other color.

- Humans perceive certain colors to be similar to each other while others appear dissimilar.
Conclusion: model the colorspace accordingly, i.e. find a color space such that some mathematical metric represents human perception in color differences. One such colorspace is the CieLAB colorspace which has been devised with several hundred test candidates such that the euclidian distance metric corresponds to perceived color similarity. It still has quite a lot shortcomings though (see appendix).
Problems: As opposed to this model human color perception is not absolute, but spatially and contextually varying. Our perception of color depends on the colors directly surrounding it and the number and type of colors visible simultaniously. It is easier to see color variation in a local color gradient than to count the number of different shades of a color randomly dotted all over an image. Also, we can only distinguish so many colors at once (a relatively small number).

- The human eye is not modelled on a regular grid. Rather the perceptors are irregularly spaced on a rounded surface (the inner surface of the eye). On the other hand all artificial sensors adhere to a strict, regular and flat lattice. Question: does the irregularity of signal sampling in the human eye have any advantages over a fixed grid? Is it more robust dealing with aliasing problems? Is it more robust against over saturation with a certain spatial frequency? What purpose does it serve?

- Physical light intensity does not correspond 1 to 1 to perceived light intensity. Research indicates that perceived intensity approximately follows a logarithmic function of physical, measured, intensity. Computers already try to capture this effect for example with the nonlinear gamma curve for display devices. When modelling a color space or normalizing one this should be taken into account.

- Humans seem to be more sensitive to changes in brightness than in color. The human eye has far more intensity than color receptors. This indicates that a color space that models brightness or intensity seperately from color would be desirable. Color could be represented with fewer bits than brightness. When building gaussian or laplacian image pyramids brightness could be sampled with a smaller (higher frequency) filter kernel while color could be smoothed much more with a larger filter producing a "perceptual image pyramid".
BTW, why are all the usual color spaces 3 dimensional? There is nothing inherently 3 dimensional about color. Would it make sense to find another representation? (Update: there actually seems to be a theory saying color is at least 3 dimensional)

- Humans only focus on a very small part of the whole visible field of view at a time. The spatial and color resolution of the eye falls off towards the edges. Color can only be perceived in the center of the field of view. Both of these facts would imply a non-linear, non-kartesian, coordinate system to represent images. The log-polar coordinate system might be one such choice, giving high spatial resolution at it's center and falling off towards the edges. Thus one could model a sharp and crisp "center of attention" while suppressing noise and uninteresting detail in the surrounding area. This would only deal with the spatial issue though. A similar approach should be used for color, so that an image fades to gray towards the eges and color detail is reduced.

- The human eye and associated nervous system is organized higly hierarchical. Processing and understanding of the received data happen at each level of the hierarchy. Some simple metrics and information seem to be gathered very early in the process such as "it's dark/it's bright". Vertical and horizontal breakage lines are detected pretty early (probably because they are needed for navigating our three dimensional surrounding) as are foreground and background objects. Foreground segmentation is a particularly interesting subject since a lot of information seems to be used here. Examples would be: is the object in motion; a tendancy to place objects "on the ground", i.e. the lower part of an image where gravity would have them; a light vs. dark object segmentation; stereoscoping 3D segmentation, i.e. how close is the object. The last part of the system is the actual pattern and heuristics matching happening in the visual cortex. Pattern matching meaning matching the brain's database of actual known objects to the newly encountered ones. Heuristics matching means matching known physical truths to a probably unknown object (This last point is especially interesting since it implies that things that "cannot be true" won't easily be perceived. Supposedly this is anectotedly true for the first sightings of Columbus' ships by the natives - they didn't know such constructs and thus had problems "seeing" them - although they were huge).
The hierarchical layout implies that an artificial perception system should probably be modelled the same way. Basic receptors, followed by ever more complex and complicated feature detectors followed by logic combining those features into semantic objects. Maybe some form of neural net with different types of neurons and different layers serving the individual detection tasks could be constructed for this.

- Humans have two eyes. Stereo vision is useful for 3D navigation, but is also used for detecting redundancies and suppressing noise in 2D images. Also, the focus area is in the field of view of both eyes giving extra detail and resolution, while the edges of the image are only ever in the field of view of one eye. This again hints at a non-cartesian image representation with detail fall-off towards the edges. Maybe sensors could be built or refitted to produce stereo vision images as well.

- Similar to the center of attention mentioned earlier humans seem to have something like locally dominant colors. We can only sense so many colors at once (a relatively small number) so we see certain areas as one homogenous color even if they are not. Similarily our ability to discertain colors directly depends on how many different colors are visible at once. It is easier to spot a smooth color gradient than to discertain shades of the same color in a chaotic patch of different colors. This could probably be modelled by a clustering algorithm (k-means, meanshift, self organizing maps, ...) in color space, finding the locally dominant colors.

- While computer image analysis usually only works on one image at a time humans naturally blend several impressions of the same visual stimulus over time. I don't know whether the human eye has a concept of "frame rate/frames per second" or whether that would be constant for all receptors or different (it would be possible for example, that the gray receptors have faster circuit times than the color receptors, thus giving light intensity higher time resolution). All this is important in analysing motion of course, but even for static images it makes sense to view it over time. A human seeing an image for some time will gradually notice more and more detail. Due to the imperfect nature of our sensors (eyes) still frames will have a certain amount of noise and inaccuracies in them. Interpolating over time will eliminate most of these. Also, it allows one to focus on different or more details once the basics have been analyzed. Putting all these factors together it seems humans have a hiararchic system over time, reducing noise and redundancies and analyzing in increasing amount of detail.

- Texture. Texture is an exceedingly complicated and overloaded term. There is not even a standard way to define what texture means. Yet at the same time humans have no trouble whatsoever recognizing objects of same texture. Why is that? Texture describes some spatial relationship between colors and intensities, a pattern. It is not necessarily exactly repeating (the texture of a plant leaf is always the same, yet at the same time it is unique for each leaf and from one square centimetre to the next). It is not necessarily of uniform scale. It is not easy to describe in simple geometric terms (clouds). It does not necessarily appear uniform in color or intensity. Nevertheless, there must be at least some characteristics appearing constant and non-varying to the human observer, so he can group parts of an image by their texture. Texture is a hierarchical term again. Viewed from a distance at coarse detail a patch of lawn will appear textured uniformely. Viewed in close detail the individual blades of gras will appear totally chaotic.
There are multitudes of approaches to capturing texture in mathematical terms, most of them deriving some form of statistical features from gray value intensities. There are fourier descriptors, wavelet transforms, coocurance matrices, color clusterings, bayesian predictors, neural networks, genetic algorithms, self organizing maps, active contours/snakes, ... Each one of these is a valid approach and fit at capturing one aspect of texture. However none of them is adequat for the general problem.

To sum up: obviously the human visual system is a highly sophisticated, highly dynamic and hierarchically organized system. It seems difficult if not impossible to model all of it's capabilities with only one algorithm. It seems more logical to start at the bottom of the hierarchy, with the simple or even trivial transformations and interpretations and work the way up. Ideally keeping the interfaces open such that at each step each algorithm is pluggable and replacable by a different, possibly better, one. Another very important preprocessing step is determing what will be the basic inputs to the whole system. These inputs should be modelled as close to the outputs of the receptors in the human eye as possible.

I'm a big fan of emergent behaviour and believe a lot of nature's power comes from systems organized in such a way. Very basic and simple basic blocks in large quantities work together to archieve more than the sum of their parts. Examples for systems like these are all of a human's senses, each of which is built from tiny receptors, the human nervous system and brain and, on a larger scale, ant colonies. These systems exhibit a lot of very desirable properties: they scale well, they are robust to noise, they are robust to defects in individual agents, they do not have a single point of failure or a single mastermind, they are easily parallelizable and they are easy to construct (since each individual agent is trivial). Artificial examples for algorithms with these qualities would include neural nets, self organizing maps, autonomous agent systems (ants) and genetic algorithms. The idea is to build a hierarchy of lots of very simple building blocks and hope that something useful will evolve from that.

Ok, now I'll start working on my genetically evolving, self organizing, hierarchical neural network based on fuzzy logic maths - it will call you and tell you when it's done and ready to take over the world ;-)

plus a gazillion more in my bookmarks and littered all over the place. I hope I'll come around to organizing them.

2005-12-09

Google Transit

I've just read on the google blog about a new project called Google Transit. It's a nice little feature that allows you to get local transit schedules and routes (displayed on google maps - go AJAX go! ;-) ) via a simple search engine like free text query. Cool. But even cooler: they include the price for the trip and compare it to the price of driving the same route by car. Cars lose again. Here's an example query: http://www.google.com/transit?q=pdx+to+100+nw+couch+st,+portland,+oregon&hl=en

2005-11-26

A Foot of Snow...

... and Münster descends into chaos! Oh such fun - I love winter ;-) Anita and I went to a musical last night, Jeckyll and Hyde - awesome - go see it - which was 4 hours long. Coming out of the theatre all cars were burried in 20cm of fresh snow. Total chaos on the parking lot, no one could get out. Anita and I were on foot ;-) Today, almost no trains are running (which is relevant for my brother who tries to get to Cologne to see Tracy Chapman in concert), 40km traffic jams on the Autobahns because trucks can't make the easiest of slopes, non stop emergency sirens because people are just too damn stupid to deal with snow, power outings, ... I cycled 6km through the snow, took me almost twice as long as usual but was great fun... Go winter go! BTW, a cool non-car transportation system (that'd probably work in winter): http://www.skywebexpress.com/

2005-10-14

Last.fm + Audioscrobbler know your musical taste!

I've said it before when the service was still called audioscrobbler: last.fm totally, absolutely, fantastically rocks! It's another one of these up and coming social computing websites. You download a music player and optionally a plugin for your current music player of choice. The plugin will upload your musical choices from now on (if you allow it to) - thus creating a musical profile. From that info it generates a list of musical neighbours, a list of recommendations (people who shop on amazon should know them: "people who bought X were also interested in Y") and all kinds of custom playlists. But the real bummer is yet to come: via their free player you can listen to dynamically generated radio playlists all day long - specifically tailored to your tastes! If you don't like it you can just skip a song and go to the next. Or say I only want to listen to music similar to "Jack Johnson" (insert your favourite artist). I love it. BTW, my profile and playlists are at: http://www.last.fm/user/BuschnicK/

2005-08-03

Life is fun

Spent two days cycling along the Ems river to the North Sea. Visiting my girl friend at her parents house. 265 kilometres, 115 the first day, 150 the second. I camped on a clearing near Meppen and woke up at exactly midnight to a fantastic lightning storm. Almost windstill, but continuous thunder and ligthning. My tent was bright for seconds on end. Nature at her finest. While cycling I only had the best weather though. I still have the sun tan line on my legs from my 6 months bicycle tour a year ago. Because of that I didn't have to use any sun screen this time and am back to my old dark "cyclist skin" ;-)

It seems like my job will soon be a bit of C++ again - yeah! I had a couple of interesting discussions and language lawyer puzzles recently. Fun, fun, fun. Virtual inheritance, dominating methods, ... ahh the complexities and subtleties of the language never cease to amaze and intrigue me - I'm a whacko I guess ;-)

I've started packing for Anita and my Canada trip this year. Plane leaves on Sunday...

2005-03-13

Edible Rock rocks!

My brother's band won the first round in the international Emergenza newcomer festival. Congratulations! Now on to the next couple of rounds ;-)

The festival covers the US, Canada and Europe. There are several qualification rounds, the first couple are decided by audience vote alone, while the next few will have a jury. Tonight 8 bands were competing and Edible Rock won first place with 80 votes. Second was Fortitude with 56. I believe in Germany alone 2500 bands have signed up for the competition...

If you haven't been there yet, head straight over to www.edible-rock.net and download some cool music.

2005-03-09

European patent law

...or how big money has won over Democracy yet again. For the really optimistic there's still a glimmer of hope left, but seriously... http://www.groklaw.net/article.php?story=20050307095336843

2005-03-01

It's snowing!

Finally we get some real snow... I love it.

I've just read that the night from Sunday to Monday was the coldest this winter with temperatures just above -14 degrees celcius. Funnily enough we heated our outdoor bathtub that night. So I was lying around naked in the snow - not feeling cold at all ;-)

2005-02-20

Debugging society - part one

Thoughts on free markets and a capitalist economy

I believe our current economy and capitalist system to be deeply flawed, unjust and ultimately doomed. Let me state a couple of the reasons why:

It's flawed because it encourages all the wrong mechanisms and motivations. Free market advocates quote the fundamental mechanism of supply and demand and competition as the driving forces that keep the system healthy and alive.

Competition is what I call a destructive motivator. Meaning that to thrive in a competitive market it is to your advantage if your competitors (opponents?) struggle. This is not a healthy situation, not productive for society as a whole. Cooperation on the other hand is a constructive motivator. It is good for you if your partners thrive. If competition is the only viable motivator (as seems to be assumed) how can it be that even in a capitalist system the greatest leaps in productivity come when people cooperate? Rebuilding after a war, causing “economic miracles”? Building up to a war? Why, if competition is the only viable option, do we expect friends and family to work by wholly different and opposite principles?

Supply and demand is a broken system as well. There are lots of things that are in huge demand and are not in the hands of capitalism to supply (rightly so). Think about our natural resources like air and water. The demand is huge and never-ending. Yet at the same time they have no monetary value attached to them. Which means it’s not, cannot be, in a capitalist’s interest to invest in, or even just to conserve them. But the alternative also isn’t possible. We cannot attach a price value to natural resources as that’d mean poor folks would only get three breaths a day or something...

Another key observation is an individual worker's productivity. In previous centuries, when work mainly consisted of manual labour, all workers were pretty much equal. Sure, if you put in twice as many hours as your neighbour or are twice as strong as him you might manage to work twice the land he does. But basic physical principles prevent huge differences in work productivity. Not any longer. Technology has changed all that. A farmer using modern machinery can easily be a hundred times as productive as one that doesn't. A logger with modern equipment cuts down a whole forest in the same time even Hercules needs to cut down a single tree with his axe. A good software developer is light-years ahead of a bad one. This increase in an individual's productivity is a good thing. It is enabling. Only because humanity invents ever more powerful tools do we progress and are able to sustain our numbers. And yet, capitalism punishes these advances. Oh sure, the one productive farmer is rewarded for his work. Yet the 99 others that are now without work are now without work- read: unemployed. This too, should actually be a good thing, because they are now free to pursue other venues. Yet their choice of alternative occupations is severely limited by what the market supports. Unemployment is only bad because it is made so. Think about it for a second: How often did you say “If I only had more free time I could…”. Unemployment is the ultimate in free time. Granted you need a system in place to keep the 1 worker that supports the 99 unemployed happy and working. The current system’s answer is to punish the 99 and make them all compete for the 1 worker slot. Is there really no alternative? More on this in another post (as it is a topic that interests me very much because my job as a software developer is basically making other people’s jobs superfluous).

It’s unfair because the old saying of money breeds money is just all too true. I think I don’t even have to argue this point much. Once you have a million it’s easy to make the next. Even if you didn’t even deserve (earned with your own labour) the first to begin with. It’s unfair because it actively sustains and supports the current global imbalance. It’ll never be in our best monetary interest to share our resources with the poor, yet it is in our interest to use their labour. It’s unfair because work is valued crassly to the advantage of the already rich. The further away your job is from work that is necessary, from work that actually must be done, the more money you’ll get for it. Imagine that! The more needless and dispensable your job is the more money you’ll get for it. Someone working the fields until his fingers bleed every day of his life just to support his family doesn’t even compare to someone working the stock market 20 years of his life and retiring early. Someone selling lottery tickets earns more than the local bakery… I’m lucky; I’m pretty much at the top of this chain. I enjoy a very high luxury standard of living for typing stuff on a keyboard each day without any real risk of starving or even losing my standards. But is this fair? Should this be so?

It's doomed because of all the reasons stated above (individual productivity increasing through technology, money piling in fewer and fewer places) and because it’s already failing in a downward spiral. Take a look at the world today. How many are we? 6.000.000.000? Common wisdom has us believe that free market capitalism is the best option, the survivor, the winner, the dominant. I’d go so far to even argue that point. Seriously, of those 6.000.000.000 people – how many do even participate in capitalism? How many of them have more than a dollar a day at their disposal? Less than that and you do not really participate. I bet if you view it that way capitalism doesn’t come out all that well. And if I had to guess again I’d say the group that’s not actively participating in, but just being controlled by, capitalism is increasing faster than the other one.

Disclaimer: I don’t have the slightest clue about what I’m talking here. These are all just personal observations and first stabs at refining them into some more or less coherent arguments. If you agree/disagree/have strong opinions on the topic yourself – feel invited to cooperate and shape my views ;-)

2005-01-26

It's fun learning new stuff...

First update in a long time. I have been very busy recently, working two contract jobs, hunting for a new appartment, helping a friend with his move to Stuttgart, and getting all the insurance and tax paperwork done for my independant work.

It's fun learning new stuff! My job used to be programming C++ pretty exclusively. I'm still doing C++ work, but my primary tools at the moment are Java, VisualBasic, PHP, MySQL and Halcon Script - with a major project in each. PHP and MySQL are an insanely productive combination in their problem domain and real fun to work with. Java feels like a toy language coming from C++ - it's similar enough so you are able to dive right in and hack away and forgiving enough to let you get away with it. The refactoring tools available for it are powerful and easy to use. I don't like it's exception handling and object lifetime semantics though. VisualBasic and HalconScript are clumsy and basically a huge PITA to work with. Dunno why BASIC ever got as popular as it is.

Working independantly takes getting used to. For one thing I find working from my home office more exhausting than sitting at the company's desk. Maybe it's just me, but when working from home I only bill actual working hours. For an eight hour work day that feels like taking an eight hour exam and I'm completely wasted afterwards. Working at the company's office on the other hand you seldom if ever get eight hours of high concentration work done on any single day. Colleagues, phones, meetings etc interrupt often enough that the typical eight hour day is more like five or so...

Cool new website find of the month: spurl. A page that manages your bookmarks and finds related links and information. I wonder when the ultimate-uber-search engine will emerge. A mix of technorati, google and the likes. I wanna have my own customizable web spiders. Continuously monitoring and crawling the web for me and presenting relevant results. I'm already using a baby version of a service like that, which lets you craft a search and updates you via email or RSS when something relevant to your search happens. But it's not good enough.