Bobbing functionality in ZScript?

Moderator: GZDoom Developers

Post Reply
User avatar
nazakomu
Posts: 131
Joined: Wed Nov 30, 2016 12:51 am
Graphics Processor: nVidia with Vulkan support

Bobbing functionality in ZScript?

Post by nazakomu »

This may sound completely redundant but I'd be thankful if someone wanted to implement it.

Basically, if anyone has ever paid close attention to the way bobbing works in a Build game (in this instance, Duke Nukem 3D was my reference), there are two things to notice. When the player begins to move - the bobbing starts slow but then speeds up and the X/Y movement intensify until the player has reached the maximum speed.

This gave me an idea for a property (Or a function? Considering there isn't anything but custom properties as of right now) to be implemented into ZScript where the bob speed is adaptive to the speed that the player is moving at. Or make it completely adjustable (intensity, adaptive). The "adaptive" could be a 'true' or 'false' and if it is desired to be true, then it will disregard the intensity parameter and instead use an "adaptive-to-player's-speed" bobbing speed.

Considering that the bobbing speed property is static, this is the only reason that I am requesting this otherwise I wouldn't be. There is probably an entirely different way of implementing something like this, but tl;dr: implement a similar or exact type of bobbing system like Build's? :3: I hope you don't despise me for the idea!
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: Bobbing functionality in ZScript?

Post by wildweasel »

Why build in (ha, ha ha) this specific functionality to the engine, when the entire weapon and viewport bobbing system could be externalized to ZScript to where the modder could alter it as they see fit? Then we could replicate any bobbing method from any game. Quake 3's pitch-and-roll system, LithTech's figure-eight, the floating-aim system from ARMA...all of that could be done per mod, without the engine needing to cater to individual whims.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Bobbing functionality in ZScript?

Post by Xaser »

A virtual function for bobbing would be godlike -- and is quite doable so I hear. :P
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bobbing functionality in ZScript?

Post by Major Cooke »

Bobbing's been exported. It's done in the player.
User avatar
nazakomu
Posts: 131
Joined: Wed Nov 30, 2016 12:51 am
Graphics Processor: nVidia with Vulkan support

Re: Bobbing functionality in ZScript?

Post by nazakomu »

wildweasel wrote:when the entire weapon and viewport bobbing system could be externalized to ZScript
Yeah, I figured there was a way that was at least a hundred times better than what I suggested. This would be good too because I was thinking of the whole bobbing mechanism in Blood when the player jumps and it looks smooth and satisfying so that'd be awesome to see stuff like that in the future from here!
Xaser wrote:is quite doable so I hear.
Very happy to hear it!
Major Cooke wrote:It's done in the player.
Could you perhaps give a small example of what specifics could be tampered with as of now? :wub:
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bobbing functionality in ZScript?

Post by Major Cooke »

When I need to mess with it I will. Currently I do not, and know nothing of it or where to even start.
User avatar
nazakomu
Posts: 131
Joined: Wed Nov 30, 2016 12:51 am
Graphics Processor: nVidia with Vulkan support

Re: Bobbing functionality in ZScript?

Post by nazakomu »

Major Cooke wrote:Currently I do not
Alright alright, we're probably better off with waiting until Graf decides to scriptify it anyways so then things will probably (hopefully) become as less intricate. Good luck to you when you choose to play with it!
User avatar
Gutawer
Posts: 469
Joined: Sat Apr 16, 2016 6:01 am
Preferred Pronouns: She/Her

Re: Bobbing functionality in ZScript?

Post by Gutawer »

Bob speed already affects the bobbing intensity, if you check gzdoom.pk3/zscript/shared/player.txt the bob function looks like this:

Code: Select all

	void Bob (double angle, double move, bool forward)
	{
		if (forward && (waterlevel || bNoGravity) && Pitch != 0)
		{
			move *= cos(Pitch);
		}
		player.Vel += AngleToVector(angle, move);
	}
See how move is used as the second as the second argument of AngleToVector? That means that move controls the magnitude of the vector, meaning higher movement speeds give a higher bobbing intensity. The Bob function is called from the virtual MovePlayer, so if you want to change how bobbing works, you'll want to override MovePlayer and write your own Bob function (or, in some cases, it may be sufficient to just pass different arguments to Bob inside MovePlayer). Now of course, this isn't that adjustable, since the player.Vel vector controls how bobbing acts, but if you just want to control intensity of the normal Doom-style bobbing, that functionality is already here.
User avatar
phantombeta
Posts: 2084
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Bobbing functionality in ZScript?

Post by phantombeta »

Seems like a DIY by this point, so I've closed it as such.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”