D2X-XL Worklog

Notes on features and problems from the development of D2X-XL, newest first.

Applying For A Job In The Gaming Industry

The Task

Recently I did something rather different than usual. Ok, not that different - I was still coding - but I had applied for a job as senior programmer in a computer game company, and had been given the task to create a small prototypic game simulation including a debug visualization; all that within 8 hours. The simulation should take place on a rectangular grid containing some obstacles, some predators and their prey. Predators should start to hunt prey when they heard or saw it and eat it once they reached it, while prey should try to hide from predators they noticed that hadn't seen them or run away from them if they were hunting. So far so good.


The Way

Since I had been told that 8 hours was rather scarce for the task I was confident that I wouldn't do too bad, and after having read the task description and thought about how to structure my code into classes and methods started to happily type away.

The hours went by way too fast, and the further time advanced the more I became aware that the ambition and goal I had set myself for how I wanted the code and application to look had probably been aimed a bit too high, and it was clear to me that I wouldn't be able to even start with a visual interface. So I concentrated on the core simulation. I still wasn't able to finish it. Bleh. Interestingly enough I was told that my solution looked like I had dived into coding head first, while I know that the very opposite was true and I have had a clear concept what entities (classes) to use, how to have them interact, what functionality to provide, and what to prioritize. I just didn't even have the time to test anything.


The Result

In the end took me well over a 40 hours to create something I liked, and my only comfort is that I believe that the simulation is quite well written, uses and shows good structure and programming as well as some extra thought, beefed up with the application of advanced techniques in the realm of path finding and flavored with a real nice interactive interface wrapped around it. Actually I think that my solution is totally exaggerated for the task, but I so much love to create nice, good looking, well working things with that extra 'Oomph'. Anyway, 40 hours is enough, and if you would like to you can download the application and its source code here and play around a bit with it yourself. You will need 7zip v9 (beta) to unpack it and Visual Studio 2008 to compile the source code (C++ and C#/.NET 3.5). Executables are provided, so you won't need an IDE unless you want to poke around in the code.

Here's a screenshot to bring a bit color into this mass of text:

You can see the hearing and view range of the selected object (prey), the tiles it can see and hear, the path it is trying to follow, and predator it is hiding from. The lines between red and blue objects show which predators hunt what prey. Program settings are stored in an XML file (handling XML with C# is a breeze). Actually my little program offers much more functionality than what had been asked for and presents it in a very accessible and concise way, making it easy to follow certain objects or track them down and examine them in a debugger, and it's those little extras that can make a big difference.


The Question

The big question for me is whether I had just aimed to high and put too many C++ features and thought about AI behavior into my solution, or whether I should have been faster even given the approach I had chosen. I hope it was just a matter of my strategy since I can easily adjust that should I ever have to in the future. I would love to see and examine a solution for this task that had been finished, or close to being finished, after 8 hours, and compare it to what I have done - just to know whether I can relax, or whether I should be seriously concerned about my coding skills.

Thinking back I have to say though that trying to fill in the gaps in the task description regarding the AI somewhat broke my back. It took me too long to think and try my way through different variants of predator and prey behavior and make a clear cut there. The behavior specification for prey e.g. seems to be contradictive when it says this:

  • Hide: As soon as the prey detects a predator and the predator hasn’t detected the prey, it tries to hide from the predator behind the nearest obstacle.
    As soon as the predator spots the prey it should switch to the Flee AI state.
  • Flee: When the prey has become aware of a predator and the predator is hunting the prey should actively try to get away from the predator.

First of all when the predator starts to hunt the prey, the prey doesn't necessarily have a movement tick right away, so you need to delay processing of that information and properly sort it out when it is the prey's turn. This means a complication to the regular prey turn processing. Now what if the prey detects some closer predator that is hunting some other prey? The specification says the prey should start to run. This will override running away from the predator that hunts the prey, which doesn't quite seem to make sense. And what if the predator starts to hunt some prey when that prey cannot see or hear it anymore because it has moved behind some cover? The specification says the prey should still run, but does it make sense here? The next question is what happens when several predators start to hunt the same prey. Which will precede? The last one? Simple to code, but a bad solution. The closest one? Better, but more effort to code. It is easy to burn time here because the specification is unclear, tempting you to try and correct it, and depending on the number and complexity of potential solutions for such a conflict you can find yourself in hot water there very quickly. A better way to specify this would probably have been to say that the prey should run away from the closest predator that is hunting it, and only deal with other predators if it doesn't get hunted.


The Conclusion

Looking at the outcome of the test, I should have created something as simple and close to the specification as possible and blame the specification for the flaws (at the danger of people saying "Yes, it works, but geez, that stuff looks like it was built by a student and not by an IT pro who knows how to create object oriented code!"). Chosing between delivering something that is built to the specs but doesn't really work, and something that makes sense can be a tough choice. My way out of this quandary was to try and build something that in my eyes could stand the test of object orientation and technological sophistication ... but obviously I had chosen the wrong path.

Another thought I am having about this task is that while you can throw a brief task description at people and have them start to code after a short while of reading and understanding it, there is no way to create a big and complex application that way. Sure, you will break it into small, manageable pieces, but yet it's an entirely different story. You really will need to take your time to create well designed classes and application structure. So at the end of the day I am asking myself what my test result really says about my capability to efficiently participate in creating a 'real' program. It probably says a lot more about my priorities and my diligence when creating any application.

Well, I had been asking for it, and there I got it.


News

A new D2X-XL update fixing broken screen resolution persistence is available

There is yet another D2X-XL update is available (the new Pumo Mines broke a few things ...)

Believe it or not: There's a new D2X-XL version online!

Uploaded updated D2X-XL and library source code that compiles with Visual Studio 19

After a really long time, another new DLE version is available

A new DLE version is available (hear, hear!) :D

A new Max OS X version of D2X-XL is available!

D2X-XL now offers a cartoon style render mode!

New D2X-XL and DLE versions are available

Blarget has got his own area in the level spotlight

New D2X-XL and DLE versions are available

A couple of levels have been added to the level spotlight

Hooray! We're finally having a new Mac OS X version of D2X-XL!

D2X-XL now features an observer mode for multiplayer games

A new D2X-XL version with improved multiplayer synchronization is available

A new D2X-XL version fixing out of sync problems in multiplayer games is available

A new D2X-XL version with many multiplayer bug fixes is available

Added high quality (ogg) Descent 1 and 2 music to the downloads area

A new D2X-XL version with important bug fixes is available

D2X-XL compiles and runs on Linux again!

Descent 1 and 2 high res textures are now available as complete downloads

A new DLE version with a ton of bug fixes and improvements is online

A new D2X-XL version is online

A new D2X-XL version with a much needed bug fix is online

A new DLE version is online

Published another DLE version with more bug fixes and improvements by Sirius

Published a new D2X-XL version

Published a new DLE version with tons of bug fixes and improvements by Sirius

D2X-XL now supports Oculus Rift 3D headsets!

Updated DLE and D2X-XL to support new level features requested by Pumo

Added an article about DLE's new tunnel generator to the worklog

DLE's new tunnel generator is finished

Added a new article to the worklog

Published a new DLE version

Added a new article to the worklog

Added two new articles to the worklog

D2X-XL and DLE-XP now support triangular segment sides!

DLE-XP has an OpenGL render and 1st person view!

New DLE-XP version available

Wrote a new worklog article

Check out DarkFlameWolf's level spotlight section!

New DLE-XP and D2X-XL versions are available

A new DLE-XP version is available

Added a worklog article about the way point feature

Added way point support to DLE-XP and D2X-XL

Posted a bunch of new screenshots

Posted a bunch of new screenshots

A New version of DLE-XP is available

New OS X version of D2X-XL is available!

Added article about lightmaps to worklog.

New article and video added to worklog.