Main > Lightguns

IR-GUN4ALL - Enhanced Arduino-powered DIY 4-Point IR Lightgun System

(1/7) > >>

And the reward for the longest mouthful of a topic title goes to...
The IR-GUN4ALL Project
The Open-source lightgun system with All the features
I've already mentioned this a few times in the SAMCO thread, as this is a fork of the already-enhanced fork by Prow7. But I felt it was special and distanced enough from the original to deserve its own thread.
So, let's cut to the gist of this then, shall we?
* Full force-feedback support! From solenoids with single-shot/3-shot burst/rapid fire modes and TMP36 temperature monitoring support, to rumble motors with variable strength for off-screen feedback (with optional alternative rumble-based force feedback soon).
* Full customization at runtime, from the board's USB identifier, to settings like rumble/solenoid intensity, to even the board's mapping of what pins are attached to what buttons/devices, is all saved to the board's flash and loaded at boot--just flash once per-update, and enjoy unlimited possibilities!

* Optimizations for low-button gun cases! Features like pressing buttons offscreen to perform different functions, and an optional scrolling simple pause menu, makes even two or one-aux-button guns versatile! Virtua Gun and vanilla GunCon 1 owners, rejoice!

* Supports for both hardware toggles with physical switches (if any), and additional software toggles for each added feature in the gun's integrated Pause Mode (Button C + Select by default).
* Uses a four-point, top & bottom, double-IR lightbar arrangement (the very same added by Samco then tweaked by Prow7) for very accurate line-of-sight aiming from most angles and extremely quick tracking (theoretically <4-8ms click-to-click, ~5ms camera updates).

* Fully cross-platform solution, no reliance on a proprietary Windows-only GUI or any dev environment for initial setup; just use the GUN4ALL-GUI for your platform of choice!
* On-board three-click calibration, up to four selectable profiles, and configurations saved dynamically to the board; literally save once per-display and never have to recalibrate, even after reflashing!

* Streamlined setup by removing dependence on dev IDEs! Drop the UF2 file onto your microcontroller, and you're using GUN4ALL! The GUI app takes care of all your custom mapping, naming, setting, and testing needs from there!

* Fixed a number of legacy quirks and bugs. EEPROM saving on RP2040? Fixed. Keyboard buttons sticking? Doneso.
* Primarily aimed at and optimized for the RP2040 (a.k.a. the Raspberry Pi Pico), with an optional dual core processing mode for (theoretically) faster input handling, while still maintaining compatibility with Cortex M0's and M4-based microcontrollers. (Only requirements are Arduino compatibility and TinyUSB support!)
* MAMEHOOKER support! Serial communications can signal the gun to hand off control of its peripherals seamlessly for event-aware feedback (if available).You can see an early version of the system demonstrated here, though keep in mind that it's somewhat old and doesn't represent all of the various features of the system as it is now.
I'll be updating the demonstration soon!

It is fully compatible with pre-existing SAMCO builds, assuming you make use of the custom pins feature in v4.0 onwards!
I may or may not have spent an unreasonable amount of time working on this as my first big coding project for the past few weeks, but I do genuinely hope that it brings some people enjoyment.
If nothing else, it's at least the most fully featured open-source lightgun system available

Which forms of payment do you accept for a $35 license to use GUN4ALL?


--- Quote from: ZTylerDurden717 on November 13, 2023, 10:32:42 am ---Which forms of payment do you accept for a $35 license to use GUN4ALL?

--- End quote ---
Uh. . .


Honestly, Prow7 probably deserves more credit for making the basis of this hackfest to begin with - and by extension Samco's work, so I'd rather they get appreciation too! I just decided to work on top of their stuff and integrate the things I personally wanted.

Though if you'd still like to donate, which is also linked in the repo readme, I have a Ko-fi. I'm more of a YouTube video creator and editor by trade, which is what it's mainly for, but I don't mind if people somehow think my hobbyist crap is worth something!

Hey-hey-hey! Sort of an update here regarding some things coming soon!

Firstly, I've slammed my head against a wall slowly, carefully chipped away at the MAMEHOOKER support to at least mitigate the board crashing in serial handoff mode--if not (hopefully) fix it entirely. And I think I've finally figured what may have been causing crashes.
Now, I can't just play Haunted Museum fifty times over to check this and make sure (trust me, I'm way more familiar with that game now than I'd ever cared to be before this), as I've other obligations to deal with and this project is simply a hobby. I just know that I've been able to play half of Virtua Cop and a whole playthrough of HM1 without the board hanging in one sitting.
But if there is anyone still on the fence, or just want to help, I would be incredibly grateful if people check out the latest code from the GitHub repo directly and test it out to make sure that it does, in fact, work!
Of course, since MAMEHOOKER is still technically experimental, you'll have to uncomment (remove //)
--- Code: ---  // Uncomment this to enable (currently experimental) MAMEHOOKER support, or leave commented out to disable references to serial reading and only use it for debugging.
  // WARNING: Has a chance to CRASH on prolonged play sessions (at least on RP2040) - only enable for now if debugging!
//#define MAMEHOOKER
--- End code ---
(and actually have a Solenoid or rumble motor installed in your gun build, with the pins defined adjusted as needed).
Adjacent to the topic of serial stuff, I also finished the RGB LED code - though this only affects a board's builtin LED atm (as is on the Adafruit boards I use as reference), when serial handoff mode is activated, the LED will now react to fixed values (set by .1.y, y = value) and pulse values (set by .2.y, y = amount of pulses requested). I'm not sure if LED pulses are supposed to be additive--I.E. do we pulse the singular RGB bulb with all the values combined?--or individual colors only, so pulses will use the latter for now (it was just easier to do it that way, but if that's technically not correct, I can change it to additive at a later point). So we pretty much functionally support all the needed and commonly used commands that mamehook configs should as GUN4IR.

Aside from work on that, I've also made it much easier to redefine the USB ID for each gun, and to change the keyboard button maps for individual players - the first being a set of defines that should be plainly obvious if you look at the beginning of the sketch's configuration area:
--- Code: ---  // Here we define the Manufacturer Name/Device Name/PID:VID of the gun as will be displayed by the operating system.
  // For multiplayer, different guns need different IDs!
  // If confused or if only using one gun, just leave these at their defaults!
#define DEVICE_VID 0x0920
#define DEVICE_PID 0x1998
--- End code ---

and the latter is set with:
--- Code: ---  // Set what player this board is mapped to (1-4). This will change keyboard mappings appropriate for the respective player.
  // If unsure, just leave this at 1.
--- End code ---
I realize I neglected to mention in the OP, but multiplayer does in fact work with this system - just change the above bits accordingly now!
These are not in a currently tagged release yet, but as soon as I can confirm that Mamehook is stable enough to remove the experimental tag on, you can bet there will be a more formal release soon!
I've also been asked in private about changing the LED layout (to use GUN4IR's). While that would be really neat to have and certainly make it easier to be used in place of/alongside it (though still not be a drop-in replacement necessarily, noting the different board requirement), the camera bits are by no means my field of expertise, so don't expect the rectangular arrangement to change anytime soon. But, because open source, anyone could theoretically send a pull request if they figure that out and I'd happily accept that (assuming it works and doesn't make tracking any worse, anyways, lol)!

Merry Thanksmas!
assuming you celebrate this American holiday, anyways.

In the spirit of the season (or the one coming soon thereafter), I've stamped another update (v2.1) for your perusal!
This version, among other things like more easily set player slots through a single value and the finishing of LED pulsing in serial handoff mode, has found the root cause of the MAMEHOOKER crashes to be a bug in the TinyUSB stack we use! As far as I can tell, this is a bug unique to the RP2040 with TinyUSB specifically. So in the meantime, I'm providing a patched version of the Raspberry Pi Pico/RP2040 core until this has been resolved upstream*. Details are in the release notes and the enclosed instruction book, as always.

*it's possible that it still might lock up, but in my testing at least it's been significantly reduced, as far as I can tell anyways. But please report back if you do still run into issues!


[0] Message Index

[#] Next page

Go to full version