Jump to content
The Dark Mod Forums

Player Lamp (beta)


snatcher

Recommended Posts

@snatcher I hope you don't mind, I've added this here: https://github.com/thedarkmodcommunity/mod-handheld-lamp

I was thinking I'd like to use some of this neat stuff you're doing at some point (hopefully soon 😉), and I would just end up putting it in Git like I do all my stuff as I tinkered with it.  I figured it might as well go into a public repository instead.

If you would like to keep it up to date in this location, I'm more than happy to do that (or show you how to do it).  If not, people can always come to this forum thread and retrieve versions that are posted here 🙂

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Quote

The lamp clips through walls when up close (no idea how to fix this)

Is the lamp a weapon? Unless TDM weapon system is different from Doom 3, weapon models should have the "depth hack" thing enabled, that "hack" (that is how idSoftware calls it :D ) makes sure the weapon never intersects with geometry. 

in the code:

bool weaponDepthHack;	// squash depth range so view weapons don't poke into walls

Don't know if there's a way to enable that without messing with c++, stgatilov or others may know. 

  • Like 2
Link to comment
Share on other sites

Hey, thanks for looking into this! Excited to see what you've done with it! 

10 minutes ago, HMart said:

Is the lamp a weapon? Unless TDM weapon system is different from Doom 3, weapon models should have the "depth hack" thing enabled, that "hack" (that is how idSoftware calls it :D ) makes sure the weapon never intersects with geometry. 

No way! This is precisely the thing I was looking for when I was messing around with it way back when. This is great info, thanks

  • Like 1
Link to comment
Share on other sites

1 hour ago, Frost_Salamander said:

@snatcher I hope you don't mind, I've added this here: https://github.com/thedarkmodcommunity/mod-handheld-lamp

Great initiative! Thanks for that.

1 hour ago, Frost_Salamander said:

I was thinking I'd like to use some of this neat stuff you're doing at some point (hopefully soon 😉), and I would just end up putting it in Git like I do all my stuff as I tinkered with it.  I figured it might as well go into a public repository instead.

Anything you want. The more stuff going on, the merrier. Looking forward to the results!

1 hour ago, Frost_Salamander said:

If you would like to keep it up to date in this location, I'm more than happy to do that (or show you how to do it).  If not, people can always come to this forum thread and retrieve versions that are posted here 🙂

You are the keeper. I don't think I will be toying with the lamp again any time soon because I met a dead end and I don't know how to bring it to the game without touching core files. I tried - just to see if I could - replacing the lantern with the lamp but both items exist in different worlds (tool vs weapon) and it required more tricks than I am willing to do (keep it simple).

TDM Modpack 4.0

Link to comment
Share on other sites

1 hour ago, Frost_Salamander said:

I hope you don't mind, I've added this here: https://github.com/thedarkmodcommunity/mod-handheld-lamp

This is very cool, didn't know you had this! Is this for the community to use/contribute to?

Link to comment
Share on other sites

10 hours ago, snatcher said:

I don't know who created the lantern in the first place but as per the below post @Dragofer, @Amadeus and @Goldwell were involved.

On 3/25/2023 at 5:19 AM, Dragofer said:

Obstortte was also involved and did the lion's share of the work. It all began with him and his work

Link to comment
Share on other sites

3 minutes ago, Amadeus said:

This is very cool, didn't know you had this! Is this for the community to use/contribute to?

I set it up ages ago, and yeah it was intended for the community. It was never my intention to own or gatekeep it (but it does need some administration). I was trying to come up with a central place where we could store/share assets instead of trying to hunt down .pk4 files and dealing with broken links, etc.

There didn't seem to be much interest in it though (for various reasons, there's a forum thread about it somewhere).  But it's there and I can help anyone get started with it.  The main limitation is individual files can't exceed 100 MB.  I would agree it's not the perfect solution for an asset repository, but practically speaking you can get quite far with it.

 

Link to comment
Share on other sites

31 minutes ago, Frost_Salamander said:

There didn't seem to be much interest in it though (for various reasons, there's a forum thread about it somewhere).  But it's there and I can help anyone get started with it.  The main limitation is individual files can't exceed 100 MB.  I would agree it's not the perfect solution for an asset repository, but practically speaking you can get quite far with it.

 

I'm not all too familiar with how github works, but I have some textures and such I wouldn't mind uploading. Either way, thanks for setting this up and maintaining it. There is some cool stuff in here

Link to comment
Share on other sites

10 minutes ago, Amadeus said:

I'm not all too familiar with how github works, but I have some textures and such I wouldn't mind uploading. Either way, thanks for setting this up and maintaining it. There is some cool stuff in here

If you want to get started, I wrote a tutorial here: https://wiki.thedarkmod.com/index.php?title=Git_and_Github_for_Mappers

That tutorial is geared towards working with a fan mission in Git/Github, but if you do the 'Tool Setup' section, you will be all set to contribute.  Then you can just DM me or ping me on Discord and I can help with the rest of it. Don't be intimidated by it - it's really very straightforward once you get the hang of it.

I can add a section on how to contribute to the community org as well (not sure why I didn't do that actually)...

Edited by Frost_Salamander
  • Thanks 1
Link to comment
Share on other sites

23 hours ago, snatcher said:

The lamp still makes use of def/tdm_player_thief.def and script/tdm_user_addons.script and therefore it isn't compatible with all mission or other mods.

It looks like script/tdm_user_addons.script just adds the lamp to the player inventory, so that can be removed and a mapper could just spawn the lamp in a map somewhere and the player could pick it up.

And in def/tdm_player_thief.def an extra weapon attachment is created for the lamp If this could be done dynamically in a script we could remove that file as well. Has anything else in this file been changed (or do we need to get the diff viewer out...)?

Edited by Frost_Salamander
Link to comment
Share on other sites

15 hours ago, HMart said:

Is the lamp a weapon? Unless TDM weapon system is different from Doom 3, weapon models should have the "depth hack" thing enabled, that "hack" (that is how idSoftware calls it :D ) makes sure the weapon never intersects with geometry. 

in the code:

bool weaponDepthHack;	// squash depth range so view weapons don't poke into walls

Don't know if there's a way to enable that without messing with c++, stgatilov or others may know. 

This is true, but the fact is that the viewmodel only consists of a bare arm (animated model), with something bound to it (static model). The depth hack only applies to the arm model itself.

If you want to stop the lantern clipping through walls you have to make a new version of the animated arm model that has the lantern integrated into it.

Link to comment
Share on other sites

3 hours ago, Frost_Salamander said:

And in def/tdm_player_thief.def an extra weapon attachment is created for the lamp If this could be done dynamically in a script we could remove that file as well. Has anything else in this file been changed (or do we need to get the diff viewer out...)?

Adding that def_weapon spawnarg is indeed the only change made for this lantern. In fact the file is outdated because it doesnt have the bobbing spawnargs that were added in a recent TDM version.

It doesnt look like there's a way to replace this via script, currently. Player.cpp does various stuff with the def_weapon spawnargs in the spawn frame, including setting up a weapon index. There's also stuff that seems to be called after map start like idPlayer::UpdateWeapon which reads out def_weapon spawnargs, so any dynamic approach should include appending a def_weapon spawnarg for the lantern to the player entity.

All in all, adding custom weapons is quite limited. Besides the requirement of the above core file overwrite, we only have 2 extra hotkey slots for custom weapons with no way to set them via the menu. In a previous dev discussion it was decided that we already have too many hotkeys so some alternative approach should be tried i.e. a weapon wheel like in Dishonored.

Link to comment
Share on other sites

4 minutes ago, Dragofer said:

Adding that def_weapon spawnarg is indeed the only change made for this lantern. In fact the file is outdated because it doesnt have the bobbing spawnargs that were added in a recent TDM version.

It doesnt look like there's a way to replace this via script, currently. Player.cpp does various stuff with the def_weapon spawnargs in the spawn frame, including setting up a weapon index. There's also stuff that seems to be called after map start like idPlayer::UpdateWeapon which reads out def_weapon spawnargs, so any dynamic approach should include appending a def_weapon spawnarg for the lantern to the player entity.

All in all, adding custom weapons is quite limited. Besides the requirement of the above core file overwrite, we only have 2 extra hotkey slots for custom weapons with no way to set them via the menu. In a previous dev discussion it was decided that we already have too many hotkeys so some alternative approach should be tried i.e. a weapon wheel like in Dishonored.

ok thanks - so are you saying that def_weapon spawnarg could be added via a script, or not?  I was going to try that anyways and see.

Also anyone have any idea why there are other entities present in that file?  like this and this...

Link to comment
Share on other sites

1 hour ago, Frost_Salamander said:

ok thanks - so are you saying that def_weapon spawnarg could be added via a script, or not?  I was going to try that anyways and see.

You can always add it via script, but itll be too late because the spawn frame code events have already happened. i.e. the lantern won't be part of the weapon index.

1 hour ago, Frost_Salamander said:

Also anyone have any idea why there are other entities present in that file?  like this and this...

This is a generic def file for player-related entities. If you overwrite a core def file you have to include everything, otherwise those entities will be missing from the game.

Link to comment
Share on other sites

4 minutes ago, Dragofer said:

This is a generic def file for player-related entities. If you overwrite a core def file you have to include everything, otherwise those entities will be missing from the game.

Sorry I wasn't being clear.  I'm looking at having a version of this that could be packaged with a fan mission.  So the .pk4 would be placed in the FM folder, not TDM root.  In that case would the game pick up those other entities from the core TDM files?

Edited by Frost_Salamander
Link to comment
Share on other sites

1 hour ago, Frost_Salamander said:

Sorry I wasn't being clear.  I'm looking at having a version of this that could be packaged with a fan mission.  So the .pk4 would be placed in the FM folder, not TDM root.  In that case would the game pick up those other entities from the core TDM files?

Yes, overwriting individual core entities with custom .def files in an FM archive is now uncomplicated after the overwrite rules were changed in a recent TDM version. The FM will be isolated from any future changes to the player entity, however - even if they may be rare.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Dragofer said:

This is true, but the fact is that the viewmodel only consists of a bare arm (animated model), with something bound to it (static model). The depth hack only applies to the arm model itself.

If you want to stop the lantern clipping through walls you have to make a new version of the animated arm model that has the lantern integrated into it.

Yeh that is also how Doom 3 weapons were done, but perhaps this can be worked around? Next to weaponDepthHack there's also a modelDepthhack bool I assume for every other model, perhaps that just needs to be put in the model def file or enabled by a spawn argument? I really don't know, or if that spawnarg even exists, if not then is something to put in the roadmap.   

Link to comment
Share on other sites

7 hours ago, Frost_Salamander said:

It looks like script/tdm_user_addons.script just adds the lamp to the player inventory, so that can be removed and a mapper could just spawn the lamp in a map somewhere and the player could pick it up.

That's right.

If a mapper decides to adopt tdm_player_thief.def then the next question is: how do you let players know where the lamp is / how to use it?

  • The lamp can replace the blackjack, sword or any arrow type. Just let the player know which slot it is replacing.
  • The lamp can remain in one of the unused slots but then players must know how to cycle through weapons or you must invite them to check the in-game inventory screen.
  • The lamp can remain hidden in one of the unused slots and players could have an item (inventory tool) that operates the lamp.
  • The lamp can remain in one of the unused slots and you can force-bind a dedicated key for players and ask them to use that key. This method is a little intrusive - use at your own risk.

Now, if you want players to pick up the lamp then there's more work ahead. When I tested this feature with the lamp model another lamp was attached to my lamp (two models). Furthermore, the lamp was on by default. Perhaps we want to start there.

And thinking of improvements, since the lamp is a weapon, it could be operated with the attack button:

  • Click: open aperture (low intensity)
  • Click: medium intensity
  • Click: high intensity
  • Click: close aperture

TDM Modpack 4.0

Link to comment
Share on other sites

6 hours ago, Dragofer said:

All in all, adding custom weapons is quite limited. Besides the requirement of the above core file overwrite, we only have 2 extra hotkey slots for custom weapons with no way to set them via the menu. In a previous dev discussion it was decided that we already have too many hotkeys so some alternative approach should be tried i.e. a weapon wheel like in Dishonored.

My proposal is to build a layer on top of the "broadhead" arrow key that allows players to cycle through all available arrows, that way we free 7 slots in one go. Players can have up to 8 arrow types but we hardly ever end up with all arrow types. Let's stick to an average of 5 arrow types (broadhead, water, rope, noise and gas or fire). Pressing 5 times a key to cycle through all available arrows isn't too much asking, imho.

Edited by snatcher

TDM Modpack 4.0

Link to comment
Share on other sites

2 hours ago, snatcher said:

When I tested this feature with the lamp model another lamp was attached to my lamp (two models).

Can confirm. Any idea why this is? Is it because of this line? https://github.com/thedarkmodcommunity/mod-handheld-lamp/blob/f871527938df96a7efc308fc3ee85c70d8271544/def/mod_weapon_playelamp.def#L38

Other weapons (like the shortsword) have this attachment as well, but they don't show up attached to each other like that.

We could just have a separate entity of that model to just for the plater to frob and kick off a frob_action_script to set everything up instead I guess?

Link to comment
Share on other sites

It seems we killed two birds with one stone (double model / lights on) by moving the attachment from the entity to the animation:

	anim idle	models/md5/weapons/mod_playerlamp/idle.md5anim
	{
		frame 1 	attach mod:attachment_playerlamp hand_r
		frame 1		sound_weapon blackjack_sheath
		frame 12	melee_hold
	}

The lamp no longer auto-spawns but script/tdm_user_addons.script is still required to load script/mod_weapon_playerlamp.script.

Console command to spawn the lantern:

spawn mod:weapon_playerlamp

In v0.2 I also updated def/tdm_player_thief.def to version 2.11 (thanks to @Dragofer).

z_handheld_lamp_v0.2.pk4

  • Like 1

TDM Modpack 4.0

Link to comment
Share on other sites

Nice! 

I've got a branch where I'm converting it to a version that can be added to an FM.  The scripts can be loaded via tdm_custom_scripts.script instead of tdm_user_addons.script.  I got all that working, but then ran into the double lamp thing.

I might separate these into different repositories - but then do we think we need both versions?  What are the chances of anyone using this as a mod?

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

    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
    • The Black Arrow

      Hope everyone has the blessing of undying motivation for "The Dark Mod 15th Anniversary Contest". Can't wait to see the many magnificent missions you all may have planned. Good luck, with an Ace!
      · 0 replies
×
×
  • Create New...