spenibus.net
2018-09-18 17:26:11 GMT

PC steering wheel viewer prototype in html/javascript

### Summary Since the W3C gamepad API exists, I was curious enough to put together a small prototype to visualize the inputs on my steering wheel. It's missing the gear stick but at least it shows the wheel's rotation and the pressure on the pedals. [Using the Gamepad API (MDN web docs)][1] ### Video demo <center><iframe width="480" height="270" src="https://www.youtube.com/embed/JkMWs_NOwUQ" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></center> ### The code `wheel.js` ```` /******************************************************************************* pc steering wheel animated viewer firefox/chrome based on a logitech g920 /******************************************************************************/ let device; let dataDisplay; let axisIndexWheel = 0; let axisIndexThrottle = 1; let axisIndexBrake = 2; let axisIndexClutch = 3; let axisIndexClutchAlt = 5; let elemWheel; let elemThrottle; let elemBrake; let elemClutch; let axisWheelFullRotation = 900; // degrees window.addEventListener('DOMContentLoaded', function(e) { console.log('loaded'); dataDisplay = document.getElementById('dataDisplay'); elemWheel = document.getElementById('wheel'); elemThrottle = document.querySelector('#throttle > span'); elemBrake = document.querySelector('#brake > span'); elemClutch = document.querySelector('#clutch > span'); gameLoop(); }); function gameLoop() { wheelDevice = null; let gps = navigator.getGamepads(); for(let gp of gps) { if(gp.id.match(/g920.*wheel/i)) { wheelDevice = gp; break; } } if(wheelDevice) { let axisValueWheel = wheelDevice.axes[axisIndexWheel]; let axisValueThrottle = wheelDevice.axes[axisIndexThrottle]; let axisValueBrake = wheelDevice.axes[axisIndexBrake]; let axisValueClutch = wheelDevice.axes[axisIndexClutch] || wheelDevice.axes[axisIndexClutchAlt]; // convert wheel axis to angle axisValueWheel = Math.round(axisWheelFullRotation / 2 * axisValueWheel * 1000) / 1000; // normalize pedals axes to range 0-1 axisValueThrottle = (axisValueThrottle * -1 + 1) / 2; axisValueBrake = (axisValueBrake * -1 + 1) / 2; axisValueClutch = (axisValueClutch * -1 + 1) / 2; dataDisplay.innerHTML = '<div>wheel: '+axisValueWheel+'deg</div>'; dataDisplay.innerHTML += '<div>thottle: '+axisValueThrottle+'</div>'; dataDisplay.innerHTML += '<div>brake: '+axisValueBrake +'</div>'; dataDisplay.innerHTML += '<div>clutch: '+axisValueClutch +'</div>'; elemWheel.style.transform = 'rotate('+axisValueWheel+'deg)'; elemThrottle.style.height = (100 - axisValueThrottle * 100)+'%'; elemBrake.style.height = (100 - axisValueBrake * 100)+'%'; elemClutch.style.height = (100 - axisValueClutch * 100)+'%'; } requestAnimationFrame(gameLoop); } ```` `wheel.html` ```` <!DOCTYPE html> <html> <head> <title>Wheel</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <script src="wheel.js" type="text/javascript"></script> <link href="wheel.css" rel="stylesheet" type="text/css" /> </head> <body class="index"> <div id="viewer"> <img id="wheel" src="wheel-500.png" alt="wheel"> <span id="clutch" class="pedal"><span></span></span> <span id="brake" class="pedal"><span></span></span> <span id="throttle" class="pedal"><span></span></span> </div> <div id="dataDisplay">-</div> </body> </html> ```` `wheel.css` ```` body { background-color:#888; margin:0; padding:0; } #viewer { border-bottom:4px red solid; padding:10px; } #wheel { display:inline-block; vertical-align:bottom; border:5px solid transparent; max-height:200px; margin:10px; transform-origin:center center; } .pedal { display:inline-block; vertical-align:bottom; border:5px solid black; width:40px; height:200px; margin:10px; background-color:#AAA; } .pedal > span { display:inline-block; width:100%; height:100%; background-color:#AAA; vertical-align:top; } #wheel {} #throttle { background-color:#0A0; } #brake { background-color:#C00; } #clutch { background-color:#FA0; } ```` `wheel-500.png` ![wheel-500.png][wheel-500.png] [1]: https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API [wheel-500.png]: http://spenibus.net/f/g/cq/wheel-500.png
2018-08-23 10:53:01 GMT

A quick glance at mouse sensitivity in videogames

Out of curiosity, I searched around to get a vague idea of the mouse sensitivity used by the average gamer. While by no means exhaustive, I found the following: - [Results: Survey of Mouse Distance to to Turn 360 - epicgames.com][1] - [how much cm for a 360? - hltv.org][2] - [how many cm for a full 360° turn you have, and why you have stick to it? - quakeworld.nu][3] While the Quake people do use higher sensitivities, based on these pages the average sensitivity is around 25 to 40 centimetres per 360 degrees, a result I find rather astonishing. By which I mean it is really slow, you've got to either move your whole arm or lift your mouse a few times to make a full circle. And some people go even lower, requiring more than a meter to spin around. When it comes to mouse control, I'm a claw/fingertip grip kind of guy, it's all about wrist control and micro adjustments by flexing the fingers, the arm never moves. ![](http://spenibus.net/f/g/co) Pictured above: a Logitech G502 Proteus Spectrum RGB mouse. Which prompted me to do some measurements, in millimetres per 360 degrees: - 43 mm/360 / [Crysis (2007)][4] - 39 mm/360 / [Tomb Raider (2013)][5] - 27 mm/360 / [Dishonored (2012)][6] ![](http://spenibus.net/f/g/cp) Note the mistake when measuring Dishonored, it should read 27mm instead of 22mm. I also understand why I am more likely to experience pixel skipping. It was quite noticeable in Tomb Raider until I lowered the ingame sensitivity and raised the mouse DPI, a tactic that doesn't seem to work so well in Crysis. In conclusion, those low sensitivities are rather baffling to me, it must be exhausting to move so much. [1]: https://www.epicgames.com/unrealtournament/forums/unreal-tournament-discussion/ut-game-general-discussion/11913-results-survey-of-mouse-distance-to-to-turn-360 [2]: https://www.hltv.org/forums/threads/591345/how-much-cm-for-a-360 [3]: https://www.quakeworld.nu/forum/topic/5720/how-many-cm-for-a-full-360-turn-you-have-and-why-you-have-stick-to-it [4]: https://en.wikipedia.org/wiki/Crysis_(video_game) [5]: https://en.wikipedia.org/wiki/Tomb_Raider_(2013_video_game) [6]: https://en.wikipedia.org/wiki/Dishonored
2018-04-23 20:48:09 GMT

Medal of Honor - Allied Assault War Chest - Config Notes

Mostly fixing the FOV, as always. >%gamedir%/main/configs/unnamedsoldier.cfg ```` seta r_customheight "1200" seta r_customwidth "1920" seta ui_console "1" seta developer "1" alias fovdown "fov 90" alias fovup "fov 110" bind ) "fovdown" bind = "fovup" ````