What weapon mods are possible with dehacked?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

What weapon mods are possible with dehacked?

Postby foul_owl » Wed Feb 17, 2021 3:38 pm

I'm curious about what sort of weapon mods are possible with dehacked.

I'm assuming that you are limited to 8 or 9 weapons, with slot 3 fixed as a dual weapon slot. I'm not sure if the chainsaw and fists can be used as weapons at the same time, since once you get the chainsaw it effectively replaces the fists and I'm not sure if this can be changed with dehacked.

I'm assuming also that you are limited to the number of existing frames of animation for that weapon's slot, but it's trivial to replace each frame of animation.

Could you, for example, replace each weapon with a different pistol, each doing different damage and having different rates of fire? Or is the damage fixed based on the projectile type, and I would only have one projectile type to work with for making various pistols?

Is a "reloading" animation possible for every weapon, something comparable to duke3d's pistol reload?

I realize that dehacked is probably pretty limited in scope, but it is quite interesting to learn about.
User avatar
foul_owl
 
Joined: 25 Jan 2012

Re: What weapon mods are possible with dehacked?

Postby Caligari87 » Wed Feb 17, 2021 4:20 pm

The short answer is "not very many."

As a high-level overview, the original Doom exe had a hardcoded state table, which was basically which frame is displayed, how long, which action to perform, and which frame to jump to next. It's very, very limited.

DEHACKED, in essence, is able to modify the sprite/frame displayed, duration, action, and jump destination of each entry. For example, you can instantly change your shotgun into your pistol by changing one of the shotgun frames to jump to one of the pistol frames.

There are only a limited number of frames in the table, so what you're effectively doing is cleverly rearranging Doom's stock weapon/monster/item frames. You could make a shotgun that has to reload after 8 shots, but you'd probably have to "steal" frames from somewhere else in order to facilitate that logic flow (making the potions only use one frame, aka no animation, would give you two extra frames to use in your shotgun, for example).

Basically it's a zero-sum game. Anything you add has to be subtracted somewhere else. At the most simplistic level, you can reskin weapons and change frame durations. At the most complex levels, you can have things like the absolutely bonkers Smooth Vanilla Weapons or Batman Doom.

Damage specifically depends on whether you use projectiles or hitscans. If you fire a projectile, the projectile defines the damage. A hitscan's damage is determined by the hitscan function you use. The types of projectile and hitscan attacks are also hardcoded.

As far as weapon slots, I'm not whether pressing a slot number jumps to a specific starting frame or if there's something more complex at work. Either way I'm pretty sure slots are mostly hardcoded and can't be manipulated by DEHACKED.

8-)
User avatar
Caligari87
I'm just here for the community
User Accounts Assistant
 
Joined: 26 Feb 2004
Location: Salt Lake City, Utah, USA
Discord: Caligari87#3089

Re: What weapon mods are possible with dehacked?

Postby foul_owl » Wed Feb 17, 2021 6:13 pm

Vanilla Smooth Doom looks absolutely insane! This in particular is amazing:

https://github.com/fragglet/deh9000/blo ... -resources

So forget any sort of "extra" frames or reloading animations, my goal for now is simply replacing the current weapons with other weapons. (Let's say 8 or 9 different pistols)

I would like to use the hitscan attack for each pistol. In order to vary the damage, I was thinking perhaps reducing the base hitscan damage, then using multiples of that low "base damage" per gun. For example, a .380 acp pistol would do 5x hitscan base, whereas a 9mm pistol would do 6x hitscan base, etc.

I'm assuming I'm limited to 4 ammo types though, is that correct?

Each pistol would fire at a different rate, and have different amounts of spread.

Is this possible with dehacked?
User avatar
foul_owl
 
Joined: 25 Jan 2012

Re: What weapon mods are possible with dehacked?

Postby wildweasel » Wed Feb 17, 2021 7:45 pm

Dehacked cannot change the damage value of bullet attacks. The best you can do is fire one of the 4 existing types of player bullet (pistol, chaingun, shotgun, super shotgun), of which the shotgun is always a horizontal spread of 7 pellets and the super shotgun is always a rectangular spread of 20.

Back in the day, DEH-based mods would tend to work around this by stacking a bunch of zero duration frames that all fire a pistol or chaingun shot, but this is fairly obvious to the player (it takes multiple units of ammo per shot), and if there isn't a Refire somewhere, the shot will always be 100 percent accurate.

You could certainly attempt to simulate bullets with projectiles, which enables you to adjust their base damage, but players only get 3 (rocket, plasma, and BFG), they cannot have spreads, and making their speed values too fast can cause physics glitches.
User avatar
wildweasel
change o' pace.
Moderator Team Lead
 
Joined: 15 Jul 2003

Re: What weapon mods are possible with dehacked?

Postby foul_owl » Wed Feb 17, 2021 10:12 pm

I think I will avoid projectiles and see what I can do with the pistol bullet attack.

Can dehacked refill ammo after shooting a weapon?

I wonder...maybe I can make each pistol shoot X number of times in a zero duration frame, and simply scale enemy health up to account for this.

The only issue of course would be making the player ammo counter look sane.

Is that possible?
User avatar
foul_owl
 
Joined: 25 Jan 2012

Re: What weapon mods are possible with dehacked?

Postby wildweasel » Wed Feb 17, 2021 10:37 pm

Many mods back in the day did increase enemy health to compensate. This didn't always work (some, like GunX Urban Nightmare, did this too much - its Chaingunners have 500 HP!).

No, there's no way to give the player ammo, short of the player walking over it. There's also no good way to make the ammo counter look correct if you're doing that.
User avatar
wildweasel
change o' pace.
Moderator Team Lead
 
Joined: 15 Jul 2003

Re: What weapon mods are possible with dehacked?

Postby Arctangent » Wed Feb 17, 2021 10:47 pm

I'd personally not bother with the idea of a DeHackEd weapon mod, because the concept only really made sense back when it was the only option. Nowadays, though, the venn diagram of people who like to play with weapon mods and the people who stick to vanilla-to-Boom-compat ports is ... not one.

I mean, sure, mess around with DeHackEd all you like, but I wouldn't commit to the idea of making a project out of it without having a stronger clarity of purpose. Even with a target port that supports MBF's extensions and DEHEXTRA, you're still gonna be ramming your head into limitations incredibly often. There's some really nifty tricks you can pull off regardless, sure - look no further than Valiant for a great modern example - but ... they're still just tricks, and often said tricks rely on making use of traits hardcoded into specific actor id. Which you don't get duplicates of, for obvious reasons. And on top of that, weapons in particular are where most of the hard limits of DeHackEd start rearing their head, even with extensions.

So, yeah, doing anything beyond fairly minor changes should wait until after you've developed a strong understanding of how vanilla Doom ticks under the hood and what puzzle pieces you get to play with, because those are the only ones you get and thus you're gonna have to design your concepts around them, rather than try to cram ideas you whipped up in a vacuum into an engine that has zero ways to make 'em happen. Plus, you might want to focus on using DeHackEd to add your own custom elements to levels that target vanilla-to-Boom ports, because again, a DeHackEd weapon mod isn't exactly something that has an audience and it sucks really hard to put your heart and soul into a project only to realize that you're the only one who cares about it.

If you wanna whip up a weapon mod for something with more of a vanilla vibe than a ZDoom port, I'd recommend giving Eternity with its EDF a shot. It's not really all that less powerful than Decorate for purposes that aren't incredibly zany, plus as a bonus the way it does things is a lot closer to vanilla Doom and thus DeHackEd than anything ZDoom does. Or just stick to ZDoom or 3DGE if that vibe isn't all that important to you. Any of the three are gonna be a far more comfortable way to get your ideas out of your brain and into the game than DeHackEd ever will.
User avatar
Arctangent
squawky
 
Joined: 06 Nov 2014
Discord: SquawkyAtan#2371


Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests