Qbasicnews.com

Full Version: Original Challenge: *FAST* Joystick Library for QB!! ;*) !
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
15 pins, and since the PC gameport is designed for analog joysticks, there's more to it than that:

Quote:1. Normally on idle state the capacitor C1 is fully charged (5V) and multivibator output gives out logic 1.
2. Computer writes to I/O address 201h to reset the multivibrators. The multivibrator get a triggger pulse from I/O write signal and it discharged capacitor C1. The multivibrator output goes to logic 0 because the capacitor is discharged (0V).
2. The capacitor starts to charge form the current which goes through R1 and the joystick potentiometer.
3. When the capacitor voltage reaches certain oltage threshold level, the multivibrator output goes back to logic 1.
The bigger the potentiometer resistance value is, the loger it takes from the capacitor to reach the threshold voltage. The time how long it take for each multivibator to reach the logic 1 after the triggering is measued using software and that value tells the resistance of the potentiometer (and the stick position as well because the potentiometer is connected to the stick). This simple method for measuring the resistance value is quite cheap, but not very accurate.
This simple joystick port hardware implementation (originally designed for 4.7 MHz IBM PC) causes many headaches to game programmers (problems of different computer speeds, joycitck port differences, problems in multitasking operating systems etc.). Big tolerances in joysticks and joystick ports mean that the every game must have an option to cablibrate the joystick (which actually means that the program adapts to accept the values in th range which the joystick reading routine does and then converts the values to it's internal format using the values measured in joystick calibration process).
To Plasma357:

As for what you wrote, which was:

______________________________________________
1. Normally on idle state the capacitor C1 is fully charged (5V) and multivibator output gives out logic 1.
2. Computer writes to I/O address 201h to reset the multivibrators. The multivibrator get a triggger pulse from I/O write signal and it discharged capacitor C1. The multivibrator output goes to logic 0 because the capacitor is discharged (0V).
2. The capacitor starts to charge form the current which goes through R1 and the joystick potentiometer.
3. When the capacitor voltage reaches certain oltage threshold level, the multivibrator output goes back to logic 1.
The bigger the potentiometer resistance value is, the loger it takes from the capacitor to reach the threshold voltage. The time how long it take for each multivibator to reach the logic 1 after the triggering is measued using software and that value tells the resistance of the potentiometer (and the stick position as well because the potentiometer is connected to the stick). This simple method for measuring the resistance value is quite cheap, but not very accurate.
This simple joystick port hardware implementation (originally designed for 4.7 MHz IBM PC) causes many headaches to game programmers (problems of different computer speeds, joycitck port differences, problems in multitasking operating systems etc.). Big tolerances in joysticks and joystick ports mean that the every game must have an option to cablibrate the joystick (which actually means that the program adapts to accept the values in th range which the joystick reading routine does and then converts the values to it's internal format using the values measured in joystick calibration process).

______________________________________________

.........WOW, you sure know a lot more about joysticks in PCs than I do, because I’ll tell you something to get straight and to the point here, Plasma357:

You are MOST truly correct. Wink !

I mean, back in my 80’s/90’s days, I **NEVER** even had an actual joystick for an IBM (or compatible) PC, much less even used one myself. And that was _apparently_ part of the rather reason why I never knew much about joysticks/gamepads interfacing with those kinds of PCs, sadly. Sad But hey, at least your interesting answer is definitely ***QUITE*** a learning experience in how to tame such a intensified crash course in joysticks/gamepads as this. Big Grin !

So, **EXCELLENT** point, man, and thank you for your brutally honest insights, too! ;*) !!



GETTING YOUR POINT ACROSS IN SUCH A SERIOUS WAY,

[Image: AAPMini.gif]
Adigun Azikiwe Polack
One of the Founders of “Aura Flow”
Webmaster of the AAP Official Homepage
Official Founder of the “QuickBASIC Caliber Programming Compo”



P.S. You don’t have to enter this challenge if you don’t want to. I mean, I PLAIN refuse to even force you to enter, my man, especially since I love you with all of my heart, really! Wink !
The qb joystick commands... they are as rigid as INKEY$?
Quote:The qb joystick commands... they are as rigid as INKEY$?
I've heard that they're as bad as ON KEY(x) GOSUB.
When "Nibbles" first came out, my brother-in-law liked the game, but thought it would be better with a joystick. I thought, "No problem." I used STICK, but everytime the snake got a number, the computer beeped, the joystick reading went off, and the snake went out of control.
So, a joystick routine in a realtime game is a bad idea?
Who says so. It's a great way to allow multiplayer games in QB with a higher range of keys and buttons to choose from.
Yeah, but the game I'm trying to make will be quick paced and if a gamepad/joystick is unresponsive then it won't be worth the trouble use, much less program. I'll just stick to the 2 players on one keyboard idea.
The joystick won't make your game unresponsive if you use it wisely. Just don't poll it every screen update. (Poll it every 4th, or something like that.)
That makes sense. I'm gonna have my game get input from the keyboard, and then I'm gonna see how it works with a joystick.
Pages: 1 2 3