[KrampusHack 2016] Dr. Evil F, Xmas edition

I present to you our KrampusHack 2016 entry: "Dr. Evil F, Xmas edition" for Eric Johnson.

Entry including source and windows binary


-- log --

The original wishlist I received was a confusing mix of half-retracted self-contradictory impossibilities :)


My wishlist: make an isometric turn-based shooter that features rabbits made of meatballs on a journey to flush their pet goldfish down the local cesspool. Along the way, the rabbits learn the true meaning of Christmas: getting some sweet gifts. 8-) Thanks in advance! :D (Only joking, of course.)


My request: throwing in a cheesecake or two for me would be awesome (it's my favorite dessert). Or anything with dogs (dogs are my second favorite dessert), because dogs are cool.

So I started from an isometric game, threw in a bunch of these keywords, add a sauce of Christmas, and presto.

As I already mentioned in the competition thread, I didn't write a game from scratch, but created an extension of our original TINS 2008 entry Dr. Evil F,
which is a bit like Desert Strike The rules of the competition were pretty open to allow this type of thing.

So what was added between the two competitons?

Between 2008 and 2016 I did bits of work on the code here and there - lots of bugfixes, and I ported it to Allegro 5. So even though it's old, the code was reasonably nice to work with.

The majority of effort went into adding a 3D mountainscape. The original is all a flat desert. For this competition I turned that into snowy mountains. I wrote functions to convert a height map to textured polygons, wrote a map generator, added collisions between objects and the map.


The hardest part to get right was correctly interpolating the z coordinate in the middle of a tile.


I added sound effects. Wanted to do music too, but I failed to get some inspiration for this...

Then we reworked it to the Christmas theme (Max helped here, she did the original graphics too). The objectives of each level were changed from bunkers to gifts (But you still have to shoot them to "open" them. Why would you shoot at a gift with a tank? No idea...) Tanks gained garlands. The main character got a Christmas hat. In addition to snowy mountain tops, we have fir trees and cosy log cabins to enhance the Christmas feel.

There is still room for improvement. Apart from some minor bugs, the sprites are always drawn on top of the surface, even though they might be behind a hill. I'm looking into z-buffers to see if I can fix that.

Anyway, I hope you enjoy it!

Erin Maus

Tried building it on FreeBSD, got a few errors with Clang:

twist5/src/IContainer.cpp:289:9: error: use of undeclared identifier 'accumulate'
        return accumulate(children.begin(), children.end(),
twist5/src/IContainer.cpp:296:9: error: use of undeclared identifier 'accumulate'
        return accumulate(children.begin(), children.end(),
twist5/src/IContainer.cpp:303:9: error: use of undeclared identifier 'accumulate'
        return accumulate(children.begin(), children.end(),
twist5/src/IContainer.cpp:310:9: error: use of undeclared identifier 'accumulate'
        return accumulate(children.begin(), children.end(),

Easy fix: std::accumulate is defined in numeric.

twist5/include/IContainer.h:36:52: error: parenthesized initialization of a member array is a GNU
      extension [-Wgnu-array-member-paren-init]
        IContainer() : children(), focus(), mouseFocus(), groupLayouts({ NULL }) {}

I just did a quick memset(groupLayouts, 0, sizeof(LayoutFunction) * MAX_GROUP_ID); to get it to compile.

After these fixes, it builds and runs. Will play the game shortly.


I got this error when trying to compile - I fixed it by including the <numeric> header.

twist5/src/IContainer.cpp: In member function double IContainer::getMaxRight():
twist5/src/IContainer.cpp:291:76: error: accumulate was not declared in this scope
    [] (double chain, IComponentPtr a) { return max(a->getRight(), chain); });

Can clearly see that this entry started off of something existing, it feels very complete with a lot of gameplay. And I love the graphics with all the detail, like the evil cats sitting in their tanks :D

Eric Johnson

I already wrote to you with my thoughts, Amarillion, so I won't repeat myself too much here. But I really like the isometric perspective and the humorous, often witty dialogue! :)

Mark Oates

Wow! The graphics on that mountain look great! I was just looking at a bunch of 3d isometric triangulated landscapes and wanted to start making something of my own like them. Did you use a shader to accomplish the lighting?

Erin Maus

I enjoyed it. Good work! Felt very polished. Movement was great. Loved how it was isometric. Thought the cut-scenes and silly banter was well done, too.


Tried building it on FreeBSD, got a few errors with Clang

Great, you gotta love C++. Somehow I never get these kinds of problems with Java... Good that you managed to fix it in the end.

Did you use a shader to accomplish the lighting?

Nothing custom, just the standard allegro one. I calculate the light level per triangle by taking the cosine of the cross-product of the normal with a the light vector (parallel light source). Based on the light level I create a color with al_map_rgb, and set these in the ALLEGRO_VERTEX array along with the texture coordinates, followed by a

al_draw_prim(coord, NULL, tiles, 0, 6, ALLEGRO_PRIM_TRIANGLE_LIST);

The source code is all there if you want to have a look, in iso*.cpp and iso*.h


I got the same problem with <numeric> as others.
I also have to set release instead of debug as I do not have a5 debug libs installed.
That aside it's playable and enjoyable. I had trouble getting the present with the helicopter thought ^^


I've created new versions that fixes a few minor bugs

  • Sound effects are no longer panned to one side

  • Fixed drawing glitches at the edge of a map

I've also tried making a statically linked linux binary - please let me know if it works!

Linux binary
Windows binary


gull@NiloreaDev:~/Téléchargements/dr_f$ ./run.sh
bin/dr_f: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory


Too bad. I should add libjpeg.so.8 to the lib dir.

What OS are you using?

Would you be so kind to run ldd bin/dr_f and send me the output? I want to see if you're missing more libs.


I'm running Debian Testing up to date.
BTW when I run ldd on the bin, only libjpeg.so.8 is missing. They replaced it by libjpeg-turbo AFAIK.


For the record, here is a new
linux binary including libjpeg.


Do not work because of debug allegro linked version:
bin/dr_f: error while loading shared libraries: liballegro_primitives-debug.so.5.2: cannot open shared object file: No such file or directory


Bleh, of course. This time I accidentally included the debug binary instead of the release binary. I'll create a new version.

edit: here it is, could anybody please give it another test?

edit: I've added it to the depot as well. Is anybody seeing this? https://www.allegro.cc/cc/depot-project/DrEvilFXmasedition


Hah, this really did remind me of those * Strike games. A reliable strategy was to bumrush for the gift and avoid fighting any of the enemies, because they fired too often and there was no way to heal as far as I could tell. I found the helicopter to completely outclass the tank for this strategy. I managed to win the game with 2 lives left.

A small note about your Allegro 5 port. Doing this: if (al_init () < 0) is not valid, as those functions return bool, so you need to do al_init() (and same for other init functions). I ran into this when I hit the usual header/library version mismatch issue :P.


Good point, I'll fix the al_init call.

I've thought about adding health power ups.

About the helicopter, I think the point is that it allows a different strategy, indeed that it allows you to rush ahead. But at the moment it's too easy to beat a level by rushing directly to the goal, and that is something that I should fix. What I don't know yet is how...

Thread #616664. Printed from Allegro.cc