Perfect Accuracy Fist Fucking

Perfect Accuracy

Since my last post on the topic of Borderlands 2 modding, I did manage to finish up and release the weapons accuracy mod I was talking about. I was able to get through a whole playthrough as Maya without encountering any massive game-breaking issues, so I figured that was a good start for a beta release. The fact that the mod makes the game so much more enjoyable to play really helped me keep up the momentum with testing and making tweaks as well.

Since then, I’ve also been releasing a bunch of other, smaller mods, some using the Python SDK, some using batch text commands. You can find them all on the Borderlands 2 Mods Page. There’s really only a few more mods I’m wanting to make for the game.

One mod I’ve been investigating since the beginning is changing the vehicle controls from mouse turning to keyboard turning. It’s always baffled me why nobody else made a fuss about the mouse vehicle turning in this game (and the predecessor). I feel like on PC this was the first popular game to do this and yet everyone was just like “okay”, even though it’s obviously inferior and stupid to have both vehicle turning and vehicle weapon aiming on the mouse. Meanwhile, the keyboard left and right movement keys are just there being unused like “am I a joke to you?”. I assume it’s just a melange of console control bullshit seeping over, noobie kids that don’t know better, and non-technical PC gamers just accepting things for what they are. But I won’t stand for it! Even if I’ve been playing this way for years, it still feels wrong! I think the change is probably possible, although it will almost certainly take the Python SDK to do so. I’ve already scoured the configs and data files looking for ways to reassign the turning axis but came up fairly empty-handed. Luckily, I think I’m comfortable enough with the SDK at this point that I’ll be able to figure it out if it’s at all possible.

I’m also still tweaking the Perfect Accuracy mod, though, of course. One change I made initially with the mod was to remove the dumbass insane recoil from the first few shots of Hyperion weapons. It made the Hyperion SMGs essentially unusable as you’d waste the first fourth of a mag just hitting fuck-all. But I kept the relatively good recoil that Hyperion weapons had overall. I didn’t realize at the time, but the Hyperion SMGs and pistols also had really low hip-fire spread for some reason (the Hyperion stats are kind of a confusing mess because of this weird initial recoil they do), and this made them basically hip-fire laser-beams with lower recoil and inaccuracy. I’m toying around currently with ways to correct this, but I’m probably going to go with something where the Hyperion weapons have best-in-class recoil but worst-in-class hip-fire spread. This kind of fits with the original flavor of the Hyperion weapons anyways, without being too annoying. It just means the player will need to judge when to ADS or hip-fire differently compared to other manufacturers’ weapons.  But trust me, if it doesn’t feel good to me, it won’t go in the mod. I don’t know how something like that got into the game in the first place—maybe for a gag? Sure, for a gag, put the effect on a legendary weapon, not an entire manufacturer’s unique feature.

I also did pick up a bunch of the DLC for the game on a recent Steam sale, so it’s quite likely that I will add support for their weapons in the Perfect Accuracy mod eventually.

I guess I should also mention this demonstration video I did for the Perfect Accuracy mod. I spent a while on it and it ended up being quite long—most certainly too long if we’re being honest. I just wanted to be thorough because I have a feeling a lot of people just won’t “get it” otherwise, they’ll just be blissfully ignorant of the situation and totally accept it as is. (Am I just too much of a nit-picky perfectionist or are there a lot of people these days that just accept whatever is told to them because of hype, charisma, reputation, whatever misplaced trust? Nobody challenges anything anymore.) But at over thirty minutes long, I should really find a way to distill the video down into a more succinct package that still gets the message across. Something to think about for a final release perhaps. Anyways, here’s the video in case you like watching changes instead of just reading about them.

Fist Fuck

Several years back I toyed around with Doom map making after another enjoyable full playthrough of both the original 90s games. Besides an interesting but never-finished beach-landing map and a bizarre bastardization of the noteworthy Marines map (my favorite feature of which was the zombie sergeant death sound being changed to a recording of Butthead saying “did I just score?” 😄), both that I did when I was a teen, I never made a proper Doom map. I have good ideas for maps generally, but the constant creative minutia gets to be too tedious for me after a while.

But the thing is, I did actually finish one small map and then forgot to publish it because I was anticipating finishing another much larger map just after. The smaller map in question is called Fist Fuck. It’s an apt name given that the only weapon at your disposal (practically-speaking) is your fist with the berzerk powerup. It was born from my curiosity about how useful berserk could actually be. In the base game, it’s never really clear how powerful or lasting the berzerk powerup is (it’s quite powerful and lasts the rest of the level btw), so I basically wanted to create a level to explore the possibilities of berserk.

Obviously, the range limitation of berzerk means that pitting the player against enemies with ranged attacks at range would be quite difficult. So, I mainly stuck to hoards of weaker and melee-only enemies and lots of tight corridors. Besides, one-shotting lines of weak enemies into red mist is as satisfying as gobbling the white dots in Pac-Man, arguably even moreso in fact.

Now there are many different versions of the Doom engine to target ever since the source code was released. But to give myself a challenge, I thought I’d try to make the level support the original Doom2 engine so that it could work on any of the ports (theoretically), even the original DOS one. And sometimes I think the Doom mappers go too far these days; sure, you can modify the Doom engine to add whatever features and remove whatever limits you want, but why not just use a modern engine at that rate? To be fair, the multitude of Doom engine limitations are quite cumbersome. But still, completing the challenge and saying your map can run on any version and port of Doom(2) feels the utmost fulfilling. Here’s some screenshots of Fist Fuck running on DOSBox for what it’s worth.

You can find more information, a video, screenshots, and the download for Fist Fuck on the newly-created Doom Levels Page. As I said before, I wanted to have more than just one map before I made a page specifically for Doom maps. But who knows when I’ll feel up to finishing the other map, perhaps after another complete playthrough of Doom and Doom2. 😛 I don’t know. I think the amount of pain I’m in on the regular is just too much to support such creative ventures anymore unfortunately. But I want to end with a few screenshots anyways, so we can see “and all that could have been”. They’re a mix of Chocolate Doom and ZDoom as the resolution of Choco is just too low to convey much in a mere screenshot most of the time.

Posted in Gaming, Modding | Tagged , | Leave a comment

Mobile Improvements

I’ve made a bunch of modifications to the site that should hopefully make it a lot easier to read on mobile devices now. I’m really sorry I neglected to do a proper job of this for so long, but when I made this site back in 2011, mobile support was basically an after-thought. And now it’s just one of those million things that I haven’t the mental capacity to do anymore.

But I think I’ve got it hacked together enough to where it works—at least on phones. I’m pretty sure I accomplished this in what would be considered a non-preferred way by increasing font sizes instead of clamping page widths, but this kept me from needing to fix an untold number of content elements inside posts/pages.

I’ve been wanting to fix this for ages, but it really struck me recently how so many people are browsing on their phones now. Of course, what I really want to do is rebuild this site from scratch with a responsive design. But then, I’ve spent most of the last two weeks stuck on the couch. So, that’s where things are at now. 🙃

Anyways, if there’s any glaring errors, let me know in the comments. I will do my best to fix them.

Posted in Website | Tagged | Leave a comment

More Mods and Modding

Epic Games Mod Music

In a continuing effort to further perfect my mod music library, I’ve been redoing my conversions of the music from several of my favorite Epic MegaGames soundtracks, specifically Unreal, Unreal Tournament, and Jazz Jackrabbit 2.

My previous efforts were all plagued with improper volume levels as I naively thought that music should just be normalized and that’s it, job done. Since then, I’ve come to understand about loudness levels and limiters that can increase the volume without clipping. To be fair, normalizing is still the most appropriate way to level audio as it doesn’t alter the dynamic range. The only problem is that normalizing alone is impractical as all other music these days is boosted to a loudness of around -10 LUFS, and you don’t want to constantly adjust your speaker volume to account for the variance in volume. It seems mod music is particularly susceptible to being problematic in this regard as well since many tracks were made to just slam up against 0dB and let the player’s Auto-Gain Control sort it out.

Unfortunately, the automated mod conversion process that I mentioned last post has one major flaw in that it just kinda makes all the tracks the same volume. -10 LUFS loudness is fine for most lively music, but for softer tracks (like that of Unreal’s ambient music), you might want the volume up to 10 LUFS quieter. You really have to listen to each track and decide on an appropriate loudness. So, that’s what I did. You can download all three game soundtracks and listen to some samples from the Epic Games Tracker Music project page.

The majority of the three soundtracks were converted in the automated way using FFmpeg’s OpenMPT library and built-in audio filters. Some of the tracks were ones that I selectively recorded/remastered and then released here back in 2008, but just with the fixed volume levels. Luckily, I still had all the wave files available to use. And a few tracks I actually remastered recently in the same way that I did for the Deus Ex Soundtrack remaster. So, it’s kind of a hodge-podge of different conversion methods, unfortunately, but I wanted to just make it available for people as-is and hopefully add more remastered tracks later. It’s still very listenable, though, as long as you don’t mind some clicking and pops from bad samples and sudden track ends.

There’s also a bit of an issue with much of the Unreal music included as it only contains the ambient sections of each track. It wasn’t until after I had everything ready for upload that I finally figured out how to get FFmpeg to convert the other sections of the tracks. These sections are often referred to as “subsongs” (at least in contemporary mod players), but the mod formats don’t have a specific mechanism in place to define these sections. Instead, they merely use the Bxx effect command to jump to different patterns in the song. These can be used to loop different sections of the song and be programmatically switched between, e.g. in a video game. The OpenMPT library actually has a process included that can identify these sections, and it’s also available as an option in FFmpeg by utilizing the option -subsong. However, I couldn’t find a single example of how this option is used anywhere online and only later (through shear persistence… or maybe just dumb luck, I forget) discovered that the subsong option has to go before the input file is given (-i). Maybe that makes sense because it’s technically modifying what the input is…? I dunno, it seems pretty stupid to me, especially undocumented.

Regardless, I need to reconvert a lot of the Unreal soundtrack as such. I would have just gone ahead and done it, but many of the sections are rather long and perhaps need to be a separate track. Some people always complain about how I did the Deus Ex soundtrack remaster with every section included in one track, and I still think that was the right choice for Deus Ex, but it’s making me hesitant to repeat that arrangement for Unreal. It just needs further consideration.

And honestly, Unreal is probably the weaker of the three soundtracks. There’s definitely some great tracks in there, but UT and Jazz 2 just have some seriously bangin’ tracks. Alex Brandon really did some amazing mod compositions back then. I actually also realized that the versions of the Jazz 2 soundtrack that I had (from Lori Central) were slightly different from the game versions, so I converted all the Jazz 2 music a second time to see which versions I should include in my compilation. I ended up writing a whole PHP script to extract the mod format files from the j2b files that come with the game, and then found out that OpenMPT will just open the j2b files as is. 😄

Borderlands Modding

I’ve been playing a lot of Borderlands 2 recently. There’s just something about that game that makes it probably the best “looter shooter” AKA first-person action RPG—it’s probably the very satisfying visuals combined with the endlessly-humorous dialogue. Seeing damage numbers fly out of enemies as you shoot, punctuated by the occasional “CRITICAL” hit really prods those dopamine receptors. And all of the characters being just such over-the-top caricatures with the most irreverent dialogue—Scooter’s incestuousness, Moxxi’s innuendos, Brick’s insatiable bloodlust, all the bandits’ ridiculous one-liners, etc.—it always lifts my spirits.

But even for all its good qualities, the game isn’t without its faults. And I’m apparently perpetually drawn to attempting to fix such faults in the form of game modding. However, I specifically remember trying to find some BL2 modding tools several years back and coming up empty-handed. But after a recent playthrough, I looked again and was delighted to see that a modding community has sprung up around the game after a couple of different modding methods were devised.

The first modding method is quite straightforward and intrinsic to the Unreal engine that the game is built on, and thus I am surprised there weren’t more mods made for the game sooner. It relies on the console being enabled and then using two console commands to override game settings. The first being the set command, which changes any variable to some given value. And the second being the exec command, which reads a text file in and executes whatever commands it finds. These allow one to change as many game settings as necessary and then package the changes all in one convenient text file. There’s even a tool made to help format and merge multiple mods into one file called OpenBLCMM.

The other method I only started looking into recently, but it is very powerful if you have enough motivation to figure it all out. It’s of the variety of DLL-injected code wrappers that can load any number of external scripts and is called succinctly-enough PythonSDK. Unfortunately for me, I’ve been neglecting to learn Python for years (mainly because of my illness to be fair). Mostly I just find Python to only be popular because of this one gimmick it has where text indentation and line breaks also control code blocks. It is nice that all Python code looks really clean and uniform (boy, do I hate people that put beginning curlies as the only thing on a whole line in other languages), but it really doesn’t seem so groundbreaking that everyone needs to switch to it as the new hotness. But that’s probably just my uninformed and biased position as a newcomer. 😛 I also thought Half-Life 2 was overrated at first. 🤐

Anyways, I’ve already fixed a number of small nagging issues with BL2 and have a basic framework for a larger change mostly figured out. One thing that’s always annoyed me about Borderlands games is their inclusion of an accuracy attribute on all weapons. So, you can have your crosshair directly over an enemy and the shot just plain misses or hits but isn’t a critical hit. It removes a lot of the skill from the game and replaces it with luck, which feels less satisfying.

I’ve changed the game to always be completely accurate when aiming down the sights, and to also have slightly better accuracy control when hip-firing. It’s totally revitalized the game for me, making me rely much less on sniper rifles (which were always close to 100% accurate when aiming down the sights) and experimenting more with the other types of weapons. I’ve also been tweaking some of the recoil characteristics of the guns to make them more controllable, especially for the SMGs, which I could never quite put my finger on as to why they felt so bad to spray, but have since realized that it’s because they recoil mostly only horizontally—try keeping the reticle on-target when it constantly bounces left and right randomly.

I’d like to release my BL2 mods, of course, but the weapon handling mod will need a lot more testing and tweaking until it’s to a point where I’m satisfied with the feel and game balance. I guess it does make the game easier, provided your aim and recoil control is good, so that’s something I have to look into as well. Check back later to see if it gets completed and released. 😛

Deus Ex Soundtrack Videos

One thing I like to do these days when I’m feeling only-slightly crappy is edit videos. It requires only a modest level of thought and creativity while being mostly an engaging yet repetitive task—make a small timeline tweak, rewatch to see how it looks, repeat. My CPU is over 10 years old now, so it chugs a lot when editing HD video, but it’s bearable I suppose.

One project to come out of this video editing recently has been a series of music videos to accompany my remastered versions of the Deus Ex Soundtrack. I really wanted to expose a wider potential audience to the remasters, and I thought YouTube was a good platform for that, being so open and also having a huge library of music already. I thought about just putting a static image, the cover image, for the video portion (as so many people do for music videos on YouTube), but that seemed too lame and uninteresting for someone that was watching on anything with a screen. But I also didn’t want to have a lot of fast-moving gameplay captures since that would massively increase the file-size (for variable bit-rate video compression at least, which is what YouTube uses) for users only listening. So I decided on a compromise of in-game capture with a stationary camera to keep the motion down.

I ended up creating a little library of shortcuts and console commands to help simplify the process. Luckily, Deus Ex has all its scripts easily editable from inside UnrealEd (the original one still runs if you have all the ActiveX library files installed) unlike Borderlands 2. Here are the edits I made to the “DeusExPlayer” class.

var bool bToggleHud;
var bool bToggleGhost;
var bool bToggleInvisible;

// ----------------------------------------------------------------------
// ToggleHud - Snake Modification
// ----------------------------------------------------------------------

exec function ToggleHud()
{
    if (!bToggleHud)
        ShowHud(false);
    else
        ShowHud(true);
        
    bToggleHud = !bToggleHud;
}

// ----------------------------------------------------------------------
// ToggleGhost - Snake Modification
// ----------------------------------------------------------------------

exec function ToggleGhost()
{
    if (!bToggleGhost) {
        Ghost();
    } else {
        Walk();
        ClientMessage("Walking");
    }
        
    bToggleGhost = !bToggleGhost;
}

// ----------------------------------------------------------------------
// ToggleInvisible - Snake Modification
// ----------------------------------------------------------------------

exec function ToggleInvisible()
{
    bToggleInvisible = !bToggleInvisible;
    Invisible(bToggleInvisible);
}

// ----------------------------------------------------------------------
// SpawnMassPawn - Snake Modification
//
// Spawns a bunch of pawns around the player with an optional number, alliances, and weapons
// ----------------------------------------------------------------------

exec function SpawnMassPawn(Name ClassName, optional int TotalCount, optional Name Allies, optional Name Enemies, optional string WeaponPackage)
{
    local ScriptedPawn spawnee;
    local vector       spawnPos;
    local vector       center;
    local rotator      direction;
    local int          maxTries;
    local int          count;
    local int          numTries;
    local float        maxRange;
    local float        range;
    local float        angle;
    local class        spawnClass;
    local string       holdName;
    local float        rnd;
    local int          i;

    if (!bCheatsEnabled)
        return;

    if (!bAdmin && (Level.Netmode != NM_Standalone))
        return;

    if (instr(ClassName, ".") == -1)
        holdName = "DeusEx." $ ClassName;
    else
        holdName = "" $ ClassName;  // barf

    spawnClass = class(DynamicLoadObject(holdName, class'Class'));
    if (spawnClass == None)
    {
        ClientMessage("Illegal pawn actor name "$GetItemName(String(ClassName)));
        return;
    }

    if (totalCount <= 0) totalCount = 10; if (totalCount > 250)
        totalCount = 250;
    maxTries = totalCount*2;
    count = 0;
    numTries = 0;
    maxRange = sqrt(totalCount/3.1416)*4*SpawnClass.Default.CollisionRadius;

    direction = ViewRotation;
    direction.pitch = 0;
    direction.roll  = 0;
    center = Location + Vector(direction)*(maxRange+SpawnClass.Default.CollisionRadius+CollisionRadius+20);
    while ((count < totalCount) && (numTries < maxTries))
    {
        angle = FRand()*3.14159265359*2;
        range = sqrt(FRand())*maxRange;
        spawnPos.X = sin(angle)*range;
        spawnPos.Y = cos(angle)*range;
        spawnPos.Z = 0;
        spawnee = spawn(SpawnClass,,,center+spawnPos, Rotation);
        if (spawnee != None) {
            if (WeaponPackage != "") {
                //clear the default inventory
                for (i=0; i<8; i++) {
                    spawnee.InitialInventory[i].Inventory = None;
                    spawnee.InitialInventory[i].Count = 0;
                }
                switch (Caps(WeaponPackage)) {
                    case "PISTOL":
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponPistol');
                        spawnee.AddInitialInventory(Class'DeusEx.Ammo10mm', 2);
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponCrowbar');
                        break;
                    case "MELEE":
                        rnd = Rand(3);
                        if (rnd == 0)
                            spawnee.AddInitialInventory(Class'DeusEx.WeaponCrowbar');
                        else if (rnd == 1)
                            spawnee.AddInitialInventory(Class'DeusEx.WeaponCombatKnife');
                        else
                            spawnee.AddInitialInventory(Class'DeusEx.WeaponBaton');
                        break;
                    case "ASSAULT":
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponAssaultGun');
                        spawnee.AddInitialInventory(Class'DeusEx.Ammo762mm', 12);
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponAssaultShotgun');
                        spawnee.AddInitialInventory(Class'DeusEx.AmmoShell', 12);
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponCombatKnife');
                        break;
                    case "FLAME":
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponFlamethrower');
                        spawnee.AddInitialInventory(Class'DeusEx.AmmoNapalm', 8);
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponCombatKnife');
                        break;
                    case "NONLETHAL":
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponProd');
                        spawnee.AddInitialInventory(Class'DeusEx.AmmoBattery', 6);
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponPepperGun');
                        spawnee.AddInitialInventory(Class'DeusEx.AmmoPepper', 2);
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponBaton');
                        break;
                    case "PLASMA":
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponPlasmaRifle');
                        spawnee.AddInitialInventory(Class'DeusEx.AmmoPlasma', 20);
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponNanoSword');
                        break;
                    case "SWORD":
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponNanoSword');
                        break;
                    case "STUN":
                        spawnee.AddInitialInventory(Class'DeusEx.WeaponProd');
                        spawnee.AddInitialInventory(Class'DeusEx.AmmoBattery', 50);
                        break; 
                }
            }
            spawnee.InitializePawn();
            if (Allies != '')
                spawnee.SetAlliance(Allies);
                spawnee.ChangeAlly(Allies, 1, True);
            if (Enemies != '')
                spawnee.ChangeAlly(Enemies, -1, True);
            count++;
        }
        numTries++;
    }

    ClientMessage(count$" actor(s) spawned");

}

The first three functions just allow you to have a single key for each of the commands by toggling them. The last function is a modification of an existing function that lets you spawn a bunch of objects around the player, but I’ve expanded it so you can set alliances and give them weapons. This was handy for spawning two groups of characters and then having them fight so I could record it. 😄

To use all of these functions, you need to make some modifications to your Deus Ex keybinds in the User.ini file. Find the section [Engine.Input] and add the following commands to some keys.

L=legend
K=set deusex.jcdentonmale bcheatsenabled false
J=set deusex.jcdentonmale bcheatsenabled true
I=ToggleInvisible
H=ToggleHud
G=ToggleGhost
Tilde=type

As for what these keybinds all do: J will turn cheats (and the type command) on, K turns cheats back off. The game puts a “cheats enabled” watermark on save game screenshots to make you feel bad about cheating, so it’s helpful to be able to turn it back off. Tilde (~) opens the command line so you can type in commands like the SpawnMassPawn() defined above. H toggles hiding the HUD, useful, of course, for getting clean screenshots or video captures. G toggles “ghost mode”, which is basically just noclip plus fly, so you can position the camera wherever you need to get the best shot. I toggles invisibility, which is useful for making actors not respond to you. You’d think ghost would be enough, but they’ll still target you if not invisible. And L opens the in-game debug / “secret” menu. It’s useful for switching maps without having to type in the open console command. See the screenshots below.

So, utilizing all of these tools was how I was able to record all the b-roll footage for the YouTube videos. I guess it’s nothing special, but maybe it helps give people the nostalgia berries even more, really putting them into the levels, plus some silly fight scenes for the lulz. The response from YouTube comments and views has certainly been positive, at least. For the record, I only did videos for the tracks that I redid in the recent soundtrack update. I’m hoping to do the rest of the videos when I do the rest of the remasters.

What Else I’m Up To

As I spend most of my days feeling unwell, I end up watching a lot of gaming streams. I’m quite thankful that such lengthy forms of entertainment exist these days. There are three streamers that I watch pretty much exclusively. I got into ChocoTaco from my PUBG addiction, and I think he best mirrors what my playstyle would be if I weren’t sick–extremely calculated and with good instincts. Unfortunately, Choco’s sense of humor is a bit lacking, so for a dose of levity, I like to watch a British streamer called Platform32. I also discovered him through PUBG, but he plays a fair amount of other games that I enjoy as well, all laced with copious amounts of witty and raunchy banter. Finally, and this is bit of an odd one, but I really enjoy watching Felicia Day for some reason. She’s not the greatest of gamers, but she does okay, and the arc of her failing repeatedly before finally overcoming challenges is entertaining somehow—Felicia can be quite bombastic. That, and she talks a lot and is generally insightful enough to keep it interesting.

Like I said earlier, I’m doing a fair bit of video and audio editing. I’ve become rather decent at it, frankly. I’m also doing a lot of home improvement since it allows me to not have to think so much. Plumbing, electrical, woodworking, HVAC repair, painting—I’ve been dabbling in it all. Getting people to come out on my schedule and fix things has become quite inconvenient and expensive these days, so DIY almost seems like a necessity as long as it’s not an emergency repair.

And I’m still playing some video games, though not for as long or as wide a variety as I would like. I played a lot of Vampire Survivors and Ooblets last year. And, of course, I have my yearly replay of Slime Rancher and Stardew Valley to occupy me.

Well, this is an epicly-long post, so I better end it already. I do appreciate the comments everyone leaves; sometimes they do encourage me to poke around with a project again.

Posted in Gaming, Media, Modding, Programming | Tagged , , , , , , , , , , | Leave a comment

Mods, Mods, Mods: A few updates

I’ve been publishing some small projects lately, so I thought it was a good time for an update on them and how things are going.

My health is still not good. I think the progression of my illness has slowed slightly as I’ve become more aware of how it functions and how to manage it.  However, I’m still not aware of what it is.  I’m still researching and analyzing and fighting to figure it out, though.  But it is probably some kind of rare genetic metabolic disorder.  Regardless, I have to take things slow and put any energies into smaller, less-intense projects.

Mod Music Conversion

One such project was converting all my old mod music into MP3s so I could listen to them more conveniently.  I’ve been manually converting small batches of mods for years and found through that process that many automated ways of transcoding mods had issues.  Either metadata would be left out or certain bits wouldn’t sound right or the volume was too low or the frequency balance would be muddy sounding.  This is why I would always just playback the mod in ModPlug Player (my player of choice) and directly record the output into Audition, tweak the volume, save to MP3, and done.  You can’t reasonably do this for a library of over 400 songs, though.

The first problem I wanted to tackle was getting as much metadata out of a module file as possible and putting it into an MP3 file’s ID3 tags. I started looking into libOpenMPT as a way to open the four major mod formats and grab their metadata in a standardized way.  It’s a decent library, but the documentation could use some work. I had to read through its source code for hours until realizing that it returns strings as UTF8. This was only a problem because .Net can only marshal strings from unmanaged memory that are ANSI or UTF16 by default, which seems pretty weird given UTF8 is so common.  But one custom UTF8 marshaling function later and I was in business.

The next problem was that the mod metadata ended up being not the greatest. Almost all mods have a title and a field for what tracker software was used, but modification date only became a feature by the Impulse Tracker format, and none of the main formats have artist fields.  I had to use a lot of regex magic to even get a fraction of the date and artist metadata from the song comments.  The comments, by the way, are another quirk of the mod formats.  Artists typically put notes about their work in the comments; however, only Impulse Tracker had a specific field for this. The earlier formats used either sample names or instruments for these notes.  Being that I wanted to preserve all of this in the extracted metadata, I just concatenated all three fields together with some delimiters between them.

Luckily, getting the extracted metadata into an MP3 file is a bit more simple as there are a number of ID3 libraries for .Net.  TaglibSharp is the most popular one, but it is not without its quirks as well.  Particularly, trying to delete specific user text frames (TXXX) is not the least bit straightforward.  But in the end, I came up with an imperfect little tool to copy module metadata to an MP3 file (or output to text if necessary for your purposes) that I put up on Github.  Thankfully, ID3 is a much better tagging format than what module files used. 😄

As I was trying to figure out how to work with libOpenMPT, though, I discovered that ffmpeg also uses this library to load module audio. Given that libOpenMPT was basically the evolution of ModPlug, I thought that the playback might be comparable between the two. I did some test runs converting a few songs to MP3 and found the results to be promising.  Obviously, the aforementioned muddiness of the sound persists, but I then found that ffmpeg has quite a vast library of audio filters to utilize. One EQ later and that issue is fixed right up.

What was more of a struggle was how to balance the volume of the songs.  Naturally, you don’t want to risk clipping the audio data by doing a straight up amplify.  ffmpeg does include a hard limit filter to avoid clipping, but how do you know how much to amplify?  You can’t normalize a song’s audio without having the whole song to analyze and ffmpeg only works in streams of audio data.  It’s a problem I have yet to find a straightforward way to tackle. In the end, I used the loudnorm filter to extract the loudness of the song, calculated the amplitude needed to reach about -10 LUFS, and then did a second pass including the desired hard limit.  More information on the whole conversion process can be found on the Github page for the metadata extractor.

Ultimately, I’m fairly pleased with the results of this project. I did get my entire mod library converted to MP3 with some snazzy album art and good sound.  But I also did end up having to manually adjust a lot of the artist names and titles in MusicBrainz Picard to catch all the missing artists and make them all uniform, so that was a bit of a drag. Also, there are a few songs that seem to have minor issues with conversion accuracy, primarily Necros songs coincidentally.  I may still end up manually recording a number of the songs ultimately, but what I’ve got so far is pretty damn good.

Mods MP3 library in Dark Audio Station

Mods MP3 library in Dark Audio Station

Deus Ex Soundtrack v2

Given that I was already binging old mods, my conversion of the Deus Ex Soundtrack—which was originally in the mod format—kept coming up on shuffle.  However, I was getting pretty annoyed at how quiet the songs were as I had stupidly only normalized the volume instead of hard limiting it.  I thought it would be a quick couple day project of loading up the original wave recordings and tweaking the volume levels, but I soon found lots of other lingering issues with those recordings.  It was mainly just clicking from bad sample loops or poorly recorded/encoded samples.  I imagine this was due to a combination of time crunch and crude audio tools during the soundtrack’s original creation, so I can’t fault Alex Brandon too much.  Coincidentally, if you need to go insane, try finding the right loop points that make an audio sample not click and sound decent. 😛

Eventually, I ended up re-doing from scratch about a third of the soundtrack as I had also stupidly not saved the intermediate mod files from the original conversion. 😄  So, every one of the those bad 8-bit samples had to be cleaned up again.  To be fair, I think I did an even better job with that as audio editors have gotten a bit more advanced in the interim.  I’d like to redo the entire soundtrack, but many of the songs were pretty decent already and I’m kinda burnt out on it for now. But maybe in the future…

At this time, I’ve already uploaded the MP3 version of the new soundtrack conversion to its page.  I’m still working on getting a new FLAC version done as it has a different tagging format.  And I’m also thinking about making the intermediate mod files available for download, although obviously that would only include the tracks I redid recently.  These files would be Impulse Tracker format with all the samples cleaned up and other fixes and new outros included.  Additionally, I’m also exploring the possibility of copying the cleaned up samples back to the original UMX files to improve the game music as well.

Deus Ex Soundtrack Cover Art

Deus Ex Soundtrack Cover Art

Diablo 2 Mods

And in another kind of modding, Diablo 2 mods!  Yes, I am still modding this old ass, janky game.  However, that may be changing soon with the imminent release of the Remastered version of the game.  Blizzard said modding is still possible in the new release, but I highly doubt it’s as comprehensive.  I would be delighted to hear they switched the data format away from TSV text tables, though.  I’d think something more object-oriented where you could define a default item, inherit and change what needs to in child items, and modify some of the raw functions would be the dream.  But, I’d be pleased with at least a switch to JSON for the data definitions.

Regardless, I haven’t done too much modding this time around. I just overhauled how the respec and socketing mod works.  I realized that I could just add the Token of Absolution—an item which resets your skill and stat point allocation—right to a vendor instead of continuing to use the Horadric Cube recipe.  It’s a little janky this way as I had to change its item type to that of a potion to get the tooltip to work, but right-clicking on the ToA still gives the desired result, albeit with the drawback that the game crashes if you try to give the vendor more than one to sell, it can be put on your belt, and its cost changes based on what level the character is.

I also realized that I should include a recipe for adding sockets to items in the mod as there already is one but it’s crazy high-level and convoluted.  Tangent, but, isn’t it lame how you have to “remember” all these cube recipes to play the game.  We’re all looking them up on a wiki anyways and that’s not fun.  I’m glad Diablo 3 got rid of that aspect.  Anyways, I changed the recipe that adds sockets to something more reasonable but still balanced.  And I also discovered that there was an unused recipe function that allowed gems to be removed from sockets without destroying them, so I added a new recipe for that as well.  However, both of these recipes require gems to perform.  I’ve been thinking about adding a new rare crafting material that could be used in the socket recipes, but it seems like a lot of work plus would take valuable inventory space even if the mats stacked.

I’m also thinking about removing the Magic Find attribute from my drops mod.  It’s kind of a counter-productive stat to have on items, like it doesn’t help you survive or kill monsters but you want it maxed out so you can find the best loot.  I just feel like the loot drops should always be good—in a fun and balanced way.  So I might just remove magic find and increase the drop chances even more, but it’s a tough one because it needs lots of testing before release.

Final Thoughts

I hope you enjoyed this developer diary of a post.  My apologies for not doing more awesomeness in recent years, but… it’s something at least.  I think next I might try to give this site an overhaul; I’ve been neglecting to add proper mobile support for many years and the WordPress theme is like a decade old.  I’m still dreaming of doing an update to Cursor Lock, though; I think it’s passed about a half-million downloads across all sites now.  However, I’d really love to do a major update on File Lister as it’s the program of mine that I use the most.  It’s just so crazy useful for doing batch operations and management on files, and I’d like to extend that capability.

Take care, everyone.  Stay safe and don’t get the ‘rona!

Posted in Media, Miscellaneous, Modding, Programming | Tagged , , , , | 9 Comments

Using Cursor Lock with Steam Games in 2021

The instructions given for using Cursor Lock in games launched through Steam in a previous post were rather out of date. But I’ve become aware of a new and perhaps better method for using the two together. I say better because it doesn’t require creating shortcuts; however, there is still some command line tomfoolery to mess with.

Here’s what to do:

  1. Open the Cursor Lock Setup.
  2. Setup the options for Cursor Lock how you would normally, except put %command% in the Open Program field.  The field will turn red, but that’s okay, we’re not actually going to create a shortcut. (See the first image below.)
  3. Go to your Steam library and right-click on the game in question and select Properties.  Your should see a “Launch Options” field.
  4. Find the path to Cursor Lock.  The quickest way is probably to go to your Start Menu (or whatever Microsoft is passing off as a start menu these days) and find the Start User Mode shortcut. Right-click this shortcut and go to Properties.  You’ll find the path to Cursor Lock in the Target field under the Shortcut tab. Copy the part in quotes, including the quotes.
  5. Paste the path to Cursor Lock into the Launch Options field in Steam.  Then go back to Cursor Lock Setup and copy the command line options at the bottom.  Paste what you’ve copied at the end of that same Launch Options field.  (See the second image below.)
  6. You’re done. Just X out of the dialog and play your game.  Cursor Lock will open and close in tandem with your game. You’ll need to do this for every Steam game you wish to use with Cursor Lock, though.

As you may have guessed, the %command% pattern is replaced by Steam automatically with the path to the game. This useful feature allows us to wrap any commands we would want around our game command.  If you’re already making use of the Launch Options field for other commands, you can put those into the Open Program Args field (/P) for Cursor Lock to pass them along to your game—see the screenshots above for an example.

Posted in Gaming, Software | Tagged , | 4 Comments

Cursor Lock FAQ and Future

Q. Cursor Lock doesn’t work for X program.

I understand that the underlying concepts involved in getting Cursor Lock to function correctly in Program Mode possibly exceed the capabilities of some users, e.g. casual teenage gamer.  So, if your eyes are glazing over at the prospect of having to figure out what is meant by a “Lock Program” and an “Open Program”, just skip Program Mode altogether and bask in the simplicity of User Mode.  In User Mode, Cursor Lock runs in the background and you control it with hotkeys.  There’s even a handy shortcut to User Mode in your Start Menu. Just don’t forget your hotkeys. 😉

However, if you’re more of the advanced sort, you’ll appreciate that Program Mode only runs when you need it and thus doesn’t waste resources.  Most people get hung up on the difference between the “Open Program” and the “Lock Program”, thus it is useful (and perhaps necessary) to understand the general execution flow, which is as follows.

Cursor Lock FlowchartBy separating the program that is executed from the one that is “cursor-locked”, it allows for launcher programs to be supported. Many programs (games) use launchers, which are executables that are separate from but required to execute before the main program executable.  Steam can be considered a launcher.

Now if you’re grasping the operation of Program Mode but are still having problems, here’s what to do.

  1. You’ve got to select the appropriate executables for the Open/Lock Program fields, which can be tricky to figure out. Use Task Manager to help you see what processes go to what windows.
  2. If you’re having trouble finding the right launcher executable, you might try the forever-useful Procmon and setting it to monitor “Process and Thread Activity” before running the program in question.
  3. Next, try enabling the log file from Cursor Lock’s options.  Run a Cursor Lock shortcut or a “Test” and then read the log to help determine what happened.  You might find that Cursor Lock either closed before your desired program was locked or never locked at all, both of which suggest that the wrong executables were selected.
  4. Still not achieving a satisfactory cursor lock? Or something else weird happening?  At this point, I’d be glad to try to help you.  Leave a comment or send an email.

Q. The hotkeys won’t work.

This issue seems to be cropping up more and more, and I don’t really have a satisfactory answer as for why yet.  It also seems as though some programs will override all system hotkeys altogether, annoyingly enough.  The best advice I can give is as follows.

  1. Make sure Cursor Lock is actually running.  You should see cursorlock.exe in Task Manager.
  2. Try changing your hotkey combination to something else.  There may be conflicts with the current combination or perhaps it didn’t save correctly.
  3. If you’ve modified the hotkey combination used to toggle locking, make sure that change was saved to the configuration file, cursorlock.ini. If not, you may need to run Cursor Lock Setup with elevated permissions, i.e. Admin Mode, or try using the default hotkey combination of Ctrl-Alt-L instead.

Q. I can’t uninstall it.

That’s quite true.  There is no uninstall feature at present.  Although, there really isn’t much installed to be begin with, so I hope you’ll forgive my omission.  I do see the error in not including an uninstaller and will rectify this in future versions.  In the meantime, here’s how to uninstall Cursor Lock.

  1. Delete the directory that you installed Cursor Lock to.
  2. Delete the Start Menu folder for Cursor Lock (if enabled on installation).

Cursor Lock 3.0?

I’m frequently amazed that Cursor Lock is still relevant more than ten years after I first wrote it.  Although its focus was originally on correcting a multi-monitor support oversight, many users are now employing Cursor Lock for their windowed gaming needs instead.  This shift in audience from enthusiast gamers to gamers in general has had me thinking about how to further simplify Cursor Lock.

As mentioned in the FAQ above, Program Mode is great for efficiency but a pain for anyone but advanced users to figure out.  Personally, I loathe having yet another program running in the background on the off-chance that I might run a program that needed it.  But memory is cheap these days, so I must reluctantly deprecate Program Mode in favor of User Mode.  But, I’d like to make User Mode even better, so that all the user would need to do is select the window to lock from a list of all open windows using a systray icon, and that window will always be locked whenever you use it.  I might even add support for the often-requested but niche use case of restricting the cursor to a user-defined area.

However, I would have done this already a year ago if it weren’t for my health being in such a dubious state the last several years.  But, if good health ever returns, believe me that an update to Cursor Lock will be the first thing I do.  In the meantime, I hope the FAQ helps.  Also, I’m sorry if I don’t answer your messages and comments promptly; there are a lot of days where I can’t even put together a cogent and well-thought-out response.  So again: FAQ.  And I’ll help when I can.

Posted in Programming, Software, Troubleshooting | Tagged | 17 Comments