client viewangles at spawn

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

client viewangles at spawn

Post by qbism »

I'm experiencing a weird bug in super8... the first time the client spawns in single-player, viewangles are wrong, possibly zeroed-out. But restarting the map (or any map) sets viewangles correctly. As the next step I'll track messages during and right after sign-on in case it's a protocol error.

What makes the very first sign-on different from later sign-ons?

Anyone ever come across this behavior?
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: client viewangles at spawn

Post by mh »

I got that before but can't remember how I fixed it. Seem to recall it might be something to do with auto-centering of the mouse following a movement, and the window position/size not being updated correctly, but that's the best I can do. If you've been working on any of the globals stored all over the place recently (window_center_x and friends) some of this may sound familiar.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: client viewangles at spawn

Post by r00k »

qbism wrote:I'm experiencing a weird bug in super8... the first time the client spawns in single-player, viewangles are wrong, possibly zeroed-out. But restarting the map (or any map) sets viewangles correctly. As the next step I'll track messages during and right after sign-on in case it's a protocol error.

What makes the very first sign-on different from later sign-ons?

Anyone ever come across this behavior?
This happens to me when i load singleplayer and the m_raw_input is initialized. Only with that.
U can veifiy this by turning off raw input then restarting the map, mostly i spawn at '-80 0 0', i suspect the -80 is forced due to client limitations, ya know.
Image
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: client viewangles at spawn

Post by qbism »

Thanks, the idea of centering based on window and raw mouse input might be related. The screenshot is exactly what I'm getting. High and to the left. I don't have "m_raw" but "m_filtered" cvar and "newmouseparams" array which I changed to disable mouse acceleration (or at least request that).

Mouse-centering based on a bogus resolution may be occurring before the screen dims are calculated. I don't know but that's what I'll check.
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: client viewangles at spawn

Post by qbism »

Getting warmer...

This is the view on 1st map load (1st single player client spawn):
Image

View if SetCursorPos is commented out in function IN_ActivateMouse:
Image

View after second map load/ spawn, the correct view (45 degree rotation):
Image
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Re: client viewangles at spawn

Post by mankrip »

There's a fix for that in Makaqu 1.6.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: client viewangles at spawn

Post by mh »

High and to the left seems to suggest I'm on the right track with my recollection. If your window rect was stored as {0, 0, w, h} that would happen in windowed modes; it would also happen if w and h had values that were too small (this would be valid for both windowed or fullscreen modes). I'm willing to bet that if you did a GetWindowRect each frame and updated these globals based on that, this problem would go away (GetWindowRect should be very fast so this shouldn't be a performance problem). Maybe set a breakpoint on that SetCursorPos call and see what values window_center_x and window_center_y have. Also check your ClipCursor call.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: client viewangles at spawn

Post by qbism »

Great, I've been looking forward to the new Makaqu! I'll also look at GetWindowRect, may solve certain other occasional view direction glitches.
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: client viewangles at spawn

Post by qbism »

Code: Select all

...
	window_width = vid.width;
	window_height = vid.height;
	VID_UpdateWindowStatus ();
	if (host_initialized) // mankrip
		SetCursorPos (window_center_x, window_center_y); // mankrip - center the mouse, to avoid false movement detection
	CDAudio_Resume ();
...
Sweet mercy, that did it. Thanks!
metlslime
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Re: client viewangles at spawn

Post by metlslime »

this bug has annoyed me forever. Glad it's finally been tracked down!
Post Reply