Mayhem Intergalactic: First commercial game written in D?
Chris P.
chrisp at inventivedingo.com
Wed Dec 12 02:50:23 PST 2007
Ansible wrote:
> Looks great!
Thanks! :-)
> I'd be interested in reading a 'postmortem' of the project. What went
> right, what went wrong? What was easy and what was hard? How did
> writing a game in D compare with writing one in another language?
>
> Ben Burdette
Here goes...
What went right:
- Using D instead of C++ allowed me to concentrate on coding rather than
trying to debug stupidly weird compilation errors cropping up inside
nested STL template code that I don't understand, and
impossible-to-diagnose crashes caused by rogue pointers.
- Porting from Windows to Linux (done when I personally switched
operating systems - I wanted to develop it under Linux so I had to get
it to build!) was easier than expected.
- I learnt a lot about software design.
What went wrong:
- I wrote my own game engine, even though I knew it would make the
process harder and longer. Seems like everyone falls into this trap.
Next time I'm definitely going to use an existing and well-supported
game engine.
- Porting to Mac, which I've just mostly-completed, was harder than
expected. Figuring out how to dynamically link to frameworks and getting
all the Cocoa initialisation code (necessary for SDL) running was tricky
for someone with no prior Mac experience.
- Using D instead of, say, Python meant I felt like I was either
reinventing the wheel all the time, or trying to find a C library (not
C++ - the recent linking-to-C++ functionality looks promising but it
wasn't around at the time I was doing this) that did what I needed. You
just can't beat Python's "batteries included" approach; and for
everything that isn't in Python's standard library, someone's done all
the hard work of sourcing and linking to libraries for you already.
Example: I wrote all my own GUI code, including textboxes (pray that
you'll never have to reinvent that particular wheel), because I couldn't
find any usable C libraries for displaying and operating GUIs in OpenGL.
I did consider porting Harmonia (e.g.) to OpenGL, but it looked too hard.
- I had a lot to learn about software design. :-)
And now it's time for some minor ranting.
I'd say the biggest problem I encountered was a chronic lack of library
support. No matter how great a language is - and D is a great language -
you won't get anywhere if you can't do anything useful with it, quickly.
For *any* conceivable common task, I should be able to drop a
(preferably native, preferably not GPL or LGPL) library straight in and
get on writing new code, instead of having to write the world's 10
millionth textbox or XML parser. I actually ended up using ini files
instead of XML files, simply because there was a great ini file parsing
module available and I wasn't able to find a good enough XML library at
the time that I needed it (about two years ago).
I do think this situation has improved somewhat since I started work on
Mayhem Intergalactic, more than two years ago. Having said that, I'm not
sure I could currently whole-heartedly recommend D to a fellow indie
game developer, largely because of the library situation; but also
because D's Mac OS X compatibility for gaming purposes is not what it
should be. The Mac market is important enough for indie game developers
that they really can't afford any obstacles in the way of porting their
games to the Mac.
(To be clear, gdc works GREAT on Mac; I was impressed by how easy it is
to generate universal binaries for example, as it works exactly the same
way as in gcc. The compiler is not the issue. It's the lack of
comprehensive Mac support from D's various graphics and GUI
libraries/bindings that's the issue. I hope to help rectify that
situation with Derelict at least, although SDL 1.3 will eventually
remove the issue of SDLmain.)
-- Chris P
More information about the Digitalmars-d-announce
mailing list