0
\$\begingroup\$

While developing, I started integrating joysticks into my framework, and had some questions since different OSs handle joysticks differently. My framework may potentially be opened to the public at a later date, so I thought I'd ask these for consideration:

What's the minimum amount of resolution a framework should offer to developers? While watching the values of the axes, I can get a reasonably smooth range from my joystick; however I can't think of too many use cases for the higher resolutions.

Are there any real benefits of having high resolution vs a lower one? I was thinking about having just a 3-bit resolution for my games, (standing, creeping, walking, running, plus one bit for the opposite direction).

I can only see high resolutions being useful on driving or airplane simulator games, so are there reasons to use them in other types of games? Personally, I still see having three, or even four bits for such games as enough.

Thanks.

\$\endgroup\$
5
  • \$\begingroup\$ Most frameworks I've used expose a single-precision float per axis. Is there a particular reason you want to be so frugal with bits? \$\endgroup\$
    – DMGregory
    Commented Apr 7, 2020 at 9:05
  • \$\begingroup\$ @DMGregory Not at this time. I'm just looking for use cases to see if there's a really good reason to have more than 4 bits of resolution. And after reading wychmaster's answer, I'm leaning towards at least using 8 bits instead. \$\endgroup\$
    – Blerg
    Commented Apr 7, 2020 at 9:38
  • \$\begingroup\$ Also of note is that those frameworks are actually converting the values to floats. GLFW for Windows does: data + 0.5f / 32767.5f to give you that float. I prefer to avoid floats since they're normally slower than integers on a CPU. \$\endgroup\$
    – Blerg
    Commented Apr 7, 2020 at 9:46
  • \$\begingroup\$ That calculation implies that GLFW is expecting 16-bit precision in its input, double your latest leaning. ;) I'd also be wary of premature optimization in picking ints over floats. Rarely if ever will analog stick interactions be the bottleneck in modern game code: we usually only have a handful of sticks to read or handful of things to do with them in a frame, compared to simulating hundreds of physics bodies, thousands of particles, or rendering millions of triangles (all with floats). And modern processors chew through floats quite quickly - beating ints for some operations! \$\endgroup\$
    – DMGregory
    Commented Apr 7, 2020 at 9:58
  • \$\begingroup\$ It is indeed using a 16-bit integer, on Linux though, it uses 8 bits if I'm not mistaken. I'm trying to be as portable as possible so that there's no need to change anything on the end developer side. \$\endgroup\$
    – Blerg
    Commented Apr 7, 2020 at 10:07

1 Answer 1

1
\$\begingroup\$

This totally depends on which kind of game you want to make. Driving games and flight simulators are obvious candidates for high resolution. But there might be other use cases. Think of the control stick of a Playstation as joystick equivalents. If you play an FPS and don't have a mouse, you want at least some ability to aim with fine-grained control (I have to admit here, that I don't really know how much control a PS control stick offers). You can also use it to give the player better control of his character's movement speed. There are also games with the possibility to drive or maneuver an aircraft without being a racing game or a flight simulator, like GTA, Battlefield, etc.

Additionally, there is the question: What is the point of using a joystick in the first place, if you don't use its capability to give you a high-resolution input? If it is not needed, you can simply use a control-pad.

So if I would search for a framework for my game, I would answer your questions as follows:

What's the minimum amount of resolution a framework should offer to developers?

The maximum that is possible from the utilized hardware + drivers.

Are there any real benefits of having high resolution vs a lower one?

If MY game needs it, yes, if not, no.

so are there reasons to use them in other types of games?

Yes, see above. And there are certainly many, many more.

I still see having three, or even four bits for such games as enough.

This attitude is fine if you are developing a game. If you want o to provide a framework for developers, you are taking options away from them. This might be a reason to decide against your framework.

\$\endgroup\$
2
  • \$\begingroup\$ "What is the point of using a joystick in the first place.....?" Anything over a single bit is a higher resolution than a control-pad. For non-hardcore/pro gamers, how often can a normal person use such precision? "If you want o to provide a framework for developers, you are taking options away from them." That, I'll concede somewhat too. I'm making my framework as portable as possible, so some limitations will bleed over to other OSes. \$\endgroup\$
    – Blerg
    Commented Apr 7, 2020 at 10:15
  • \$\begingroup\$ And after thinking about it even more, a sniper requires a lot more precision, so that's kinda a requirement. I mainly play with a keyboard and mouse; so I've never paid attention to something like this. \$\endgroup\$
    – Blerg
    Commented Apr 7, 2020 at 10:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .