Game programming in Delphi: a journey begins

I’ve always wanted to write a video game. So, never one to start small, I’m going to write a game development kit in Delphi.

I’ve been wanting to do this for years, ever since I downloaded Verge v1 and was sorely disappointed in the development experience. It’s entirely possible that there are better game-development engines out there today, but dang it, I still want to write my own. It poses a number of intriguing challenges — and hey, I’ve never been one to pass up a chance to overengineer something.

So prepare yourself for a revolutionary, Delphi-like, RAD, OO game development environment. If I ever finish writing it.

This post is the first in my “Tyler” series, which aims to make a tile-based game-development engine in Delphi.

DelphiX, (un)DelphiX, and beyond

The first step is figuring out how to do decent animation. Video games kinda need, er, video.

I started tinkering with this last weekend. I had a couple of false starts — one was overengineered, with background threads (worked, but didn’t get good enough performance to be worth the complexity); one was underpowered, with the OnPaint handler ending with a call to Invalidate (so-so performance, too slow at larger window sizes). So I settled on (un)DelphiX, a set of Delphi components for DirectX development.

(un)DelphiX has questionable legal status. The original DelphiX was written by Hiroyuki Hori, who ceased development on it sometime in 1998 or 1999. The original included source code, but was not licensed as open source, and did not allow redistribution of modified versions. Later, someone named Micrel picked it up, made some enhancements, made it run on the latest versions of Delphi, plugged in the Jedi header translations, and made it available as the “unofficial version of DelphiX”, aka (un)DelphiX. Early versions of (un)DelphiX were distributed as a patch on top of the unmodified DelphiX, and so were clearly legal. But the latest versions just have the updated, (un)DelphiX code — packaged along with Hori’s original copyright notice, and the requirement that Hori’s original archive be distributed unmodified. So obviously Hori never gave permission for the new version. But it doesn’t look like he’s complained, either.

I’ve decided that, since I’m not the one distributing it, I’m in kind of a light-gray area. But I’m kind of figuring to eventually work my way toward my own implementation, independent of DelphiX. We’ll see how it goes.

A note on design-time components

The latest version of Delphi that I personally own is Delphi 3 or 5, I don’t remember which. It’s in a box somewhere in the basement. And I won’t use it anymore. I’m too spoiled by the recent features that made Delphi a reasonably competitive programming language again — things like strict private and records with methods.

So I’ll be developing with the free Turbo Delphi Explorer for Win32. It’s not quite the latest and greatest, but it’s only one version behind the expensive editions, and it’s got the good features.

What it doesn’t have is support for third-party design-time components. So I’ll be creating the DelphiX components in code, not with drag-and-drop. This raises a few interesting issues, since they weren’t designed to be used that way, but they’re easily worked around.

It also doesn’t have a command-line compiler, so expect me to grumble about that from time to time when I wish I could have a rakefile.

Every project needs a good name

And a good logo.

My main goal is to be able to develop tile-based RPGs, along the lines of Final Fantasy 1 through 6. And since it’s all about tiles, I’m naming the project “Tyler”.

Actually, I started on another, similar (but .NET-based) “Tyler” project back in 2003, so I’m really just recycling the name. And I also get to recycle the spiffy logo I made:

Tune in next time…

I’ll try to keep my game-programming posts from getting too long. This choice was inspired by Scott Guthrie, who posts absolutely amazing content — but he does not post articles, he posts chapters. It’s impossible to read one of his posts in a single sitting. So I’ll err on the side of multiple, shorter posts, so you can read a few at a time (and then mark them as read in your feed reader, so you know where you left off).

So, until next time, when I build a simple “Hello, world” program with (un)DelphiX, and then work around the Delphi bug that makes it not work quite right.

Leave a Reply

Your email address will not be published. Required fields are marked *