|
There are a dozen sites already about Half-life mod development. Why
this one? Because the code "tutorials" on those other sites are not
written for programmers. They're written for non-programmers who want to
tinker with mod code without understanding it. As I explore the Halflife
mod SDK, I want to take notes that would benefit other programmers
also beginning to explore the SDK.
In a previous life I wrote documentation for developers, so the task
is within my grasp. I'd rather spend time actually contributing to the
development of some mod, though, so lord knows how far I'll get.
My first comment: the SDK partly a framework for mods, and partly an example
of a mod. It's Half-Life Death Match. Much of the code you'll probably
never touch-- the platform and trains code in plats.cpp, for instance.
Other parts you'll need to rip up into your own framework. For instance,
much of what you'll need to create your own "vgui" (Valve's word for those
good-looking semi-transparent panes and buttons that appeared with TF1.5)
is buried in the implementation of a Team Fortress-specific menu system.
You'll need an IDE. Most people use Visual Studio. Botman has some
instructions for building with Borland's compilers and other tools.
Because I can't stand Visual Studio's user experience, I ported the code
to Codewarrior on Macintosh, which can cross-compile for Windows. (This
was mostly the same kind of work porting to Linux involves: C++ dialect
cleanup.) I haven't tried to make it link yet, but just rely on VS C++
to do that. Because Microsoft, as usual, attempts to embrace and destroy
a language by implementing undocumented extensions, it's not clear the
Codewarrior is able to create a DLL that will work with Halflife at all.
It's a comfortable environment for editing, though, which is all I
really need from it.
You'll also want to keep the server part of your mod building on Linux.
There's no reason why you can't have the same source base building on
both platforms at all times. Port once, learn to avoid the old language
syntax that Microsoft still allows, and your Linux server will be ready
to release on the same day as your client. To get it compiling, though,
you will have to jump through some hoops. You will need to build
an older version of EGCS: EGCS-1.1.2. For more
information, see the very bottom of the "compiling on Linux" page linked
to below.
Read Shadowman's intro to the SDK.
The client.dll and mp.dll class treess, as generated by Codewarrior:
client_class_diagram.png
server_class_diagram.png
There are some of my own classes in the diagrams (anything with CSpec in
the name, mostly). I hide the weapons classes in the server to get the
diagram down in size.
I wrote a quick smoke grenade. You might
want to use it. It's a nice example of how to do missile weapons in HalfLife.
|