Forum

Can't stop spinning

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Can't stop spinning

Postby dreadlorde » Wed Feb 03, 2010 5:29 pm

I'm having a problem with movement in my engine. It seems that when I'm moving around and shoot, I will sometimes get stuck going in the direction that I was moving when I fired. The only way I can stop it is to hold down on the key that makes me move the opposite direction and then press the key that is the direction I'm currently moving.

Could someone point me to what source files I would need to work with to fix this? I'm using the original WinQuake source on linux with the software renderer. I haven't done much to it except remove windows specific code and the OpenGL renderer.

Here's a link to a demo somewhat better explains what I'm having trouble with. http://omploader.org/vM2Z0cQ/spin.dem
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.

Get off my lawn!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am

Postby r00k » Wed Feb 03, 2010 6:13 pm

Are you playing in windowed mode?
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby ceriux » Wed Feb 03, 2010 6:13 pm

iv actually had similar issues with something i messed up in .qc before. if your doing any .qc modifications to test your engine with. be sure to check that too.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby mh » Wed Feb 03, 2010 6:16 pm

I fixed that a while ago, but my code is different of course. What's happening is that you're using the mouse for movement (guess), and mouse_oldbuttonstate (or equivalent) is not getting cleared properly. Not certain where in the Linux code this is though.
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
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby dreadlorde » Wed Feb 03, 2010 6:27 pm

r00k wrote:Are you playing in windowed mode?

I should have mentioned that. I'm using
Code: Select all
./quake.x11 -mem 64 -window -width 800 -height 600
to play. It happens at other resolutions also.
ceriux wrote:iv actually had similar issues with something i messed up in .qc before. if your doing any .qc modifications to test your engine with. be sure to check that too.
I'm not doing anything with QuakeC.
mh wrote:I fixed that a while ago, but my code is different of course. What's happening is that you're using the mouse for movement (guess), and mouse_oldbuttonstate (or equivalent) is not getting cleared properly. Not certain where in the Linux code this is though.
I'm not using the mouse either, as the old code doesn't seem work with new versions of X.org. I using just the keyboard.
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.

Get off my lawn!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am

Postby Baker » Thu Feb 04, 2010 2:57 am

Add -nomouse to the command line, see if problem persists ...
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby dreadlorde » Thu Feb 04, 2010 3:08 am

The problem persists.
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.

Get off my lawn!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am

Postby Baker » Thu Feb 04, 2010 3:19 am

Look at cl_input.c and in_(whatever ... it's not in_win.c on Linux and I don't think it's called in_linux.c either).

You'd think the +turnleft or +turnright keys are somehow being triggered. One solution for sure is to edit config.cfg and change any bind to something else.

Notice I said "change" ... remember that default.cfg in pak0.pak is executed first and it does have a default key. For the +turnleft and +turnright keys to be neutralized "for sure" you'd need to make sure they are bound to something else in autoexec.cfg or config.cfg.

If +turnleft or +turnright isn't referenced by any key I don't see how the problem can persist.

If the problem does persist, have it Con_Printf some stuff to the console to see when and where it is getting triggered.

Good luck and have fun! Shouldn't be too hard to solve, really.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Baker » Thu Feb 04, 2010 3:27 am

Oh yeah ...

Type -turnleft in the console
Type -turnright in the console
Type +turnleft in the console
Type +turnright in the console

One of those will solve your problem the "wrong" way, but it will solve your problem.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby goldenboy » Thu Feb 04, 2010 9:00 pm

The keep-moving thing happens to me too sometimes, in Fitz and also DP.

Another thing is that in some engines, you spin uncontrollably.

Still another is that sometimes, the mouse gets locked between "invisible barriers" so you can only look into a certain direction. DOOM engines love to do this. Q4 does this, too.

I think all these only happened to me when using SDL though. SDL is *incredibly* buggy, on Linux at least (which is why I always prefer a clean GLX renderer - alas, SDL is the cheap method to do crossplatform these days). Some Q2 engines are unusable due to this.

Never encountered this stuff in software though.

Linux here, too.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Postby Teiman » Thu Feb 04, 2010 9:07 pm

goldenboy wrote:Still another is that sometimes, the mouse gets locked between "invisible barriers" so you can only look into a certain direction. DOOM engines love to do this. Q4 does this, too.
.


Lets play the random card:

Have your checked your FPU to be correct? that looks like float/vector problems, and quake don't use quaternions111111!!ONE ONE.

</random>.
Teiman
 
Posts: 309
Joined: Sun Jun 03, 2007 9:39 am

Postby goldenboy » Thu Feb 04, 2010 11:19 pm

Well, it happens on two very different machines. Usually either pausing and continuing, or restarting the engine a couple times will fix the "angle lock" thing. The "continual spinning" problem is not repairable in any way that I know of - you have to switch engine. The "keep running forward" problem is mostly fixed by messing around with running in different directions, shooting and jumping for a while... of course, that sucks and I then usually restart the level.

There is no computer, no OS and no game engine that doesn't suck.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Postby Teiman » Fri Feb 05, 2010 1:48 pm

goldenboy wrote:Well, it happens on two very different machines. Usually either pausing and continuing, or restarting the engine a couple times will fix the "angle lock" thing. The "continual spinning" problem is not repairable in any way that I know of - you have to switch engine. The "keep running forward" problem is mostly fixed by messing around with running in different directions, shooting and jumping for a while... of course, that sucks and I then usually restart the level.

There is no computer, no OS and no game engine that doesn't suck.


Try a different type of mouse. Maybe is your favorite model mouse driver, or things.

</random again>
Teiman
 
Posts: 309
Joined: Sun Jun 03, 2007 9:39 am

Postby Spike » Fri Feb 05, 2010 2:29 pm

I get this a lot with my keyboard. It just doesn't send the key release event, and I have to re-press it to stop moving. Moving in the other direction just temporarily stops motion, as then both directions are pressed.
At the end of the day, keyboards cannot always detect which keys are actually being pressed at any one time, the same goes for when they are released too. Pretty much all keyboards suffer from this problem in some area of the keyboard, but most are specially designed now to avoid the issue near commonly pressed keys.
For programmers: The effect could probably be reduced by forcibly releasing the opposing key, but not fixed.
For users: start using cursor keys and the wasd keys instead. For a quake specific solution, bind a key to "-forward;-back;-left;-right;-turnleft;-turnright;-attack;-jump;-klook" basically -everything you may have pressed.
Also, make sure you have no binds set for upper case letters (read the binds in your config file).

Also, I mention this as its almost related: A couple of engines+games result in lots of really fast insane spinning when running windowed with a corner of the window off the top of the screen. DP is one example. :P
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby dreadlorde » Fri Feb 05, 2010 7:27 pm

Ok, I'm going to try all of these suggestions this weekend hopefully. I'll report back then.
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.

Get off my lawn!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am

Next

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest