All posts filed under: Game Development

Pathfinding I

Tim-Oliver bothered me today with a question about A* pathfinding. It has been some time since I wrote our A* implementation in DVW, so I had to dig into this topic again. I used this tutorial and wrote some code. Note that this is just a straightforward implementation of the pseudo code presented in this article. I wouldn’t write productive code that way. Anyway, this might come handy for someone, so I’ll present it here. Next time, I will replace the open list with a binary heap. Click here to see the source:

VS2005 Enhancements

Microsoft has released a Power Toys package for VS2005. Visual Studio 2005 IDE Enhancements are a set of Visual Studio extensions that are designed to make you more productive. These enhancements are directly integrated into the Visual Studio IDE. This set of enhancements includes Source Code Outliner, Visual C++ Code Snippets, Indexed Find, Super Diff and Event Toaster tools. All these tools except the IDE Event Toaster can be invoked from Visual Studio’s View.OtherWindows menu group. The Event Toaster tool can be configured from the Tools Options dialog under the PowerToys node. The Visual C++ Code Snippets can be invoked on any C++ source file. Previously, these enhancements were only available via the Visual Studio 2005 SDK. This installation does not require Visual Studio 2005 SDK. Source Code Outliner: The Source Outliner tool is a Visual Studio extension that provides a tree view of your source code’s types and members and lets you quickly navigate to them inside the editor. Visual C++ Code Snippets: The Visual C++ Code Snippets tool lets you insert snippets in …

Template Parameter Types

I just had a case where I wanted to make sure that a C++ template parameter was of a certain type. The template should be used for pointers to instances of class “Base” and its derivates so that I could call a method of Base on the object provided to the template class. First, I thought there would be no way to achieve this, but then I tried a static_cast which turned out to be the solution: using the static_cast ensures that the type casted to is used at compile-time. Isn’t that beautiful? If you don’t need to access the object but constrain the template to a certain type, you could use the d’tor to implement some dummy code. Using this template with a type which is neither “Base” nor inherited from “Base” leads to a compiler error like “can’t convert ‘bad type’ to ‘Base’.

Tool Enhanced Again

Tonight, I added the batch processing. On the left image, you can see a set of six input images on the left, and three output images on the right (all images at 50% zoom, another feature I added). The packing is not optimal in a mathematical sense, but it’s effective anyway, as the shot on the right shows. These (100% zoom) images were randomly picked from a set of output images which were created when I reorganized all of the plants we have in DVW to test my tool.

Tool Enhanced

Tonight, I enhanced the tool (codenamed TexTorture, hehe) with a little rectangle packing algorithm. Taking an unsorted list of sprites (i.e. rectangles), the outcome is already quite lovely. Next, I will try how presorting of the rectangles by width, heigth or area will affect the result. Finally, I want to be able to merge n input textures into m output textures, where m<<n, hopefully.

Q'n'D Java Tool

I just wrote a quick and dirty Java/Swing tool. It loads and autodetects DVW sprites from a texture file and allows to reorganize them. This is useful for stupid programmers like me who don’t want to mess around with mspaint.exe or The GIMP but feel the urge to move sprites around for whatever reason. I am planning some improvements like a textual export of the rectangle coordinates and a cool algorithm to align the sprites automatically including batch processing, but for now, manual moving of the sprites is exactly what I wanted. The autodetection is done using a simple floodfill approach which proved to be sufficient for my test texture. I might find other textures where this approach isn’t enough, therefore I will provide means to apply a dilatation operation on an image and to merge detected rectangles. While I wrote this tool, I recognized a little problem in the AWT drag and drop framework, java.awt.dnd.DropTargetListener in particular. I used DropTargetListener#dragOver(DropTargetDragEvent) to listen for dragging but found that there was no (direct) way to find …

Game Objects

I just read something in AI Game Programming Wisdom 3 which sounded sooo familiar to me. Sergio Garces of Pyro Studios writes about game architecture regarding the game objects, “… we often see examples of inheritance abuse, making the fundamental mistake of confusing behaviour (what objects do) with identity (what objects are)” This is exactly one of the many mistakes I did in DVW, where the inheritance hierarchy is like Entity<-Unit<-Vehicle<-Constructor<-KPBConstructor or Entity<-Unit<-Building<-UnitFactory<-BunkerBarracks. It works, but this really is not the way I would do again. Next time, I would use a part-based approach like sheijk|6S is doing in Velox3D, i.e. the game designer (not necessarily the programmer!) creates units out of several abilities, just like plugging and playing: plug in a motor, and the entity could move; plug in a weapon, and the entity could attack or fight back; plug in a brain (i.e. some AI) and it knows how to use its parts. But we’re making good progress anyway.

Coming and going

Many of us are enthusiastic about getting into the game industry. And the more enthusiastic we are, the more we might wonder why people are happy to leave the business again. At the end of 2004, a blog entry widely known by the authors nickname, ea-spouse, rocked the boat. I remember that many professionals joined in complaining about the working conditions. Recently, I read two similar articles again: Jurie Horneman of ex Rockstar Vienna wrote that he was glad when the studio was shut down. He refered to another article entitled The joyful life of a lapsed game developer whose author was glad to have left the industry for good. How can it be that so many want to get in, and at least some are happy to get out again? Let’s face it. The trouble is that the game industry still is an industry. Like in every other business, be it software or whatever, there are customers, deadlines, and consequently there are crunch times. And I’d expect my employees to commit themselves to the …