Floating point intensities for quakes
Moderator: GZDoom Developers
-
- 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
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?
-
- 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
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:
-
- Posts: 7402
- Joined: Fri Oct 22, 2004 9:22 am
- Graphics Processor: nVidia with Vulkan support
- Location: MAP33
Re: Floating point intensities for quakes
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...
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Floating point intensities for quakes
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!
I'll look into it.
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);
//...
}
-
- 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
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.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...
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Floating point intensities for quakes
Don't count on it. ViewPos relies upon the class ViewPosition, which is only created when SetViewPos function is called in ZScript.
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.
Code: Select all
class ViewPosition native
{
native readonly Vector3 Offset;
native readonly int Flags;
}
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.
-
- 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
Oh, yeah, that's a problem.
-
- Posts: 8196
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Floating point intensities for quakes
In addition, quakes are also affected by r_quakeintensity, so there's also that.
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.
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.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...
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.