Hi everybody, first of all i don't want to discourage anybody from trying their own solution for vpinball, any contribution is always welcome and so this will give a chance to everybody to choose one wao or another for making their own virtual pinball.
Said that, i want to tell everybody a few things to make clear what could be achieved either with arduino or ledwiz systems.
The stuttering problem is not a problem about your computer, having a top notch system wouldn't save you from suffering stuttering when using external hardware. Fist of all is the way how vpinball works, vpinball uses a main loop for synchronizing with pinmame wich controls all the rom events. This means that vpinball does not stay sincronized with rom events altought you have this illusion because the timer fires many times per second. Ledwiz system also uses its own timer to check out rom events, latest versions of the script included a variable to adjust this time to suit your needs.
When the timer its fired the script does the job of checking the light states and so and send the instructions to ledwiz, the script sends just one command to the ledwiz for all the outputs (32) this is the fastest way to do it instead of setting each out individually.
Here is the problem, this command does the jod synchronously , this means that the script does not pass control to the next instruction until ledwiz has finished his job so the script have to wait for ledwiz to end.
Current ledwiz dll and ocx works synchronously, and that's the real problem for stuttering, if you want to avoid stuttering with arduino or other hardware you have to implement a asynchronous comunication something like this:
if arduino is busy wait for it
if arduino is not busy, send instructions asyncronously and let the
rest flow normally
Hopefully when the next timer event fires arduino will have finished doing its things and you don't have to wait for it but you have to make sure its not busy before sending instructions again or you'll hang it in a eternal loop causing the whole thing to freeze
That's the only solution i now that could make any real improvement to the virtual pinball lightning system. Because you don't stop the script too much waiting for the hardware to finish its things, you're letting the hardware work while you're are letting vpinball things to happen.
Other facts you'l have to take into consideration.
Arduino uses serial protocol (altought it connects trought and usb cable) , its serial standard comunication emulated, but the communication speed is the same, make sure you use the fastest baudrate but keep in mind that serial protocol is slow by nature.
From what I know arduino i/o is not the fastest thing in the world and their standard libraries slown down i/o output a lot, there are some direct hardware implementation for accesing the i/o of arduino on the web wich are a lot faster than the default ones make sure you use it too.