Mod developer of old games that (almost) nobody plays anymore.

RSS My Blogs

..or at least, its documentation is.

While I do enjoy modding games (especially ones with intuitive code and good debugging tools; Sins of a Solar Empire tops the list out of all the ones I've worked with) I have always kept my distance from the programming aspect of things. I've gleaned enough over the years to have a broad idea of how the inner workings of many games function, but have never had any desire to modify or replicate it.

When I started working on version 3 of my Reversal mod back in January one of the ideas I came up with was to make a small launcher program with a menu GUI to let you select which variation of the mod to play on. In older versions (and the original Terrans mod) the easiest way to do this was to hand out batch files and/or instruct people on how to configure their shortcuts. I figured a menu would be far more user-friendly, picked up a C++ IDE and went looking for some tutorials on how to get started.

Learning to program took a backseat to developing the mod, but near the end of development I found out that there was a C++ derivative called Qt. It built on what I had already learned and was much easier to use for creating GUIs. And it really is. Just not for a beginner.

There is a wealth of documentation on Qt, both official and unofficial. The official stuff is paradoxically informative yet unhelpful, a good reference for someone already familiar with the language but too nebulous to be useful for someone just getting started with it. It does a good job explaining syntax, but doesn't provide anywhere near enough concrete examples to show how it should actually be used. Parts of the language that claim to do something either require additional undocumented steps to function properly or have simply been broken or deprecated.

The unofficial documentation is whatever you can find through search engines and a good half of it - helpfully linked to by experienced programmers - is located on websites that either don't exist anymore or are so out of date that attempting to follow along only makes the problem worse.

My experience with getting a simple launcher menu to work amounted to a week of headache-inducing frustration scouring through search engine results and the official documentation. It was an effort to piece together the full picture on how to do things I would consider to be some of the most basic parts of the whole programming language: Create one window, press a button, get result. Not all parts of this were painful, indeed some things turned out to be well documented, exampled and painless to bring into effect.

On the other hand I lost two days just trying to figure out why any significantly-sized program would crash if started by the launcher: It turns out that Qt instructs any program it starts to run in the launcher's directory rather than the program's own. While I feel this is counter-intuitive, it wouldn't have been a problem if ANY of the examples, guides or documentation mentioned it. I was saved instead by some very helpful startup crash error messaging in one of the games I tried it with. Once I realized that I had to set the working directory manually, and figured out which methods to do so actually still worked the whole thing didn't take much time to finish. All I had left to do was pack it up and include it with the mod.

Well, the frustration wasn't over yet and neither were the headaches. See, there's two ways to make a program: Pack the library files it needs into the .exe or just include them with a package. These libraries are the bridge between an operating system and the programming language; In short they're needed so that the computer knows what to do with my code.

I was hoping to put everything into the executable and not worry about clogging up my mod users' system paths with these relatively obscure library files. Long story short, I'm just going to paraphrase someone I read on a YouTube tutorial's comments section: "Watching paint dry would be more productive than trying to learn how to statically compile Qt." I wish I had read that first, it would have saved me a lot of time.

By this point I had pretty solidly burned out on the whole project in general and the programming in particular, and I just wanted it over and done with. So I figured fine, lets just include the libraries with the mod and not worry about how inefficient or ugly it might look. So long as most or hopefully all of the users don't have any problems getting it to run I'm satisfied. And that brings me to the whole point of writing this blog:

The launcher I made is a mere 90 kilobytes. It would fit on an old floppy disc from the 80s several times over with room to spare. The libraries required for it to run are a mind-blowing 45 megabytes. That doesn't even include the ones Windows users should already have. 45MB for a menu and some buttons is beyond unreasonable, its outrageous. The size isn't even the worst of it, these are nine different .dll files taking up all this space. I would have thought the most basic, common functions would be in their own small library, and as you got to creating larger and more complex programs the libraries you'd need for all the specialist code would scale with it. Not so. Instead even the most bare-bones program with Qt requires all of these same libraries to run. Sprinkling all the different bits of basic code into a slew of different libraries just seems ridiculous to me for a default, out of the box configuration.

I'm sure there's a way to make it more streamlined but I'm neither experienced nor patient enough to try. Just getting to the point where changes could be made required downloading (and/or learning) Microsoft's version of the C++ tools (in addition to the ones I was already using) along with Python, Perl and Ruby and then getting them configured on my system. All to put the Qt source code together so I could go back to learning how it works, so I could maybe shrink the library sizes down or get it to static compile. Rube Goldberg could've invented less convoluted systems than this.

So if any of you are wondering why the entire mod package has ballooned in size, this is it (aside from all the new map and model fixes). But at least it works.

Post comment Comments  (0 - 10 of 12)
Lasercar
Lasercar

Hey, I've just uploaded the .juice source for Massive's maps. You can now edit all of them without having to make the xmap juice first.

Moddb.com

Reply Good karma Bad karma+1 vote
Guest
Guest

Hey, I play with ground control 2 game with some of my friends and we love very much your mod Terran vs nsa but with GameRanger can't playing with the mod. We would like to play with your online.
To play with the mod we must necessarily launch the game from .bat files!
My contact skype is 'codyilgrande' for help me. Thanks!! =)

Reply Good karma Bad karma0 votes
Lasercar
Lasercar

If you want to run modded multiplayer you have to unpack the mod - GC2 will always use the unpacked files over the packed ones.

Of course, that'll also mean that your GC2 install will always launch into the mod, so it's better to only to it on a dedicated server or if you know what you're doing.

Reply Good karma Bad karma+1 vote
OrangeNero
OrangeNero

nevermind the problems :)
I read about using the .bat file and that works fine. You may delete my previous comments if you wish. review incoming! a bit late sry but still the mod is very much appreciated.

Reply Good karma Bad karma+1 vote
Flamecurse Creator
Flamecurse

Glad to hear it! I'm ashamed that I even made that launcher in the first place, its atrocious. I've been meaning to give it the axe for a while now, and go back to just packing stuff in a .zip file as with the previous versions. Going to go do that now; I guess late is better than never!

Reply Good karma+1 vote
OrangeNero
OrangeNero

I really love you blog btw. Some C&C modders including me started to write a review similar to yours xD its a small world

Reply Good karma Bad karma+1 vote
Flamecurse Creator
Flamecurse

Nice to hear I'm not alone. I wrote & posted that rant after days of frustration. Afterwards I regretted it because a lot more people read it than I had expected! Looking back now, it doesn't seem quite so badly written after all.

Although it speaks volumes that I haven't written a single line of code since, even months later. :P

Reply Good karma+1 vote
OrangeNero
OrangeNero

Hey may I ask?
I got the GOG version of GC2 and your mod wont start. I installed in the main GC2 directoy where also the game exe is. E:\GOG Games\Ground Control II

The error messages tells me:

This application failed to start because it could not find or load the Qt platform plugin "windows"

next message tells me that it terminates the process. Running the mod launcher as administrator did not help. Windows 7 btw.

Reply Good karma Bad karma+1 vote
Guest
Guest

Please make a mod where you add viron's "Centrudroid Vi'cath"...it is in that mission where your ally Khaunir dies...

Reply Good karma Bad karma0 votes
Flamecurse Creator
Flamecurse

That's been in the Reversal mod since the very beginning; Check out the Vindicator Centruroid in the final Viron missions or Skirmish mode. ;)

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account:

X