Floating point intensities for quakes

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

Moderator: GZDoom Developers

User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Floating point intensities for quakes

Post by Marisa the Magician »

I've always been bothered by how the intensities for quake functions are integers from 1 to 9, especially when an intensity of 1 is still rather noticeable. Would it actually be possible to make this support floating point values?
User avatar
Lord Misfit
Posts: 226
Joined: Wed Dec 27, 2006 8:13 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: Canton, OH

Re: Floating point intensities for quakes

Post by Lord Misfit »

Seconding this if its possible. I also admit it feels a bit weird that double/floating-points aren't a thing since a lot of people might think of the Richter scale for quake intensities, even if it's not a RL thing in the engine and they don't scale the same way. V:
User avatar
Kinsie
Posts: 7402
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33

Re: Floating point intensities for quakes

Post by Kinsie »

TBH some kind of client-side, unsynched camera-shake method would be good too. Lord knows like 99% of my using quakes is for shaking the screen for a tic or two to emphasise an impact or attack...
User avatar
Major Cooke
Posts: 8196
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Floating point intensities for quakes

Post by Major Cooke »

If we're going to do something involving clientside, I can't exactly help there since I've no idea on how to do that.

Converting to floats, yes. It's perfectly doable. In fact, the moment a DEarthquake is made, it auto converts intensity into double vectors!

Code: Select all

void DEarthquake::Construct(AActor *center, int intensityX, int intensityY, int intensityZ, ...)
{
	//...
	m_Intensity = DVector3(intensityX, intensityY, intensityZ);
	//...
}
I'll look into it.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: Floating point intensities for quakes

Post by Marisa the Magician »

Kinsie wrote:TBH some kind of client-side, unsynched camera-shake method would be good too. Lord knows like 99% of my using quakes is for shaking the screen for a tic or two to emphasise an impact or attack...
Something like this could probably be done with viewpos, now that it's made it in, actually. I'll have to look into it myself.
User avatar
Major Cooke
Posts: 8196
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Floating point intensities for quakes

Post by Major Cooke »

Don't count on it. ViewPos relies upon the class ViewPosition, which is only created when SetViewPos function is called in ZScript.

Code: Select all

class ViewPosition native
{
	native readonly Vector3 Offset;
	native readonly int Flags;
}
It was made this way because of concerns about performance and size. Since this would be supplanted on every actor, it makes a lot more sense that it be a class and only be called when wanted. A class pointer is also smaller than a Vector3 & int combined.

In addition, there's a reason why DEarthquake isn't exposed, so it can remain unsynced safely. ViewPos is exposed to the play side of things.

And if anyone's wondering why this is a class instead of a struct, it's because I didn't know how to properly implement them.
Last edited by Major Cooke on Wed Jun 15, 2022 10:22 am, edited 1 time in total.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: Floating point intensities for quakes

Post by Marisa the Magician »

Oh, yeah, that's a problem.
User avatar
Major Cooke
Posts: 8196
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Floating point intensities for quakes

Post by Major Cooke »

In addition, quakes are also affected by r_quakeintensity, so there's also that.
Kinsie wrote:TBH some kind of client-side, unsynched camera-shake method would be good too. Lord knows like 99% of my using quakes is for shaking the screen for a tic or two to emphasise an impact or attack...
Quakes are already as clientside as they can be. It's also why I created ViewPos so you can generate your own custom quakes in a way, but for mods that want to combine and create additional quakes using that, admittedly may not mesh well with other mods that attempt to create their own quakes, so I went out of my way to expand A_QuakeEx as much as possible. The only thing that's missing is the ability to set the oscillation offset (i.e. akin to FloatBobPhase) for the sine quakes, but otherwise you can do a lot with them.

Anyway...

I'll look into adding floating point precision, but I'm still going to keep the cap in at 9 for intensity. Some mods set them over 9, unaware that the cap and may cause massive confusion with an intensity of 100 and seeing into sectors you normally shouldn't be able to (on top of completely fucking with your aim). I mean, that problem already exists if you stand against a wall anyway but uncapping it would only exacerbate it.

Return to “Feature Suggestions [GZDoom]”