Jump to content
The Dark Mod Forums

Unifying weapons with other inventory items


MirceaKitsune

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 4.0

Link to comment
Share on other sites

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.

Guest
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

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...