Back to projects

2011-2016

Call of Duty Modding

Working with the Call of Duty 4 ecosystem has occupied a considerable amount of my free time for years.

Hide 'n Seek

Most of my effort went into the HNS mod I've been working on. Originally it was made specifically for a server I've been running, but as it got more popular, I have released it to the public.

Prop Hunt was already a concept in other games (e.g. CoD2), and there was even another similar mod existing for CoD4, but I wanted to take it a few steps further than others did:

  • I have attempted to make it as online-multiplayer compatible as possible. CoD games are usually full of bugs that are pretty easy to exploit and jump outside the level, go into rocks, et cetera, which, of course, are game-breaking in a game mode where you win if you're not found. I've tackled all known issues on a case-per-case basis: checking player velocity and change of origin which suggested elevator / bounce jumps, added server-side collision to areas where players could jump outside the map, some (very primitive) hash to see if the stat file has been tinkered with, and a lot of other cases. Luckily players kept reporting such game / engine bugs, so I could keep the mod competitively playable continuously as they were discovered.

    if (p.origin[0] == p.watch.point[0] && p.origin[1] == p.watch.point[1] && p.origin[2] > p.watch.point[2] && !ladder && !mantle) {
        p.watch.height += p.origin[2] - p.watch.point[2];
    
        if (p.watch.height >= level.maxJump)  {
            // Elevator jumper
            p thread jumper("elevator");
            p.watch.height = 0;
        }
        else {
            // Reset time
            if (p.watch.time) {
                p.watch.time = 0;
            }
        }
    }
    
  • Lots of rewards for long-term engagement: With each level you could unlock more and more features ("only 10 more levels until I unlock the hider knife!"), you could unlock different models by collecting points that you only got when you were looked at (so the more obvious place / larger object size you could survive with, the better). As the most active players kept reaching new and new levels, I kept adding more and more insane requirements for additional unlockables ("retro live service 🙈"). Hiding in plain sight with a boiler

  • Runtime diversity: You could get rewarded for streaks (e.g. getting a randomized air supply), you could play as a hostile hider, hide alone or co-operate with friends, add extensions to your model (e.g. if you were a trashcan, you could add a lid on the top, or a trashbag next to it), etc. Trashcan Hider with attachments

  • And a truckload of fun features, some of which I might not even remember. I unlocked some closed off parts of built-in levels (if nothing was broken in there), added support for some 3rd party ones (and other server providers could also do it from config files - I even provided a command line tool to be able to check which models are available for the given map), the mod had voting, AFK handling and many other stuff.

The reception back then has been pretty unexpected and exciting - there were servers with 40-64 players that were full of players day and night, streamers made complete series playing the mod, clans and communities formed, and for some time HNS was in the top 100 most popular mods on ModDB.

APB

I was a fan of the All Points Bulletin: Reloaded game at the time, so I have attempted to replicate the gameplay as a CoD4 mod. I never finished it completely, but I put a large amount of time in it (20.000+ LOC), so it ended up having some pretty cool features.

The gunplay remained the same as the original game, but basically all game rules were replaced. There were players on the server who at the same time participated in different game modes based on automatic matchmaking, unable to interact with other players' missions. They could change a lot of settings (including language), level up, complete challenges, collect and trade weapon skins, profile pictures, weapons, attachments, and many others (see ModDB for screenshots). Besides APB, I also stole some random ideas of TF2 (of which I was also a fan of), like having nonsensical hats: Soldier with a cowboy hat

Or as meaningless as having a unique sound when you take down two enemies with one shot:

Technically, one of the biggest changes is that we made an SQLite server integration with my younger brother (Levente, he made the database service) to CoD4's scripting language (with the help of Ninja's reverse-engineered server binaries), so that the mod could store all persistent player data there. With this, we were able to do queries like this directly from GSC:

sql_fetch(sql_query("SELECT item, value FROM premium WHERE code = '" + msg + "' AND name IS NULL"));
sql_exec("UPDATE premium SET name = '" + self.showname + "' WHERE code = '" + msg + "'");

This feature supported some data-heavy systems like in-game messaging: List of messages with inventory attachments

The player group management: List of groups, teams, friends and clans

Or the death themes:

The mod had a lot of supporting tooling, e.g. a program to build tattoo grids with limited free texture resource slots available, another generate particles with given size/density, a rudimentary launcher, and even a preprocessor for GSC.

This was needed, because some performance-critical code was not fast enough (e.g. matchmaking), so I started micro-benchmarking and found some stuff, e.g. that script function calls are heavy, or that below some iterations, querying the size of the array in a loop condition is faster, while for larger loops it is considerably slower. With these findings, I started building a preprocessor which was able to inline functions and turn hint-supported loops into their most efficient form.

So for example code like this:

locations = getEntArray("loc", "targetname");
foreach (e in locations;;+)
{
    e thread checkLocation();
}

Became this:

locations=getEntArray("loc","targetname");
__c16=locations.size;for(__i16=0;__i16<__c16;__i16++)
{
locations[__i16] thread checkLocation();
}__i16=undefined;__c16=undefined;

After most hitch warnings disappeared from the mod thanks to all these, I focused on syntactic sugars: I have introduced ternary operator, default parameters, C-like preprocessor directives, enums and other fun features.

RotU: Dies Irae

One of the zombie mods, Reign of the Undead was the most popular one in CoD4, and I have extended it for the server I was running. I have built several unique maps, added a lot of CoD5 World at War features like randomized golden guns or perks, there were traps, power-ups, buyable weapons, destructible obstacles, generators you had to turn on before you could use the vending machines, landmines and special abilities (e.g. calling in a little armageddon).

Custom Master Server

Most servers were cracked (so that everybody could play on them), but there was an issue that every server connection started with like 5-10s of waiting while the client was trying to verify the validity of the CD Key with the master server. Cracking the game was done by simply changing the URL of the master server, so that connection can not be established, upon which the client was allowed to connect.

It was pretty annoying, so I have bought the domain to which most Linux cracked servers were directed (activision.com -> akthvision.com), and with my brother we have written a master server that allowed all CD keys to pass, accompanied it with a web interface (to list all servers and to be able to ban players - which we never ended up using), and hosted it on a VPN. Suddenly all connections to these servers were near-instantaneous ⚡ (and of course, even if anybody realized that it happened, nobody knew that it was done by us). It was a fun experience to decipher the format of CoD's challenge packets and to be able to affect such a large userbase (the list was filled by hundreds of servers as soon as we spinned it up) of an established franchise like Call of Duty.

Community

I have driven a Hungarian community at the time called ModBase.hu, which had community tutorials (mine were for JKA and CoD modding), mods, some online tools, our own forum, chat, modding tool downloads and other features. ModBase interface

Some shorter tutorials are still available on ModDB (they might not be factually correct though 😬):

Visual Mod

For some time I have also worked on a mod with which you could control the post processing and other visual parameters of each level, and save out the result.

Originally I have done this to be able to quickly iterate on the looks of my custom levels, but to my surprise it was mostly used for beautifying gameplay videos.

Call of Duty 2

Many people were playing CoD2 and CoD4 simultaneously as they were so different games; zombie mods were the most popular in that era, so (obviously) I also had to make my own.

It wasn't as big as HNS or APB, but we frequently had a full server, unique maps and features, zombies with different abilities (burning, invisible if walking slowly, ...), etc. Burning zombies