Bobbing functionality in ZScript?

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Bobbing functionality in ZScript?

Re: Bobbing functionality in ZScript?

by phantombeta » Fri Feb 21, 2020 1:14 pm

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

Re: Bobbing functionality in ZScript?

by Gutawer » Sun May 21, 2017 1:34 am

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.

Re: Bobbing functionality in ZScript?

by nazakomu » Sat May 20, 2017 8:46 am

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!

Re: Bobbing functionality in ZScript?

by Major Cooke » Sat May 20, 2017 7:53 am

When I need to mess with it I will. Currently I do not, and know nothing of it or where to even start.

Re: Bobbing functionality in ZScript?

by nazakomu » Sat May 20, 2017 6:59 am

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:

Re: Bobbing functionality in ZScript?

by Major Cooke » Fri May 19, 2017 10:00 pm

Bobbing's been exported. It's done in the player.

Re: Bobbing functionality in ZScript?

by Xaser » Fri May 19, 2017 8:47 pm

A virtual function for bobbing would be godlike -- and is quite doable so I hear. :P

Re: Bobbing functionality in ZScript?

by wildweasel » Fri May 19, 2017 7:43 pm

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.

Bobbing functionality in ZScript?

by nazakomu » Fri May 19, 2017 4:16 pm

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!

Top