Skip to main content

Posts

EvoLisa - Comparing two images: performance tuning

It looks like the program is rather slow. Using DotTrace , I took a look at where the bottleneck is. The method that calculates the 'fitnesse', how closely the created image resembles the original image, is where most of the time goes to. Can we improve that? So what happens in this function? We compare each pixel of both images to compare their ARGB values. The better they match, the better the result! How can be compare this? First, I tried using the naive approach: compare each pixel using a bitmaps GetPixel(x, y) . Do that however, and you'll quickly see how excruciatingly slow that is. Especially considering that even with an image of 333x333 you're already comparing a million pixels each time you compare two images! So, instead I tried using a 'FastBitmap'. It's a project I found which wraps the Bitmap and provides much faster Get and SetPixel performance. Using this instead, the performance went up by an order of magnitude! But we can still do be...
Recent posts

EvoLisa - My own version

It's an old idea by now, can we recreate the Mona Lisa with fifty polygons by using random changes? The idea and original implementation by Roger Johansson can be found here . So, how does it work? You start with an source image. Then you create an empty image. We keep on doing small changes to this image. In my case this is one of these changes: Recolor our polygon Change the position of one of the polygon points Add or remove a new point to our polygon Add or remove a new polygon Switch two polygons After each action, we take a look and check if the newly changed image looks more like the original image by comparing each pixel. If it is, we continue using this one. If it's not, we discard the changes. Looks like a fun project! So I built my own version from scratch eight years ago, reusing some of the same ideas. Here's my result using the Mona Lisa: Mona Lisa with 50 polygons: You can see that it's the Mona Lisa but the details around the eyes and mou...

The Importance of Customer Support

Team Fortress 2 is now close to three years old and it still has tons of players. I got it out of the dust again to "play a few more rounds" only to notice that I've now put in another 20 hours. It's one of those games I reinstall every half year to play some more. And why did I get it out this time? Well, for the engineer update of course. Just like I got it out last time to enjoy the medic or the heavy update. Taking a look at those hilarious introductions is enough to make me want to play. In fact, those introductions together with Valves "introducing the..." videos are the funniest series I've seen on the net.  Since I haven't played the game in a year there's also a lot of new stuff to do. Extra achievements to get, extra items to get and a few new maps. Oh, and best of all you can now get hats! The continous stream of updates is enough to make old timers revisit the game from time to time. Besides releasing free upgrades Valve has als...

Majesty - The Fantasy Kingdom

Majesty breezed a fresh new wind through the RTS genre ten years ago. Here's a game where you do not control your heroes! Instead you can convince them to help your cause by giving out rewards for killing monsters or raiding lairs. While fighting for your heroes slowly gain levels and power. Loosing a high level wizzard will cause you to care! The original majesty was a great game. It's one of the very few games that I replay once a year. Even now it remains fresh which is helped by the randomized mission generation. So I looked forward to its sequel. Having finished Majesty 2 and nearing the finish of its expansion, Kingmaker I can say that it's still a good game but not great. What is this game missing that the original had? Charm for the most part. The original characters all had their own personalities. You'd have rogues who were the first to go after any bounty... and the first to flee at the first sight of danger. Muscled barbarians ran around the realm in a gre...

Civilization 4

Five years ago I gave the Civilization 4 demo a try. An hour later I gave up on it. Seeing the game with all its expansions packs on Steam for €11 made me give it another try. And 40 hours of playing later I'm glad I did! These days most strategy games seem to be only about one thing: killing as many enemies as brutal as you can. The trend has been to lower the "strategy" part in favour of more action. Base building? Games like Dawn of War 2 remove it to leave only the fighting.  Dawn of War 2 is a fun on its own but you can hardly call it a strategy game. Dawn of War 2 is more an action/RPG game than a strategy game. So amongst these so called strategy games it's great to see that companies still create more serious games. Civilization V is on the horizon and in the meantime we can still enjoy its predecessor and its many mods. Civilizations main selling point isn't the fighting. It's even an optional thing to do. Indeed, I won a "culture game...

Ding!

So my WoW warrior finally dinged 80 yesterday. I started preparing for this great event two weeks ago by buying good blue and epic tanking gear whenever I found some for a reasonable price. If there were none available I gathered the mats and paid someone 30g to craft it. Mind you, this character is on a new server so I didn't have a 50K honeypot to lick out. But I managed to make about 5000 gold on this new server while levelling from level 51 to 80 just by shifting some items. Plenty enough gold to get a nice starting set so I can get started. Before I put on the gear I had 19.311 hp and 508 defense. After I put it all on, gemmed it and gave it some basic enchanments I had 24.000 hp and 540 defense. Just enough to start heroics! And an hour after I dinged I finished my first heroic, The Violet Hold. There's still a lot of improvements to be made to my warriors gear but if there wasn't there wouldn't be any fun in doing heroics! The last five levels were fun. I sta...

A Clash of Kings - George R.R. Martin

The second book of the "A song of Ice and Fire" series picks up the story where "A Game of Thrones" left it. The first novel divided the kingdom, this second novel leaves those who are left to pick up and mend the pieces. And that's not an easy job. "There are more kings in this kingdom than there are dogs" one poor citizen mentions. Not less than seven self proclaimed kings have a claim at the throne and each one has an army to back it. Some are even looking at more exotic ways to win the iron throne... The book follows the survivors from the previous novel and adds one new person. Davos is an ex smuggler who is very grateful to his lord, the rightful king of the Seven Kingdoms, Stannis Baratheon. A decade ago he smuggled onions to the besieged castle at Storms End. Stannis gave him a lordship with one hand but took away his left hands fingers with the other one as he believed that everyone must pay for his sins no matter how heroic they act now. ...