Make camera actor fov double instead of int

Moderator: GZDoom Developers

Post Reply
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Make camera actor fov double instead of int

Post by Matt »

At lower fovs going from one whole number to the next can be a bit of a jump.

Also would be nice to be able to do extreme zooming with fovs of less than 1.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Make camera actor fov double instead of int

Post by Nash »

Question:

I don't know the netcode too well but... is it enough to just change the Net_WriteByte calls in player_t::SetFOV to Net_WriteFloat and changing the respective FOV cases in Net_DoCommand to use ReadFloat(stream)? Will it negatively affect network latency or anything like that?

(Interestingly enough, nothing in the engine utilizes Net_WriteFloat even though it exists...)
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Make camera actor fov double instead of int

Post by Nash »

Okay I did try to change the Net_WriteByte calls to Net_WriteFloat but I keep getting some "unknown net command" errors and get bombed to the console. I am almost certain it's because I'm not handling the DEM_FOV and DEM_MYFOV cases properly in Net_SkipCommand. Problem is, I have zero clue how to determine what the value of "skip" should be. It makes zero sense to me just by reading what the others are doing, and there's no documentation of it anywhere in the source code, nor on the internet. Can anyone give me any clues?
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Make camera actor fov double instead of int

Post by _mental_ »

The value of skip is a number of bytes left in this message. For one floating point value it's four.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Make camera actor fov double instead of int

Post by Nash »

Ok thanks _mental_.

Made a PR: https://github.com/coelckers/gzdoom/pull/360/commits

@Vaecrius:

All that was really changed here is using the console to change your FOV now has floating point precision.

A_ZoomFactor, the newly-introduced CameraFOV for non-players, and setting the player's FOV directly, has always allowed you to use floats all along, so I need to ask: what exactly was your intended use case when you made this suggestion?
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Make camera actor fov double instead of int

Post by Matt »

TexMan.SetCameraToTexture() can only take an int.

I've never really paid much attention to anything else so I assumed all the fov functions did too!

EDIT: and now that I try it (3.1.0), it seems that the fov command also only takes integers.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Make camera actor fov double instead of int

Post by Nash »

Vaecrius wrote:TexMan.SetCameraToTexture() can only take an int.
You should have specifically said this in your original request..
I've never really paid much attention to anything else so I assumed all the fov functions did too!
When in doubt, refer to what type a method takes in inside GZDoom.pk3
EDIT: and now that I try it (3.1.0), it seems that the fov command also only takes integers.
Yes, the FOV console command only works with ints. My PR changes that. Now of course, it turns out that what I did was not related at all to what you really asked for. :P

I took a look at SetCameraTexure. It should be do-able but it's not too simple for me to do since the related code is strewn across several files and between the different renderers, and I'm just not confident about tweaking that stuff. It would be great to be given a simple runnable test WAD for me to test my changes... however, to be honest, I don't really dare touch the camera texture code... I'll probably just make things worse. :P Best let Graf do it.

@Devs: feel free to move the floating point FOV CCMD stuff out of this thread if it's cluttering things up in here
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Make camera actor fov double instead of int

Post by Nash »

Vaecrius wrote:TexMan.SetCameraToTexture() can only take an int.
Changed camera textures to use floating point for FOV. Demo file attached.

Works OK in OpenGL and software renderers, although in the TC software renderers, I lose 20 FPS... probably all those SetCameraToTexture calls every tick is murderous and can be associated with bad user scripting techniques.
Attachments
camtextest.zip
(2.04 KiB) Downloaded 32 times
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Make camera actor fov double instead of int

Post by Matt »

Just tried the latest GZDoom git and it works as I wanted it to, thanks!
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”