Multiple actors as weapon parts?

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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
vAethor
Posts: 93
Joined: Wed May 10, 2017 4:10 pm

Multiple actors as weapon parts?

Post by vAethor »

I'm building a REAL big gun with a variety of moving parts and fire modes, and rendering frame-by-frame all in one from my spriting program would be ridiculous, tedious and make the filesize giant.

So I had a more elegant and convenient idea, not sure if it's possible though since I haven't really seen anything like it in the code and assets of other WADs. I am thinking, create my big gun with separate moving part actors to represent stuff like muzzle flash, ejection port opening/closing, bolt sliding, etc. One big idea of mine is to use this method to create a Halo-style ammo counter actor which spawns as part of the weapon as it appears on your HUD. This actor would just have a frame for each number counting down to zero, rather than doing all those frames for every single animation. Another thought is to spawn a muzzle flash actor with its sprites set to additive blending to make it look better.

Now again, totally not sure if this is even possible or not, though I have seen a couple similar stuff in other WADs. Looking at Brutal Doom for instance, it seems they use two separate left and right reloads when dual wielding assault rifles or SMGs (even though firing them both seems to be all one big sprite.) Russian Overkill seems to have a couple weapons with animated sprite patches that are put together in code.

I'm guessing, if this is possible, you use some kind of jump function to make it work. Am I right?
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Multiple actors as weapon parts?

Post by ramon.dexter »

Well, your idea has a base right, but the rest will not work with doom.
You have to understand, that the gun drawn to the HUD is one actor. It cannot be multiple actors, it is simply not possible. All, you can do to optimize it, is to useTEXTURES tomake the graphics. But the graphics have to be made. The HUD graphics simply cannot be build up of separate parts.
User avatar
insightguy
Posts: 1730
Joined: Tue Mar 22, 2011 11:54 pm

Re: Multiple actors as weapon parts?

Post by insightguy »

Instead of multiple actors, just use multiple overlays!

You can run multiple things at the same time with ease!

If you need reference, take a look at eriguns by xaser, his machinegun is basicaly a gun with an ammo counter that can be the basis for your "gun".
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Multiple actors as weapon parts?

Post by Nash »

You can either use overlays on the weapon actor itself, or CustomInventory overlays. With CustomIventory, you can give yourself several different versions of that CustomInventory that all stack on top of each other.

(ZScript highly recommended to make this less annoying to program)

(I've toyed before with using CustomInventory's to composite several 3D weapon models at the same time, kinda like the Elder Scrolls/Fallout games where the hand model, gun model, glove model etc are all independent of each other and can be swapped out in real-time)
vAethor
Posts: 93
Joined: Wed May 10, 2017 4:10 pm

Re: Multiple actors as weapon parts?

Post by vAethor »

insightguy wrote:Instead of multiple actors, just use multiple overlays!

You can run multiple things at the same time with ease!
Oh yeah, overlays! That's an even better idea. I kinda figured what Ramon said was right, but I do know overlays are a thing. One question though: does each overlay have to match up to every frame, and have the same number of frames, as the main gun I'm patching them onto?

Again I noticed Russian Overkill does something like this on their "Instafun" weapon. It appears to be an electric tube of lightning that zaps forward in a loop according to its game assets in Slade. I looked a bit at the DECORATE code for it too but haven't really studied it extensively.
If you need reference, take a look at eriguns by xaser, his machinegun is basicaly a gun with an ammo counter that can be the basis for your "gun".
Hmm, I just downloaded this WAD and I like it, though I don't really see the ammo counter weapon you speak of. I looked at the assets in Slade and one gun (I think it's called the Mauler) seems to have separate assets for what look like flashing lights on the gun. But I couldn't see them when I pulled it out and fired it in-game.

Nash wrote:You can either use overlays on the weapon actor itself, or CustomInventory overlays. With CustomIventory, you can give yourself several different versions of that CustomInventory that all stack on top of each other.

(ZScript highly recommended to make this less annoying to program)

(I've toyed before with using CustomInventory's to composite several 3D weapon models at the same time, kinda like the Elder Scrolls/Fallout games where the hand model, gun model, glove model etc are all independent of each other and can be swapped out in real-time)
Hmm, but isn't this just what Ramon said wasn't possible? I'm confused..

Zscript sounds like a good idea. I haven't really done much with it outside of play around with the code parameters in a 2.5D platformer example to add my own sprites, but I bet I could easily learn through research, looking at tutorials. and examining how other people do stuff.
User avatar
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: Multiple actors as weapon parts?

Post by Caligari87 »

Just as another example, check out Tranquility. I used ZScript to make a weapon out of overlays for each separate part (magazine, slide, ammo, trigger, etc). ZScript is pretty much the best / only way to do this effectively without massive hacks.

8-)
vAethor
Posts: 93
Joined: Wed May 10, 2017 4:10 pm

Re: Multiple actors as weapon parts?

Post by vAethor »

Caligari87 wrote:Just as another example, check out Tranquility. I used ZScript to make a weapon out of overlays for each separate part (magazine, slide, ammo, trigger, etc). ZScript is pretty much the best / only way to do this effectively without massive hacks.

8-)
Oooh, tactical realism mod! This looks really promising. It looks like all the assets are out in a ZIP though,so I'll make a new PK3 for them and try it out after I get home from work.

Really eager to check out what the modder's done with multiple overlays.
User avatar
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: Multiple actors as weapon parts?

Post by Caligari87 »

PK3s are just ZIPs. You can run it directly.

8-)
vAethor
Posts: 93
Joined: Wed May 10, 2017 4:10 pm

Re: Multiple actors as weapon parts?

Post by vAethor »

Hmm, I'm really just getting started with Zscript and I feel I have a lot to learn, but I did look at Tranquility and another PK3 I have that uses Zscript, and I may be off to a good start.

Here's what I got so far:
https://drive.google.com/open?id=1tW2GY ... p62A5PkuHq

It includes crappy placeholder sprites for an assault rifle that can hold 35 rounds, a (painstakingly animated, lol) counter with numbers that count down to zero from thirty-five, and a horribly animated spent casing.

Forgive me for seeming like a noob here, but as you can see I am only getting started with my custom gun script here. Any input would be greatly appreciated. At this point I am just trying to get the gun to appear and be able to be used, before I even get into overlaying the counter onto there.

I think I did something already, but totally not there yet. The counter-gun class uses the pistol slot and inherits from the pistol, so even though it is not showing up yet, I do notice when I press the slot key for the pistol the player puts it away and pulls out another instance of the pistol. So all I have to do now is start by getting a usable version of my silly assault rifle for starters.
Post Reply

Return to “Scripting”