October 5, 2021   /   By  sass

DEVBLOG #1 – WEAPON ATTACHMENTS SYSTEM RE-WRITE

Despite the arguable lack of footage during the past month, we’re still hard at work on the project and working on different features of the game. However, some things we work on are hardly showcase-able, which is why we’re reaching out about some features via a blog post instead! You can expect more of these as time goes on, as a way to show you what’s happening behind the scenes.

On this page, we’ll talk attachments; Attachments are a given in Call of Duty games, but they’re not always as simple to implement as one could imagine, not in our case at least. During the past few months, we had to put alot of work into redoing the entire attachment system from scratch. In this post, we’ll explain how and why we had this part of the Modern Warfare 2 engine redone!

.

.

.



> TECHNICAL LIMITATIONS

One thing that is important to know is that IW4 – aka “the MW2 engine” – is a 32-bit application, which makes sense considering the release date of the game, when 32-bit Operating Systems were still at large. But there’s one catch: 32-bit apps can only allocate 4GB of memory (RAM), and with that comes its share of pros and cons.

The good side of 32-bit applications is the lower memory usage across the board, and of course the compatibility with 32-bit Operating Systems (which you shouldn’t use anymore in this day and age, but I digress). The bad side however is that you have to work with a tighter memory pool, which means you have to optimize the work load as much as possible. And believe it or not, attachments play a massive role in this, and here’s why:

.

.

.



> HOW ATTACHMENTS WORKS ON IW4

In a nutshell, the game uses a lot of different asset types, such as animations, models, script and HUD files, to name a few “simple” ones. One of these types is what we refer to as “weapons“. These “weapons” aren’t actually the visible part of them, but are rather entries with all the information about them, such a stats, names, the sounds they play, the animations and models they’re using, and a whole lot more.

In the original Modern Warfare 2 game, each and every gun + attachment combo is its own “weapon”. For example, a stock AK47, an AK47 with a silencer, and an AK47 with Extended Mags and ACOG are all considered unique, so each and every one of them have their own entry. The game then proceeds to “precache” every one of these entries, so it can then give you your actual weapon during a match.

This system worked in the original game, given the number of weapon assets is below the engine’s limit (originally 1200). But with the amount of weapons sm² has, we would go wayyyy past that limit if we were to use the same system, and simply cranking it up would result in the game running out of its 4GB of allocated memory and crash. So we had to figure out another way.

.

.

.

> DYNAT WHO?

Introducing DYNAT, our own approach of solving this problem, inspired by the system used in more recent COD games.

DYNAT (short for DYNamic ATtachments) is a new system that will dynamically create the weapon on-demand, rather than precaching every single possible weapon + attachments combo at once. That way, each gun will have a base “weapon” asset, on which DYNAT will be able to “build” the rest of the weapon over before precaching it.

Then, every attachment is now distributed via a completely separate file. These files contain properties such as models to add to the gun (e.g a red dot sight, grip, etc..), where to place said models, eventual animation changes, stats tweaks, and more. Want a FAMAS with a Red Dot Sight and a Silencer? DYNAT will take the base FAMAS weapon asset, load the related Red Dot and Silencer properties, build the complete weapon, precache it, and finally give it to you.

Such a system allows us to drastically reduce the usage of weapon assets, and ensure that the game would not suffer from the engine’s limitations. This is a mandatory piece of work, and quite a time-consuming one as it requires a heavy amount of engine patching and engineering; In fact, DYNAT has been in preparation for a few months now.

As a comparison, you can see in the picture below the difference of weapon assets usage; where the old system (left) required dozens of files for just one weapon, DYNAT (right) allows the game to only use a single file.



.

.

.

> CONCLUSION & PICTURES

This is a perfect example of all the work that’s required for the project. Engine-related work is always necessary to add features, rework some already implemented systems that don’t suit our needs anymore, and ensure the stability of the game’s client. This is not the kind of work that’s easy to show off, but it’s mandatory regardless!

And as a little treat, here’s some pictures of a few DYNAT’d weapons you’ll be able to toy with in sm²!

.

.

.

MSMC w/ ACOG Scope
Honey Badger w/ Holographic sight
Galil w/ Reflex Sight
AK74u w/ Silencer and ELO Sight

Stay up to date with sm² on Discord, Twitter, and YouTube!

RECENT POSTS


100,000 MEMBERS… 100,000
FRIENDS
DEVBLOG #1 – WEAPON
ATTACHMENTS SYSTEM RE-
WRITE
CONFIRMED WEAPONS LIST PROGRESSION AND UNLOCKS FREQUENTLY ASKED
QUESTIONS


BY MONTH


FEBRUARY 2022 OCTOBER 2021 JUNE 2021 APRIL 2021

CATEGORIES


INFO UPDATES