[discontinued] Weapon sway

Projects that have specifically been abandoned or considered "dead" get moved here, so people will quit bumping them. If your project has wound up here and it should not be, contact a moderator to have it moved back to the land of the living.

[discontinued] Weapon sway

Postby Nash » Fri May 20, 2016 10:32 am



Requires ZDoom devbuild 115dbd0 or higher because of A_WeaponOffset

Weapon Sway and Weapon Pitch Shifting
by Nash Muhandes

Requires ZDoom/GZDoom dev build 115dbd0 or later

This code example shifts the weapon sprite as you move the view around. Since the original Doom sprites were not made with this effect in mind, most of the graphics will be cut off if you look down too much. You have to provide custom artwork to make the most out of this. For perfect examples of how "tall" a sprite should be, consult the sprites for the Rocket Launcher or the BFG.

Feel free to take this apart and adapt this code for your mods. No permission needed, credits and a link to your mod would be nice. Have fun!


26 August 2017: I am no longer using ACS and am going to retire this. Despite stating clearly in my original post that this was a proof of concept and code resource, I am still getting PMs from people asking me how to "fix" this "mod" because "it's not working" with their load order. I never offered to support this "mod" because well it wasn't a mod.

Also, I don't use ACS anymore and even if I plan to return to this project, it will be rewritten from scratch and all the old code will be thrown away so this is as good as dead.

Requesting graveyard.
Last edited by Nash on Sat Aug 26, 2017 2:57 am, edited 5 times in total.
User avatar
Nash
Nash Muhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Re: [code] Weapon sway

Postby Gifty » Fri May 20, 2016 10:37 am

My god... it's full of stars.
User avatar
Gifty
Recon'ize that smell?
 
Joined: 15 Jun 2013

Re: [code] Weapon sway

Postby kodi » Fri May 20, 2016 11:20 am

A_WeaponOffset

wait
what

:shock:
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: [code] Weapon sway

Postby Nash » Fri May 20, 2016 11:36 am

kodi: perfect for your System Shock clone. :mrgreen:
User avatar
Nash
Nash Muhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Re: [code] Weapon sway

Postby kodi » Fri May 20, 2016 12:47 pm

Dunno when the feature was introduced, but I'm gonna feel pretty stupid if I made the whole hudmessage weapon drawing entirely in vain :x

This release of yours will mesh very well with DS cursor code if I decide to pursue it (or a Terra Nova: SFC thing I'm being extremely tempted to do) further.

i wonder if A_WeaponOffset will one day support Z, Pitch and Angle arguments for 3d model weapons? A nerd can dream..
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: [code] Weapon sway

Postby Jaxxoon R » Fri May 20, 2016 2:57 pm

Wouldn't it look more natural if the weapon moved slightly ahead of the viewpoint instead of lagging behind it? In my experience, It seems humans having an intent to point something whilst looking where its pointing would move the smaller, faster hand before the entire body.
User avatar
Jaxxoon R
 
Joined: 04 May 2014

Re: [code] Weapon sway

Postby HorrorMovieGuy » Fri May 20, 2016 3:15 pm

I can see this being used to emulate Build Engine's weapon bob when the player jumps and/or lands from a great fall.
User avatar
HorrorMovieGuy
world is a fuck
 
Joined: 24 May 2013
Location: Somewhere in the Brazilian Jungle

Re: [code] Weapon sway

Postby tsukiyomaru0 » Fri May 20, 2016 3:15 pm

I wish something like this was implemented as a feature for ZDoom and similar, but default off to prevent issues with certain PWADs. I like this kind of sway over the traditional one.
User avatar
tsukiyomaru0
 
Joined: 29 May 2010

Re: [code] Weapon sway

Postby TheDoomctator » Fri May 20, 2016 7:53 pm

This is quite the nice idea...good work there mate
you made me want to make a doom mod just to use this...to bad i suck at coding XD
User avatar
TheDoomctator
Still waiting for some TNO guns in doom...
 
Joined: 13 May 2016
Location: Stereotype Land,Well that's Brazil of Course

Re: [code] Weapon sway

Postby chronoteeth » Sat May 21, 2016 12:29 am

can this be combined with other weapon sway animations? Or even stuff like, lets say i want the gun to tilt to the right when moving right, a lil more to the left, but through sprite animations combined with the code?
User avatar
chronoteeth
abubub
 
Joined: 08 Sep 2004

Re: [code] Weapon sway

Postby loismustdie555 » Sat May 21, 2016 12:45 am

Ayyyy you ported it! Good job! Was wondering when you'd get around to it mang!
Great work man!
loismustdie555
Pro at getting ahead of myself
Banned User
 
Joined: 25 Sep 2014
Location: Renton, Washington, USA

Re: [code] Weapon sway

Postby Nash » Sat May 21, 2016 10:30 am

Jaxxon: when I initially implemented this feature years ago via a source modification (custom ACS command), I was trying to emulate Skyrim's sway, that is, the weapon lags behind instead of moving forward. This is easy to customize, but currently requires editing the ACS and recompiling.

chronoteeth: A_WeaponOffset does not interfere with other offsets, if that's what you're asking. It's stacked.

___________________

I'm trying to see if I can make this more user friendly and easier to customize without ACS source mucking. I have several questions

1) When I was putting this together, the new weapons wouldn't be given to the player via IDFA. I had no idea what I was doing, eventually it forced me to add a custom player class with a custom weapon slot list. So much baggage for just a simple weapon demonstration. I'd really like to put this file out without all that MAPINFO and custom player classes. :/ Any help on this area would be much appreciated

2) When inheriting from the stock weapons, I have to copy and paste the Fire state too, otherwise the offset sways would stop working when firing a weapon. WHY?!
User avatar
Nash
Nash Muhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Re: [code] Weapon sway

Postby kodi » Sat May 21, 2016 11:47 am

If you don't want to edit the player class you could have the weapon replace the shotgun for example, and spawn it on top of the player with acs on startup then nudge him a miniscule amount like in ijons telekinesis script
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: [code] Weapon sway

Postby Nash » Sat May 21, 2016 12:17 pm

Ugh, that hacky? I didn't realize making weapon replacements for ZDoom had to be so needlessly complicated...
User avatar
Nash
Nash Muhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Re: [code] Weapon sway

Postby kodi » Sat May 21, 2016 1:12 pm

or simply spawn it in front of the player. Or tell people to just type summon shotgun in the console.
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Next

Return to Abandoned/Dead Projects

Who is online

Users browsing this forum: No registered users and 1 guest