Bobbing functionality in ZScript?

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

Bobbing functionality in ZScript?

Postby 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!
User avatar
nazakomu
apathetic
 
Joined: 30 Nov 2016
Discord: Nazakomu#2197
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Bobbing functionality in ZScript?

Postby 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.
User avatar
wildweasel
change o' pace.
Moderator Team Lead
 
Joined: 16 Jul 2003

Re: Bobbing functionality in ZScript?

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

A virtual function for bobbing would be godlike -- and is quite doable so I hear. :P
User avatar
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

Re: Bobbing functionality in ZScript?

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

Bobbing's been exported. It's done in the player.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Bobbing functionality in ZScript?

Postby 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:
User avatar
nazakomu
apathetic
 
Joined: 30 Nov 2016
Discord: Nazakomu#2197
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Bobbing functionality in ZScript?

Postby 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.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Bobbing functionality in ZScript?

Postby 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!
User avatar
nazakomu
apathetic
 
Joined: 30 Nov 2016
Discord: Nazakomu#2197
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Bobbing functionality in ZScript?

Postby 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 allExpand view
   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
Gutawer
User Accounts Assistant
 
Joined: 16 Apr 2016
Discord: Gutawer#3431


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest