roncli.com blog
The blog of roncli
roncli.com blog
roncli.com
blog
Profile
roncli
Houston, Texas, United States
Labels
Coding
CTG Music
Editorials
Games
Miscellaneous
Music
Servers
Silliness
Software
Sports
Trax in Space Beta
Weather
Recent Posts
WTF did Revival Productions just do?
A Tale of Two Communities
The Final Stretch
A Two Tiered, Untiered OTL
Secretly, you wish you could've done what I did
What have I done since roncli.com v2?
It's Done. It's Finally Done.
The Big Picture is Starting to Wear on Me
A Low Bang to Buck Ratio
win-acme
Archives
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
December 2007
January 2008
February 2008
March 2008
April 2008
June 2008
July 2008
September 2008
December 2008
February 2009
July 2009
August 2009
September 2009
October 2009
November 2009
February 2010
March 2010
April 2010
June 2010
July 2010
August 2010
September 2010
October 2010
November 2010
December 2010
March 2011
June 2011
July 2011
August 2011
September 2011
October 2011
December 2011
January 2012
February 2012
April 2012
July 2012
November 2012
July 2013
April 2014
July 2014
August 2014
November 2014
December 2014
March 2015
April 2015
May 2015
June 2015
July 2015
September 2015
January 2016
February 2016
May 2016
July 2016
November 2016
March 2017
January 2018
May 2018
June 2018
January 2019
January 2021
February 2021
March 2021
August 2021
October 2021
December 2021
August 2022
November 2022
October 2023
February 2024
April 2024
Wednesday, May 06, 2015
The problem with mice in Descent
Posted: 2:07:00 AM 0 comments
Descent was an awesome series. Hell, it still IS an awesome series. Six degrees of freedom, claustrophobic tunnels, murderous robots... what's not to love about this game?

The fact that it was made in 1995 for one. Originally written for MS-DOS, Descent was designed to run on computers that didn't know what a Pentium was. It ran great on those computers, but as computer processing power increased, it started to become obvious that the game was not written to scale well.

At first, the homing missile became impossible to dodge. Written to work fine at 30 frames per second, the homing missile began to turn faster and faster as that 30 became 60, 60 became 100, and 100 became 200. Fortunately, this bug has been fixed and has made playing Descent quite bearable.

However, recently, a new bug reared its ugly head involving mouse play. Descent plays at a constant 200 frames per second, assuming you don't have vsync on, or have otherwise limited the frame rate. The average mouse in Windows is only polled at the rate of 125 times per second. So, your graphics card is getting more frames per second than Windows is getting mouse positions. How does this cause problems in Descent?

One of the quirks about Descent is that, unlike traditional first person shooters, you are not allowed to just 180 your ship in an instant. The Pyro has a maximum turn rate, and is hard-limited in the code, throwing out extra movements that are made beyond the maximum allowed. This means that you can whip your mouse around the mousepad, and you won't move very much.

The turn rate for the mouse, however, is determined per frame. So, what'll happen is you'll move the mouse, say, an inch, within 2 frames. You only need to move it, say, a quarter of an inch to reach maximum turn speed. At the end of the first frame, the first quarter of an inch is processed and the next quarter of an inch is thrown out. Same thing for the second frame, the next quarter of an inch is processed and the final quarter of an inch is thrown out.

However, let's say in the first frame, your mouse didn't get polled at all. At the end of the first frame, Descent - and Windows for that matter - think you haven't moved the mouse. Your Pyro does not move at all. In the second frame, the mouse is polled and sees you moved an entire inch. The first quarter of an inch is processed, and the other three quarters are thrown out. All that movement for nothing!

Having a fellow pilot suffer greatly because of these issues, I decided to dive into the source code and develop a fix. Now what happens is that you turn on the Mouse Overrun Buffer setting, and then instead of throwing out the extra movements of your mouse, it is stored in a buffer, with anywhere between 1/16 of a second and a full second of movement stored, depending on how high you decide to set your buffer. Then, in the next frame, anything already in your buffer is added to whatever mouse movement was detected that frame, and that is used to determine how much your pyro moves, storing any excess back into the buffer again.

You can find this code in a pull request for DXX-Retro, a source port of Descent dedicated to the competitive community. If you own the original game, you can find downloads for DXX-Retro at the Descent Rangers download page.

And if you don't, go get it! Classic first-person shooter action.

Labels: , , , ,