Jump to content
The Dark Mod Forums

Unifying weapons with other inventory items

Recommended Posts

I'm aware this might have been thought about before and there's probably a reason why it hasn't been improved. Since many good changes are happening including lifting of legacy limitations, I felt this is worth thinking about granted it's not too breaking. There are two technically independent yet related subjects I wanted to address here, both with the same goal of better unifying weapons with other inventory items: The internal weapon definition system, then how GUI and inventory could be improved so weapons are treated more closely to everything else.

Technical limitations: TDM still uses an old and limited method built into the engine to define weapons, something idTech has done since its early days. This comes with a few problems: You can only have up to 16 weapons registered, weapons need be listed in the global definition of the player entity, and it's simply redundant. I was wondering if as a target for 2.12 or later, it would be possible to remove the legacy weapon slots from the engine and store weapons like other items; This would allow a FM to define any number of custom arrows / guns and do so without having to override the player def, just define your arrow like you would a custom lockpick as a derivative from its base class. It doesn't feel right to for the engine to designate two types of items ("weapon" and "literally anything else") with the former going through a special hardcoded registry while inventory items already do the same thing more simply.

Only ability I know is unique to weapons is drawing the first person hands and animating them: Items would need a generic ability to define a md5mesh / md5anim set for hands when selected and operated, which would be awesome since other objects could use this as well. Everything else seems like it should fit into place: The arrows are just a projectile spawned at a given position angle and velocity, technically you could already create an inventory item that spawns a flying arrow when used (I think)... the ammo and projectile are already defined as standard items too, it's only the "shooter" that uses the legacy engine registration as an extra dependency.

Inventory wise weapons presently have a special status, in that they can be selected and operated independently from items: I'm aware changing this may disrupt what players are used to so changes are questionable. I support having a single selector for cycling weapons and items together, even merging the "use item" and "fire weapon" keys to operate whichever is selected: If we did that we could technically implement a first-person hand displaying whatever you have selected... some things like the lockpicks may need a custom animation but imagine how good that would look when picking doors, heck you could even see the bag in your hand when "loot" is focused! Only real complaint I see is some players want to keep an item handy without having to deselect it when switching to a weapon, like being able to quickly use a health potion while drawing the sword to attack: We can solve this by having hotkeys for more essential items similar to the lantern and spyglass, like a "use health potion" button so if you have a potion you may instantly heal... we'd be freeing up three key-binds with an unified inventory anyway (prev item, next item, use item) which is also an advantage. Do share your thoughts and if you can think of a better way.

Link to comment
Share on other sites

There's another ability this would make possible which is another reason I wanted the suggestion up, always felt this would be amazing in terms of immersion and interacting with the world: If you look at Moveables/Weapons/atdm:moveable_* you'll see a lot of weapons the AI can wield. Wouldn't it be great if instead of just the longsword the player could use any of them and benefit from their different stats? Imagine picking up the hammer of a builder and using that to whack enemies, or the bent sword used by moors, not to mention the dagger I mean come on you're a thief you should be able to use a knife!

We can in fact achieve this without needing a custom set of hands per weapon: We only need the existing hands and animations, the weapon just needs to be attached to the hand bone as a separate entity. Any sword you pick up would use the same hand mesh and animations, all that differs is its weapon model the sounds and functionally stats. For example the dagger would work just like the sword except you shouldn't be able to parry with it, stat wise it would have a faster attack rate for slightly less damage. Only issue I see is long and heavy weapons like the lance would require both hands and different animations; Unless someone feels like animating them those can remain off-limits to the player, we have a convenient excuse in that the player is a thief who isn't trained in using heavy cavalry stuff.

For items a similar trick can be used to make them visual: Have a first person hand as its own md5mesh / md5anim and give it a few holding animations for different grips. Items would be attached to the hand bone with an offset: Potions, readable books, keys... all can be rendered in the hand by simply changing the model of the attached entity, if needed just using a different finger animation that matches the size of the object being gripped.

Link to comment
Share on other sites

  • 2 weeks later...

Every weapon needs vast support both in core scripts and C++ engine, so I'm not sure it is possible to create fully custom weapons.

On the other hand, you can take a sword and reskin it to hammer, maybe changing some parameters.
Or you can take a bow + arrow, and create a custom type of arrows.

The problem is that now the weapons are defined in player entityDef (atdm:player_base), so the only way to change it is to override the whole decl, which can be dangerous, because it is quite likely that the core def is updated.

And I think we already discussed this problem once.
One generic approach was to allow writing patches to entityDefs without overriding them completely.
The other one is of course to just add a second place for setting def_weaponN and checking both of them in future.
Somehow, we did not get to implementation.

As for turning ordinary items into weapons, that would most likely be harder.
For instance, you get the typical inheritance problem: such a weapon must inherit both from atdm:moveable_weapon_base and from atdm:weapon_base, which have a lot of different properties.

Link to comment
Share on other sites

Thanks for clarifying! Oh I forgot I spoke about this once, I do remember I thought about it before but forgot bringing it up.

Indeed the base declarations would need to be redone... I presumed this would only be the internal ones thus everything would be backwards compatible. Getting them out of the player's entityDef was my main concern: That feels like a legacy limitation similar to the 60 FPS cap, a case of the way things were done back in the day but no longer need to be done now. The question in my mind is what do weapons do differently from other items that requires them to be declared so differently.

On my idea to allow multiple sword types, your comment helped me realize this would already be possible in an easier way: Granted we only want the player to carry one weapon of a given type at a time, this can be done by changing the model / skin / stats of the same sword weapon and blackjack. So if you're holding the sword then frob a builder's hammer, the hand with the sword lowers itself out of view then the sword turns into a hammer then the hand goes back up without the camera noticing a change. There isn't any limitation in the engine to reskinning a weapon in realtime correct?

There's only one problem here as far as I'm aware: The md5mesh for the first person view hands also contain the sword as part of the model. The sword part of the mesh would need to be deleted and only the hands kept, then the sword attached as a separate entity using the same lwo model as the longsword you see guards holding or on maps as a decoration.

Link to comment
Share on other sites

We actually only needed three weapon slots: Blackjack, Shortsword and Bow. We would have had seven free keys for other stuff. Selecting ammo for a weapon could have been done in different ways. In example players could have cycled through available arrow types by repeatedly pressing the bow key. There's a proof of concept in the TDM Modpack.

Back on topic, I would suggest replacing the shortsword with a dagger (throat cutter), an axe (wood breaker) or a hammer (skull crasher) as a start, see how far we get. If we cannot prove there's a need for a change or improvement I am not sure anything ever will change.



TDM Modpack

Link to comment
Share on other sites

Posted (edited)
1 hour ago, snatcher said:

We actually only needed three weapon slots: Blackjack, Shortsword and Bow. We would have had seven free keys for other stuff. Selecting ammo for a weapon could have been done in different ways. In example players could have cycled through available arrow types by repeatedly pressing the bow key. There's a proof of concept in the TDM Modpack.

Back on topic, I would suggest replacing the shortsword with a dagger (throat cutter), an axe (wood breaker) or a hammer (skull crasher) as a start, see how far we get. If we cannot prove there's a need for a change or improvement I am not sure anything ever will change.

That's also a great idea to simplify the system: Technically we can just use one bow and re-texture its arrow to represent the projectile currently selected, and of course affect what actually gets fired with that. Technically we can even make the flashmine / flashbomb its own weapon on the 4th slot, finally we'd have a first person view of throwing / placing it.

The ideal solution seems like giving inventory items and frobable in-world entities the ability to change the properties of a weapon, both visually and its stats or what it fires. This would also facilitate mods like upgrades that make your arrows go further or have more damage, would go well with the skill system I wanted to create anyway.

Personally I wouldn't suggest any functionality changes to the default sword: It's still what you should start with unless the FM specifies otherwise. With the idea I have in mind, if you say defeat a thug by either killing him or knocking him out, he drops the movable knife to the ground as is already the case... but now when frobbing it, your sword would be set to take on the properties of a dagger, while the dagger on the ground gets replaced by the shortsword you were holding.

In terms of usefulness this is mainly a detail for immersion but not only; It would have practical uses if you go for combat over stealth, given each weapon version would have slightly different stats and speeds, different players would find it better to switch to different weapons in different areas and for different enemies. Those who are in the boat that combat doesn't matter because stealth is the primary component of TDM likely won't care... for those of us who prefer a "use your own approach and whatever the world gives you" technique, this would open up new possibilities and add in a whole new fun factor.

Edited by MirceaKitsune
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • MayheM

      Hello, Since this track is originally from TDM,i think it's better to ask here than TTLG. Do you guys have the full version of this ambient track?
      · 2 replies
    • DeTeEff

      Bachelor Mapping Challenge!
      The girlfriend will be away to her mum's place for almost a week, which means more mapping time for me! I'm planning a speed build. Hope it will go my way
      I'm starting by downloading 2.11. Don't know if I'm going to use any fancy new stuff. Just want to crack those itching map muscles that has gone dry and dead since almost a year's worth of no-mapping
      · 4 replies
    • kano

      The cool part of Canonical's Snap, is that my machine can now ray-trace an entire (simple) scene faster than it takes the web browser to start!
      · 5 replies
    • datiswous

      Fm idea (braindump)
      "Experience the life of a mission builder"
      Esentially there are finnished elements placed somewhere in storage in the game and you have to place them in the correct places, build some walls here and there, add guard routes, give them their correct speech lines, etc. Decorate the places.. all in-game. lots of fun.. 😉
      If you do it right in the end you can play the mission.
      (would be even cooler if a thief-ai could play the mission, making it some kind of tower-defence game)
      This first started as an idea for an aquarium builder mission where-in you have to fill an empty aquarium with sand, waterplants, castles water and swimming fish. But above idea is more fun.
      · 4 replies
    • JackFarmer

      Dear ChatGPT, What are The Builders in the Dark Mod?
      The Builders is a popular game mode in the video game community called "Dark Mod," which is a fan-made tribute to the classic "Thief" series of stealth games. In this game mode, players assume the role of builders who construct structures in a dark and ominous environment while trying to avoid detection by patrolling guards.
      The Builders game mode is unique in that it offers players the opportunity to create and design their own levels using the in-game tools and resources provided. Players can experiment with different building materials, construct intricate traps and puzzles, and create their own unique gameplay experiences.
      While The Builders game mode is not an official part of the Dark Mod, it has become one of the most popular and well-loved aspects of the game, thanks to its emphasis on creativity, strategy, and stealth.
      You guys did not know that, did you?
      · 2 replies
  • Create New...