Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: need help speeding up keyboard  (Read 1299 times)

0 Members and 1 Guest are viewing this topic.

bernard

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:July 06, 2009, 01:20:53 am
  • Captain 'Video Warriors': NH's Pro Video Game Team
    • Bernard's MAME machine
need help speeding up keyboard
« on: May 26, 2008, 01:18:30 am »
Hello.  I haven't visited this site in a long time (been very busy with real life) but several years ago I was a frequent visitor to this excellent site, and it helped me immensely.  I was able to put together my own MAME machine and it came out great, mostly thanks to the great advice and support I got here... so thanks everyone.

I have a new project now, and a new problem with it, I was hoping maybe someone could shed some light on what might be the problem.

My friend and I decided to create our own video game (not just a cabinet, but an original GAME).  He wrote the programming, and I built the cabinet and wired up the PC, etc.

I used the same "arcade-controls-to-PC-interface" method that I used for the MAME machine I built years ago... I used an OLD keyboard.  One that is old enough that it has micro-switches for each keyboard button.  What's cool about these is that if you open up the keyboard there's a circuit board for the whole keyboard and each key has two solder joints on the back... this makes it SO easy to just run a couple wires from each key to each arcade button/joystick/etc.

This method worked out fine for my MAME machine, but for this machine we're building now, it might be a problem.  I honestly don't know if this is what's causing the problem, it could be any number of things, but I was hoping someone else might have run into this problem themselves and might know how to sovle it.

The problem is that the computer doesn't seem to keep up with my arcade input.

One of the things in our game is that you need to press the arcade buttons REALLY FAST, kinda like "Track & Field" fast.  But the game or computer doesn't seem to be able to keep up with my button-pressing.

Here's the hardware/software we're dealing with.  It's a DELL PC with a Pentium 3 1.0Ghz processor, 256 MB RAM, 32 MB AGP video card... I'm not really going to go into any more detail about the PC hardware... nothing else really would make a difference except the 1.0Ghz processor.  There's really hardly any RAM memory usage to this game and there's also not any spectacular graphics.

Like I said... for the arcade interface, I'm using an old micro-switch keyboard with wires running from the keybard keys to the arcade buttons, etc. and it's a PS2 keybaord.

The operating system is Windows XP (another possible problem)... and I'm kinda pissed.  I had a hard-drive with a fresh Windows XP Home installation on it, that was all set to go, but when I put it in this new PC, it screwed up and made me have to completely re-install Windows XP Home.  Now it wants me to ACTIVATE it (stupid machine)... I'm not going to activate it (because I can't... I had to use my own Windows XP disc for the install and of course that's already activated on my home PC.  So I'll just have to live with it bugging me to activate.

The program my friend wrote is in JAVA (jre-6u5-windows-i586-p.exe to be exact).  I know NOTHING about programming or JAVA so this part is all up to him.  He wrote the program on his 2.4 Ghz PC, and it was using 100% of his processor, so when I first put it on the game PC it was running ---smurfy---, and it maxed the processor usage out.  But that was on the original PC I had it hooked up to, which was a simple slot 1 pentium 400 Mhz processor.  He tweaked up the program and got it running better so that on HIS 2.4Ghz computer it was only using 12% of his processor.  Running this new version on the 400Mhz slot 1 computer I had, pushed the processor usage up to 70%.  But, now I have a bit newer PC to use for this game and it's got the newer Pentium 3 (not slot 1) 1.0 Ghz processor in it, so I figured that should be plenty.

So that's about it.  1.0Ghz processor, running Windows XP Home, running a game programmed in JAVA, using an old PS2 microswitch keyboard for arcade controls interface, and the game can't keep up with my button-presses.

What's the problem?  Is it the processor is too slow?  Is it that the keyboard is too old?  Is it the operating system is too much of a resource hog?  (I'm not familiar enough with Linux to get into that, even though I thought that might be a good idea... but I don't have the time or know-how to learn linux, and my friend doesn't know it either).  Someone suggested I try to find a better keyboard driver?  But how would I go about searching for a "keyboard driver that can handle fast button pressing" driver?  I'm going to ask my friend if he can write out the program for use on JAVA for Windows 98, and see if it runs any better on a Windows 98 operating system?

Anybody got any ideas?  We've been working on this thing for a while now, and the problem is we have a deadline to get it done in just TWO MORE DAYS.  The game machine is built and done, the program is written and done... it just doesn't run efficiently enough, and we really need to figure out why.  I'm also really out of money, I can't afford to just go buy a 2.0Ghz or 3.0Ghz or so PC.  I also don't have the time to order any parts, they wont come in in time.  I was wondering if an ipac might get me around this problem (but again, I can't GET one in time).  I do have a HotRod arcade joystick that I use on my home PC, and a friend of mine suggested poaching the keyboard encoder from that and see if using that in my game might make it run better.

Any ideas are much appreciated, as I am under the gun.  We need to get this thing done and working up to snuff in just TWO more days.  Anybody run into a problem like this before?

Thank you very much.

Blanka

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2248
  • Last login:January 25, 2018, 03:19:28 pm
Re: need help speeding up keyboard
« Reply #1 on: May 26, 2008, 01:27:20 am »
Can Notepad for example keep up with your input? Can a simple program like this keep up with you?
I seriously think JAVA is the bottleneck, and not the keyboard. All keypresses end up in some buffer which has to be cleared by your program. A 1 Ghz Pentium with Java: thats a laugh!. Try a modern Core2Duo machine first. And maybe a USB device works different in this respect, but it is too late to test that I guess. Guess you spend too much time and money on the keyboardhack. The new USB budget solutions from Ultimarc like the MiniPAC and the IPacVE are cheaper than all the hassle with a keyboard.
First thing to try now: find a decent computer! Guess that is you best chance of surviving the gun.
« Last Edit: May 26, 2008, 01:30:14 am by Blanka »

EwJ

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 366
  • Last login:October 12, 2022, 10:16:06 pm
Re: need help speeding up keyboard
« Reply #2 on: May 26, 2008, 02:04:30 am »
Like Blanka said, try opening notepad and test how well it keeps up with the keypresses from your keyboard hack.  Try your keyboard hack on your friend's computer.  If it works fine in those instances, you've eliminated the hack as the problem.

You didn't mention how much resources(ram/cpu) it was using when running on your newer setup - the p3 - 1ghz.
You could try setting all unnecessary services to disabled (per Blackviper or other) and see if that helps.

Don't know much about java, or how it handles input....does your friend (the creator of this game)  not have any
ideas?
If you're really pressed for time, borrow your friend's computer that this all runs fine on.

In the unlikely event that it is your keyboard hack.....pm and email RandyT from GroovyGameGear and see if
he could overnight ship a Keywiz.....or Divemaster in the B/S/T thread for an Ipac.

Good luck!

bernard

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:July 06, 2009, 01:20:53 am
  • Captain 'Video Warriors': NH's Pro Video Game Team
    • Bernard's MAME machine
Re: need help speeding up keyboard
« Reply #3 on: May 27, 2008, 11:25:03 am »
Okay... I was in a rush to get the machine to where it was going before RAIN set in.  So I didn't get to test everything I wanted.  But I did test a couple key things.

First of all... still running on a Pentium 3, 1.0Ghz machine in Windows XP Home, running the Java program, I turned on the system monitor so I could see the CPU usage.  While running the program and pressing the arcade buttons as fast as I could, the CPU usage only got to about 20%.  This makes me think that the computer is fine, and the problem has nothing to do with the processor being inadequate.

Secondly... I ran Notepad on this machine, and pressed the arcade buttons as fast as I could so it would just type the letters mapped to the buttons, and it DEFINITELY did not seem to be displaying letters as fast as I was pressing.

This would all seem to indicate that the problem is something to do with the keyboard interface.  Whether it's the keyboard itself, keyboard drivers, the PS2 plug.  Could be anything, but it seems it's all about the keyboard interface.

We've got some things to test to see if we can get it worked out. 

1) I'm going to hook up my HotRod arcade PC joystick to the game and see what kind of results we get with that.  Apparently that has a decent keyboard encoder in it.  If needed we'll poach that part for use.  (although I'd hate to ruin the HotRod)

2) We're going to try testing it with a more modern keyboard (both PS2 and USB), and see if we can get button response faster.  I think this might really be the key.

Another friend of mine told me that he was researching our problem, and came across an article that said that a lot of OLDER keyboards did not work very fast.  Many OLD keyboards worked by sending a PULSE to the keyboard to check for keys being pressed, and it only pulsed at a rate of about 85 miliseconds!!!!  That's not very fast!  So again, this is another indicator that it might simply be that the keyboard is too old.

I don't have experience with hooking up wires to a regular modern keyboard.  I know you can't solder to the traces (believe me I've tried on controller pads and stuff, you only end up pulling the traces off the overlay).  I haven't tried fiddling with wires on the circuit board part of a modern keyboard, but I suppose we can give it a try.  If we can find enough combinations of wires to suit our needs, that will work.  But as far as just TESTING if a modern keyboard solves the problem.  I can have my friend simply HOLD the ends of the wires on the end of the individual key trace on the overlay, while we test the speed.  If it works... then problem solved (sort of) or at least problem IDENTIFIED and we'll have to figure out a way to secure wires to interface with the modern keyboard.

Anybody have any advice on doing that?

or any advice on anything else to try (again time is a factor).

I'm not against ordering an ipac or other device to use as a keyboard encoder... but I don't want to do that unless I know that it WILL in fact SOLVE the problem.  I'd hate to spend the extra money to buy one and get it overnight shipped, just to hook it up and have the same problem.

Thanks for the help!

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7014
  • Last login:Yesterday at 11:37:00 am
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: need help speeding up keyboard
« Reply #4 on: May 27, 2008, 03:07:34 pm »
I'm not against ordering an ipac or other device to use as a keyboard encoder... but I don't want to do that unless I know that it WILL in fact SOLVE the problem.  I'd hate to spend the extra money to buy one and get it overnight shipped, just to hook it up and have the same problem.

You are getting some good advice here.  Most dedicated encoders will get you a faster rate than a human can hammer on a button.  But the bottle neck can be in one or more of the areas you mentioned, and the only way you will absolutely know for sure what the issue is, is to to start substituting the individual elements one at a time until you see the results you need.  As you've found out, old keyboards were not meant for that kind of speed.  Just the switch debouncing times built into those things is probably a good chunk of the problem...even 100ms wouldn't surprise me.  After all, who types faster than 10cps?

RandyT

EwJ

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 366
  • Last login:October 12, 2022, 10:16:06 pm
Re: need help speeding up keyboard
« Reply #5 on: May 27, 2008, 06:14:24 pm »
If a modern ps2 keyboard works well and fixes all your problems, you would do well with a Keywiz or Ipac.(and wouldn't have to sacrifice your Hotrod).
You wouldn't have to go through all the trouble of a 'pseudo-hack' on the keyboard to test either, then a full hack later.
Just plug a newer keyboard in, if it works to your satisfaction, a Keywiz or Ipac will only be better. 
If you're in a hurry, pm and email Randy or Divemaster per previous post, and see if you have any options.

If usb works well and you can use gamepad input, a GPwiz would be a good choice.

Hacking a keyboard really isn't worth the hassle, and won't measure up in performance.

Good luck!  (Post your results).

Also, can you tell us about this game you have developed?

Turnarcades

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1973
  • Last login:May 13, 2017, 08:14:29 am
  • Craig @ Turnarcades
    • Turnarcades
Re: need help speeding up keyboard
« Reply #6 on: May 27, 2008, 08:08:20 pm »
I'm not against ordering an ipac or other device to use as a keyboard encoder... but I don't want to do that unless I know that it WILL in fact SOLVE the problem.  I'd hate to spend the extra money to buy one and get it overnight shipped, just to hook it up and have the same problem.

You are getting some good advice here.  Most dedicated encoders will get you a faster rate than a human can hammer on a button.  But the bottle neck can be in one or more of the areas you mentioned, and the only way you will absolutely know for sure what the issue is, is to to start substituting the individual elements one at a time until you see the results you need.  As you've found out, old keyboards were not meant for that kind of speed.  Just the switch debouncing times built into those things is probably a good chunk of the problem...even 100ms wouldn't surprise me.  After all, who types faster than 10cps?

RandyT


Good advice. The methods you used for your MAME arcade may have been sound years ago and though my knowledge of electronics and software is limited, I'd imagine there are a number of factors affecting this. If it were a pure emulation issue it would be easier to pin down (for example in MAME I had to turn triple buffering off on older PC's else I had a similar problem to you, even with a keyboard encoder) but as this game of yours is custom-written it's anyone's guess so may be up to your friend to resolve.

If it is the MAME and other platforms you play more, I'd ditch the old methods in favour of the newer solution of a keyboard encoder and whatever else you are doing the old way. The PC spec is fine though for emulation, take it from me P3's are sweet for the job.