Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Mouse and controller mappings for lightgun type game controllers for light gun shooter games? #171

Open
Hedda opened this issue Oct 7, 2022 · 30 comments

Comments

@Hedda
Copy link

Hedda commented Oct 7, 2022

Could the Controller Topology Project please also map mouse (X pointer) control + buttons from some of the now commonly available modern lightgun game controllers mapped to buttons on classic "light gun" game controllers for retro game emulation?

For reference, check out "Kodi Game" related community forum discussion -> https://forum.kodi.tv/showthread.php?tid=369577

Specifically would love it if you would consider adding peripheral add-ons and default controller profiles (mappings) to the Kodi Game platform for both modern and classic lightguns from the arcades and home video game consoles as well as a few of the newer and today commonly available light guns made-for-PC that use more modern technology which is compatible with LCD/OLED televisions and displays out-of-the-box.

With newer light guns available I am especially referring to the "Nintendo Wiimote" (Wii Remote with Wii Sensor Bar combination), as well as the new "Ultimarc Aimtrak Light Gun" and "Sinden Lightgun" that are both made-for-PC (or DIY arcades).

Some very nostalgic retro light gun accessories that are missing game controller addons with layout mappings are otherwise these; Wii Zapper for Nintendo Wii, NES Zapper, Super Scope (also known as the Nintendo Scope), Sega Light Phaser for Master System, Menacer for Sega Genesis / Sega Mega Drive, Dreamcast Gun for Sega Dreamcast, GunCon (a.k.a. G-Con) series of lightguns by Namco for the PlayStation 1/2/3, Sony PlayStation Move Sharp Shooter, Peacekeeper Revolver for Philips CD-i, Gamegun for 3DO Interactive Multiplayer, and the Atari XG-1, Trojan Light Phazer and Loriciel Phaser (West Phaser) light guns for the Atari ST, Actionware Phazerm and Golem light guns for the Commodore Amiga, as well as Magnum Light Phaser for Amstrad CPC which also had versions for the Sinclair ZX Spectrum, Commodore 64 and Commodore 128.

https://en.wikipedia.org/wiki/Light_gun

image image image image image image image image image image image

With lightguns, it would be possible to play some or all classic Lightgun Shooter games from both game consoles and the arcade.

https://en.wikipedia.org/wiki/Light_gun_shooter

https://en.wikipedia.org/wiki/List_of_gun_games

Lightgun video games have existed since the early 1980s, and today there are many lightgun-compatible games available to us.

Here is a short list of some of the most famous/popular "retro" Lightgun Shooter game classics titles that trigger a lot of nostalgia:

  • Duck Hunt
  • Wild Gunman
  • Hogan's Alley
  • Battle Clash
  • Super Scope 6
  • Yoshi's Safari
  • Resident Evil: The Darkside Chronicles / The Umbrella Chronicles / Dead Aim / Survivor 2 – Code: Veronica
  • Time Crisis 1/2/3
  • House Of The Dead 1/2/3/4/Overkill
  • Virtua Cop 1/2/3
  • Die Hard 2: Die Harder
  • Point Blank 1/2/3 (also known as "Gun Bullet" or "Gunvari", made by Namco)
  • Terminator 2 Arcade
  • Star Wars Trilogy
  • Jurassic Park: Lost World
  • Silent Scope / II / EX
  • Area 51 / Site 4 / Maximum Force Duo
  • The Maze Of The Kings (by Sega)
  • Operation Wolf
  • Lethal Enforcers / II: Gunfighters / 3
  • Big Buck Hunter / II Sportsman's Paradise / Pro / Pro Open Season / Shooter's Challenge
  • Mad Dog McCree / II: The Lost Gold
  • Ranger Mission (Atomisave)
  • Operation Thunderbolt (by Taito)
  • And many many more lightgun games from the arcades.

As you probably know, the Nintendo Wiimote + Wii Sensor Bar combination is a relatively popular hardware choice to achieve an inexpensive wireless lightgun for emulators on PC computers, as a bonus there are loads of different Zapper Gun holder accessories for the Nintendo Wiimote, though it should be noted that Wiimote is not as fast/good as a modern light gun when only combined with a standard Wii Sensor Bar.

https://www.instructables.com/Accurate-Wiimote-Light-Gun-on-Raspberry-PI/

Today there are also multiple other light guns options that were made for, and unlike classic lightguns which only works on CRT monitors these newer lightguns work with modern LCD/OLED displays by using some different technologies:

Check out for example; "Ultimarc Aimtrak Light Gun", "Sinden Lightgun", and "PDP Mars Lightgun" ("PDPMars) lightguns:

image

image

image

@Hedda
Copy link
Author

Hedda commented Jan 31, 2023

Going DIY extreme; the "GUN4IR" by JB / JB Lab (Jean-Baptiste Bongrand (a.k.a. JayBee-git on GitHub) sounds based on many reviews like it is currently the most customizable and high-performance lightgun system for arcade experience at home with a concept based around the idea of retrofitting old lightguns with new electronics and software in the form of a DIY hardware or kit(s) with upgraded hardware and (closed source) software/firmware.

https://www.gun4ir.com

https://discord.gg/HJyfYja

http://forum.arcadecontrols.com/index.php/topic,161189.0.html

https://www.facebook.com/groups/903631730390946/

For the DIY kit version it looks like he basically sells a DIY hardware kit and include build instructions and the firmware + software?

https://www.youtube.com/watch?v=QPmmFR3bBMw&ab_channel=RetroRalph

https://www.youtube.com/watch?v=WXq_GDR5yP0&t=1s&ab_channel=RetroRalph

https://www.youtube.com/watch?v=CXjWhmYP2TI&ab_channel=ArcadePirate

It looks like GUN4IR is currently primarily a DIY-project where you should make a donation of at least $20(US) to JB to get the software/firmware then you need to buy + assemble all the parts yourself, however, it is also being sold preassembled by JB at gun4ir.com as well as sold by third parties in various ”premium variants” (including existing lightguns modded with the GUN4IR solution) + semi-assembled DIY-kits for Gun4IR can also be bought from JB's inofficial partners, like for example [Raymond Dai (a.k.a. Ray) from RPEG Electronics:

https://rpegelectronics.com/collections/arcade-stuff

https://rpegelectronics.com/products/gun4ir-diy-mod-kit

Reviews:

https://main.retro-handhelds.com/blog/a-brief-look-at-the-gun4ir-light-gun/

https://www.youtube.com/watch?v=_m9a4nj1MYw&ab_channel=WickedGamer%26Collector

GUN4IR hardware is closed source but sofytware is open, though availability for buying the DIY kit version seems scarce since only manufactured in samller batches

http://forum.arcadecontrols.com/index.php/topic,161189.0.html

https://discord.gg/HJyfYja

He also partners with some othes to sell pre-modded GUN4IR lightguns, like example

https://rpegelectronics.com/products/gun4ir-light-gun-ready-to-play-namco-gcon45-black?variant=40080266461373

https://rpegelectronics.com/products/gun4ir-light-gun-ready-to-play-namco-gcon-2-black

PS: GUN4IR is made by Jean-Baptiste Bongrand (a.k.a. JayBee) who also makes some other open-source stuff so maybe that will change in the future(?)

https://github.com/JayBee-git

@garbear
Copy link
Member

garbear commented Feb 1, 2023

I love supporting independent projects like GUN4IR! X-Arcade sent me a Tankstick for free and I feel bad it took 2 years to finish the driver. GUN4IR is something I would looooove to buy and get working in Kodi, but I just don't have time these days. Life changes though, and someday I may be able to support projects like this.

@Hedda
Copy link
Author

Hedda commented Feb 1, 2023

I love supporting independent projects like GUN4IR!

@JayBee-git maybe you would consider looking into coding a GUN4IR compatible implementation for Kodi’s native game framework support yourself?

I noticed that you submitted C++ code for adding native Gun4IR lightgun input support for MiSTer so you clearly have the needed coding skills -> MiSTer-devel/Main_MiSTer#633

For reference if you have not heard about Kodi (formely XBMC) and its native game support with ”RetroPlayer” (using Libreteo), read:

https://kodi.wiki/view/Game_development

https://kodi.wiki/view/Game_controllers

https://forum.kodi.tv/showthread.php?tid=292270

https://forum.kodi.tv/showthread.php?tid=195552

https://forum.kodi.tv/showthread.php?tid=257764

https://forum.kodi.tv/showthread.php?tid=230276

https://forum.kodi.tv/showthread.php?tid=252465

https://forum.kodi.tv/showthread.php?tid=164725

https://forum.kodi.tv/showthread.php?tid=340684

@garbear
Copy link
Member

garbear commented Feb 1, 2023

And @JayBee-git if you're interested in writing a Kodi driver you have my full support and code review!

@JayBee-git
Copy link

Hey, I'd gladly help if I can.
But for the MiSTer it was very easy, as they already had a driver and everything in place to support lightguns. It was only a few lines of code to add.
Lightgun inputs are nothing more than generic mouse, keyboard and joystick inputs, so as long as you have a generic driver that supports any of these, it should be quite easy to add. The only thing special compared to normal inputs is that they are using absolute axis for the mouse input instead of relative.
I'm not sure what was implemented already in Kodi, but I sadly don't have any knowledge on how libretro drivers work and how to code them.
If you need any info on how the lightgun inputs work tho, feel free to ask me.

@garbear
Copy link
Member

garbear commented Feb 2, 2023

Oh no! Mouse and keyboard controlling joystick games is a feature we're missing. I implemented this once but had to remove it to simplify the system.

I plan to bring the feature back in a "Player Manager". You can see the saga here: garbear/xbmc#87

Most of the code is in place, we just don't have the final step that converts the input because we don't have a way to map it in the UI.

However, I was able to get the tankstick to work by reading the key presses from Linux and then sending joystick buttons. That work is here: https://github.com/kodi-game/peripheral.xarcade/

You could do the same for keyboard and mouse input, get it directly from Linux in a small peripheral add-on. It would only work on Linux but that covers the whole LibreELEC community which is huge.

@JayBee-git
Copy link

The gun also work in a joystick input mode, the one that is used by MiSTer. You can map games lightgun axis to the joystick input axis directly.

@garbear
Copy link
Member

garbear commented Feb 2, 2023

Can you hook it up and try mapping it in Kodi?

@JayBee-git
Copy link

Sure, which version do you want me to try out?

@garbear
Copy link
Member

garbear commented Feb 2, 2023

Version 20.0. I actually merged a little bit of the player manager into v20. Baby steps.

@JayBee-git
Copy link

I meant which OS, machine, and where to get it?
I know Kodi but I never used Kodi game 😄

@garbear
Copy link
Member

garbear commented Feb 2, 2023

Its built into Kodi so games should work everywhere that has emulators in the addon browser

@Hedda
Copy link
Author

Hedda commented Feb 2, 2023

@JayBee-git FYI, Kodi RetroPlayer (i.e. Kodi Game,) runs on most operating systems, processor Instruction set architectures and computer platforms available today, however, I believe that for development purposes it is best to use an Intel/AMD x86-64 based computer with either Linux or Windows operating system (depending on your personal OS preference to code on as a developer).

Links and information on where to download and how to install Kodi 20.x (codename "Nexus") releases can be found here:

Alternatively, you could get garbear's very latest custom test releases if just want to test out all the existing features:

Here is a guide on how to get started with Kodi RetroPlayer:

Libretro emulator cores are available as "game clients" add-ons, and controller-mappings are available as "Controller profiles":

Also check out the Kodi wiki section on how Games and game development work in Kodi here:

PS: If you used Kodi from an end-users perspective then you will notice that Kodi's GUI is missing a games-library (and database).

@Hedda
Copy link
Author

Hedda commented Feb 2, 2023

@JayBee-git Oh, and may I be so bold as to ask if you would consider donating some sample Gun4IR hardware to @garbear?

Thinking that even if he does not have time to implement this himself right now, if he at least has the hardware at home might be the incentive he needs to motivate prioritizing lightgun support (as well as mouse and keyboard) when he does get some time ;)

@JayBee-git
Copy link

@Hedda Yes, actually I do have kodi already installed on most of my machines :)
My bad, I was thinking Kodi Game was a fork not an addon.
I will test it out when I have the time, and tell you how it went.

About the donation of a gun, it's important to note that I'm not a company or anything (yet), just working on this diy oriented system on my free time. I only do very occasional pre modded gun productions myself (only did one so far), and all the money I get from the small donations is used in gun4ir related expenses.
So, long story short, I sadly don't have the funds to send a free 200$ gifts to devs.

@JayBee-git
Copy link

That being said I'd happy to help if any of you want to build a gun4ir, and I'll help any way I can.
It's fun to bring back gaming to Kodi, reminds me of the good old xbmc days on the og xbox.

@Hedda
Copy link
Author

Hedda commented Feb 2, 2023

My bad, I was thinking Kodi Game was a fork not an addon.

Not quite, it is not just an add-on and it is a little more complicated than that ;)

Just to try to summerize; "Game API" (with "Kodi RetroPlayer" + "Game Clients" + "Libretro Wrapper") and "Hardware API" (with "Input Devices" + "controller profiles") is now natively integrated subsystems inside the upstream mainline Kodi codebase at https://github.com/xbmc/xbmc/

"Kodi Game" is more an internal/ informal umbrella name for all Kodi game-related extensions that are able to extend the native features and functions, and that part does include official add-ons such "game clients" and "controller profiles". So "Kodi Game" is not add-on itself, though several add-ons are part of the "Kodi Game" platform.

https://github.com/orgs/kodi-game/repositories

garbear does a better job at explaining in this forums thread where he also drawn a diagram how it all fits togther inside Kodi:

https://forum.kodi.tv/showthread.php?tid=195552

image

"this is the current layout of the retroplayer project. it is centered around two APIs, the Game API (connects retroplayer to game clients) and the Hardware API (connects game clients to input). the Hardware API moves all of the joystick code out of XBMC and into binary add-ons."

"Surprisingly this design has held up quite well. The biggest difference is I never developed the Hardware API past input devices. The other notable change, not reflected in the diagram, is that the big "RetroPlayer" box has been entirely rewritten from scratch to support shaders in GSoC 2017."

There is also a summarized overview in the official Kodi wiki here:

https://kodi.wiki/view/Game_development

PS: By now natively supporting Libretro game emulator cores via a libretro wrapper (libretro API), Kodi is part of a larger libretro software ecosystem that enables retro gaming which several different independent software projects make use of by Libretro game emulator cores (this is the same Libretro game emulator cores used in RetroArch, Lakka, RetroPie, Recalbox, and more):

https://www.libretro.com/index.php/api/

https://forum.kodi.tv/showthread.php?tid=292270

@garbear
Copy link
Member

garbear commented Feb 2, 2023

@JayBee-git I'll make you a deal. If you can get the lightgun working enough in Kodi I'll buy the best model you got 🙂

@JayBee-git
Copy link

@JayBee-git I'll make you a deal. If you can get the lightgun working enough in Kodi I'll buy the best model you got 🙂

You do realize I have nothing to sell myself, right?
As I said my system is first and foremost a DIY system, if you want to support it, you can easily build it 😉

And also, even if I wanted, making a libretro driver isn't something I can do like this out of the blue, it's not my field at all, unless lightgun support has already been fully implemented by the devs.

Plus there are many questions that need to be asked before even considering adding it. How are input handled in the hardware API exactly (direct raw hid? through the OS generic joypad/mouse hid input? Through kodi own input layer?)? What are the emulated input types (not the hardware side) supported inside kodi libretro at the moment? How is the measured latency added by the API? Does any of the cores ported have support for lightgun?

I'll test it out when I have time, and see what I can do, but I can't make any promises.

@garbear
Copy link
Member

garbear commented Feb 7, 2023

You do realize I have nothing to sell myself, right?

I saw the pre-modded GUN4IR sets in the shop. Are those the model you're trying to get working in Kodi, or is it your DIY kit?

I see what you're saying though, it's still early days.

How are input handled in the hardware API exactly (direct raw hid? through the OS generic joypad/mouse hid input? Through kodi own input layer?)?

Interfacing with input APIs is all what the peripheral.joystick add-on is about. The history:

Early in Kodi's history, massive amounts of duplication and dependency spew that had organically emerged were slowing down the project, so I moved all input APIs into the add-on. It wasn't ideal, because add-ons are supposed to be optional now we have a "mandatory" add-on. However, it encapsulated all input APIs and got them out of core, so I considered it a win.

You can see all the input APIs in the build file.

Currently this list includes:

  • SDL2 (but only on the SteamLink, an abandoned port)
  • Cocoa
  • Linux Joystick API
  • DirectInput
  • XInput
  • udev

Because the input APIs of Android, iOS and tvOS have the much heavier entire platform as a dependency, they've been implemented in core instead of the add-on.

The next question is, what are all the USB/otherwise protocols that the hardware supports?

@garbear
Copy link
Member

garbear commented Feb 8, 2023

I added Lightgun Support as a GSoC 2023 project, in case a student out there wants to work on getting Lightguns working over the summer: https://kodi.wiki/view/Google_Summer_of_Code/2023#Lightgun_support

@JayBee-git
Copy link

JayBee-git commented Feb 8, 2023

I saw the pre-modded GUN4IR sets in the shop. Are those the model you're trying to get working in Kodi, or is it your DIY kit?

To quote myself from my previous message:

About the donation of a gun, it's important to note that I'm not a company or anything (yet), just working on this diy oriented system on my free time. I only do very occasional pre modded gun productions myself (only did one so far), and all the money I get from the small donations is used in gun4ir related expenses.

To sum up, I rarely have anything to sell, and when I do, it's in very limited stock, and the price I have is just enough to cut my loss. I only do sales for my community, not to make money, as strange as it might sound. So while I appreciate the offering to buy my gun, these are specifically made for users that really want to use my system but don't have the skills to build it themselves. Selling you a premodded lightgun that I am not sure you'll even use, would be taking one away from someone else who really needs it ;)
All Gun4IR lightguns are pretty much the same as the DIY, there is only one Gun4IR system so far.

I see what you're saying though, it's still early days.

Not really, I have been doing that for 3 years now. And the gun is pretty much plug and play on most systems already (windows, linux, retropie, mister...). But again, on the hardware side the Gun4IR is still a DIY system only, not a commercial product yet.

Currently this list includes:

  • SDL2 (but only on the SteamLink, an abandoned port)
  • Cocoa
  • Linux Joystick API
  • DirectInput
  • XInput
  • udev

Because the input APIs of Android, iOS and tvOS have the much heavier entire platform as a dependency, they've been implemented in core instead of the add-on.

Cool, then you already have everything needed to make the gun work 😄

The next question is, what are all the USB/otherwise protocols that the hardware supports?

I will quote myself again;

Lightgun inputs are nothing more than generic mouse, keyboard and joystick inputs

and

The gun also work in a joystick input mode, the one that is used by MiSTer. You can map games lightgun axis to the joystick input axis directly.

There is nothing special about lightgun inputs, if your system cores and emulated input system already support lightguns with analog stick axis or absolute mouse axis, it will just work out of the box. You can test it out by yourself without lightguns, by mapping any dinput/xinput analog stick to the lightgun axis. If that works, my lightgun will also work.

@Hedda
Copy link
Author

Hedda commented Feb 8, 2023

I added Lightgun Support as a GSoC 2023 project, in case a student out there wants to work on getting Lightguns working over the summer: https://kodi.wiki/view/Google_Summer_of_Code/2023#Lightgun_support

@garbear not that I have the skills to program that myself but for reference wondering if the code for different lightguns should preferably go into the main peripheral.joystick driver project at https://github.com/xbmc/peripheral.joystick or into a separate driver like the X-Arcade Tankstick driver project? https://github.com/kodi-game/peripheral.xarcade or somewhere else?

@Hedda
Copy link
Author

Hedda commented Feb 8, 2023

for the MiSTer it was very easy, as they already had a driver and everything in place to support lightguns. It was only a few lines of code to add.

@garbear Oh, and I guess that the input code from MiSTer would be of no help? https://github.com/MiSTer-devel/Main_MiSTer

@Hedda
Copy link
Author

Hedda commented Jun 1, 2023

Tip; here is a "Lightguns" YouTube playlist by Retro Ralph who reviews Lightgun hardware (and games) for retro game emulation:

https://www.youtube.com/watch?v=QPmmFR3bBMw&list=PLH48XsrRH8eFxozpHSYaI4iBZsIbFuKLq&ab_channel=RetroRalph

@Hedda
Copy link
Author

Hedda commented Jul 18, 2023

FYI, just watched this video from Retro Ralph about a new low-cost lightgun product called "Retro Shooter" (or "RetroShooter"):

https://www.youtube.com/watch?v=J_Gp5HtfsA0&ab_channel=RetroRalph

"Retro Shooter" (model "RS-5"/"RS5") is a new lightgun hardware primarily meant as a plug-and-play solution for Pandora Box.

https://retroshooter.com

https://retroshooter.com/checkout-10th5/

image

Interestingly by the sounds of their back-story they have similar thoughts on the topic of lightgun games as discussed above.

https://retroshooter.com/back-story/

https://www.youtube.com/@theretroshooter

Produced in partnership/collaboration with the people behind Pandora Box, it is brand new and currently only ships bundled with a new closed-source Pandora Box based emulation console, but it does also come with a USB breakout-hub ("Fire Base" for the Pandora Box 10), which unfortunately is not yet available and will be sold separately at a later date, but if and when they release a guns-only package with only lightguns, pedals and infrared-sensors + a USB breakout-hub instead of the full bundle with a console wondering if drivers for these lightguns could be reverse-engineered so could be used on all computers with any emulator?

UPDATE! The "Fire Base" USB breakout-hub with lightguns and pedals is now available to buy without the Pandora console, but with the disclaimer that the USB breakout-hub is officially only compatible with the 10th edition of the Pandora Box. I understand that the USB breakout-hub is really more or less just a USB-hub with a built-in USB soundcard as it seems like the rumble/vibration effect is taken via audio output and the paddle presses are taken via audio input. I also read that someone tried to connect one of the lightgun directly to a computer and it did show up as an unknown HID device so can assume that it probably works as a mouse,

https://retroshooter.com/checkout-10th5/

image

image

image

image

image

@Hedda
Copy link
Author

Hedda commented Jul 18, 2023

@garbear as I have been on vacation I missed that actually got a reply mail from Andy Sinden (CEO and Founder at Sinden Technology of Sinden Lightgun) a couple of weeks ago saying that he be willing to send you some hardware samples of the Sinden Lightgun and that he is also happy to help you with any requirements for building the software parts if you are interested. You can e-mail him directly at [email protected] and reference this discussion.

@Hedda
Copy link
Author

Hedda commented Jul 20, 2023

@garbear I now also got a quick reply from The Retro Shooter Team via mail who as well wrote that such interest was very well received and that they would very much like to get in contact with you to send you some hardware samples of the new Retro Shooter lightguns. I did not have your e-mail to give them so you must e-mail them directly at [email protected] and reference this discussion if you are interested.

@garbear
Copy link
Member

garbear commented Jul 20, 2023

Sorry, I'm gonna have to decline the offer. My wrist started acting up and I'm trying to limit computer time. Lightgun support would be cool but I just can't put in the computer time like I used to.

@Hedda
Copy link
Author

Hedda commented Jul 21, 2023

Ah, that is sad, hope that you get better soon.

Maybe some other takers from Team Kodi?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants