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: HDRecoil (formerly node-game-outputs for Gun4IR), High Definition Gun Feedback  (Read 5143 times)

0 Members and 1 Guest are viewing this topic.

nugarp

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 289
  • Last login:November 27, 2024, 02:09:25 pm
  • I want to build my own arcade controls!
Hey guys,

First, a video demo of why HDRecoil should (hopefully) blow your socks off: https://youtube.com/shorts/zNTXS3O8n8Q?feature=share (sound on!)

Today I am releasing the first public version of HDRecoil (formerly node-game-outputs for GUN4IR). HDRecoil is a platform that either replaces or sits alongside your existing Mamehooker outputs to truly bring a next-level experience to anyone with Gun4IR guns who have solenoid and/or rumble features. Imagine having different recoil frequencies, different rumble strengths depending on the gun you are using or the events taking place in a game (bullet firing, health damage, reload, etc.). For the best experience, I recommend a good solenoid and rumble motors. I HIGHLY suggest you try out Jurassic Park Arcade (TP) and Time Crisis 5 (via TP) to understand the full power of this software and framework!

The motivation for this software is quite simple - in games, you may get output for hit damage, or gunfire - but just getting a rumble or a recoil shot isn't sufficiently immersive, and it would be very difficult to write rules to get standard outputs in an immersive way. Further, in games with rapidfire, just following fixed-interval updates can lead to slight variations in recoil frequency, which annoyed me quite a bit. And finally, because we're able to read memory addresses with this framework, myself (and hopefully others!!) can develop plugins for games that never had recoil -- such as Point Blank (I have included a beta that only sometimes works in the 32-bit mame...that's why it's a beta). Please note that you will need a reasonably OK processor to run this well - in order to get rapidfire timings within 1-2ms, I had to use a NanoTimer library that will absolutely cycle a core for short intervals. Also, the software is Windows-only.

HDRecoil is written in such a way that, in the best possible scenario, we are not looking at raw outputs. Instead, we are reading memory addresses and determining when EVENTS are detected (gun fire, weapon reload, hit damage) - these events should be ADDITIVE. You can fire a gun at t=1s, get hit at t=1.1s, and both effects should be added - not one replacing the other. The software, using a wrapper called device.js, is able to provide a wrapper for the native Gun4IR serial commands that allow you to abstract out things with methods like (from the device.js file):
Code: [Select]
// The meat of this file -- a serial/gun4ir device
// it exposes many helpful methods for plugins:
//
// RECOIL:
// setAutofireTimings(hold = 35, pause = 35)
// startAutofire(length = 70). if length is not specified, pause and hold will be used from setAutofireTimmings
                            // if length is specified, then hold = pause = ~0.5x length
// stopAutofire()
// fireRecoil(pulses = 0);
//
// RUMBLE:
// startRumblePulsingEffect(effect name, strength = 255, on = 50, off = 50) durations are in ms
// stopRumblePulsingEffect(effect name)
// setRumbleEffect(effect name, strength = 255, duration = 0) duration is in ms, 0 is inf.
//
// MISC:
// sendAction(string) to send your own custom action over COM.

Further, I wanted it to be easy for myself, and for others, to adapt their needs easily with code that does not need to be compiled - and for this reason, I have written the software (almost) completely in NodeJS (aside from some helper library/exes). Your solenoid doesn't fire rapidly enough for the preset plugins (1 game = 1 plugin)? Just go ahead and adjust the timings in the game's plugin javascript file. You want to also make a REST call to some other service when events occur? Just use the axios library (see webdevice.js for an example wrapper).

The software works in two ways:
1) By reading memory addresses to determine when weapons are fired (and which weapon) & hit damage
2) By reading outputs from mamehooker-compatible software (such as demulshooter) - in fact, I have included two custom plugins you can use for demulshooter-generic and demulshooter-custom outputs that are probably pretty well ready-to-go out of the box!

To start off, I have included the following plugins with the v0.2.0b download:
Code: [Select]
- 5 that directly read game memory
-- House of the Dead 4 (tested with TP, outputs don't need to be enabled)
-- Jurassic Park Arcade (TP)
-- Terminator Salvation (TP)
-- Time Crisis 5 (recommend running with TP, outputs don't need to be enabled though, see notes in js file) ** You may need to enable the prelaunch option **
-- The Lost World (model 3 - the game has no outputs so we create them ourselves!)

- 2 WIP/beta plugins (that read game memory)
-- Point Blank for MAME (it may take some time for it to be able to find the addresses for firing, but once it is hooked, it will work)
-- Deadstorm Pirates (Arcade) for RPCS357/Project Omed (rpcs3-gun.exe, needs further testing)

- 6 that use MAMEHooker outputs
-- LA Machineguns uses model 3's native outputs engine (run supermodel.exe with -outputs=win)
-- Transformers Human Alliance uses DemulShooter's outputs (if you don't want DS for inputs, run DS with -noinput)
-- Operation GHOST uses TP/Output Blaster's outputs
-- Let's Go Island 3D uses TP/Output Blaster's outputs
-- Rabbids Hollywood Arcade uses DemulShooter's custom outputs (game has no native recoil)
-- As above, you can use either of 2 "Generic" Mamehooker output handlers via Demulshooter's outputs to run (run DemulShooter with -noinput if you don't need DS's inputs):
--- Confidential Mission (although demulshooter has the wrong output address for p2 ammo)
--- House of the Dead
--- House of the Dead 2
--- House of the Dead SD (untested)
--- Sega Golden Gun
--- Virtua Cop 2
--- Virtua Cop 3 (In theory, but I couldn't get this to work)
--- Gunblade NY
--- (you can add more that use the generic demulshooter plugin by adding the romname to config/config.json)
---- For using DS's custom outputs, use demulshooter-custom.js, for generic outputs, use demulshooter-generic.js
---- To leverage Demulshooter's outputs, all you literally have to do is pick which outputs file you want and
---- add an entry to the config.json file so this software can recognize which plugin to use and detect when the game is
---- launched.

- 1 plugin for testing your setup
-- Open Notepad and see if your gun(s) rumble.

Requirements:
Code: [Select]
- NodeJS - any version - versions v14.17.0 and later tested. When installing NodeJS, you will need to check the box that says to install visual studio build tools!
- after installing node, run install.bat (this will pull dependencies from npm and also build the nodejs<->mem reader library)
- after running install.bat, run start.bat. start.bat will run both the interop and the actual node-game-outputs plugin software.
- You will need to edit the config\config.json file to specify hooks to use, and which COM ports you have your guns assigned to. Please see the readme for more detailed instructions.

** YOU DO NOT NEED TO RUN AS ADMIN UNLESS YOU HAVE DECIDED THAT ALL OF YOUR GAMES SHOULD RUN AS ADMIN -- BUT THAT MIGHT SCREW YOU UP. **

Download NodeJS x64 here

To test that everything is working, run start.bat and then open a new notepad window. Your guns should rumble for 200ms once the process is detected.

Please note that you are also able to use this platform to send commands per-game using an "overrides" framework. This may be helpful for you to override Gun4IR settings to be 4:3 or 16:9 on connect or disconnect depending on the game, or for whatever other use you can think of:
Code: [Select]
How to override behavior on a per-game COM connection/disconnect:
- In the /overrides/connected/ or /overrides/disconnecting/ folders, you can place a file with a game's key (see "key" param in config.json)
- The js file will execute at the appropriate time. You will have access to two variables: player and data.
- player is an object you can manipulate to communicate with your device:
- To send a COM command, just write: player.sendAction("MySerialCommand");
- data contains pertinent information such as Player # (1-indexed), COM port, connected state, and key

For the tinkerers, you can add new games by editing the config\config.json file so the software knows which processes to hook and with which plugin. You may look at examples of plugins that extend Plugin if you want to read memory addresses, or HookPlugin if you want to use existing outputs. If you want to use existing outputs, you likely just want to point to demulshooter-generic.js or demulshooter-custom.js for the game you want to add to the config.json file.

I started developing this software in 2022 but due to some library dependencies, did not want to do a public release without having said dependencies properly updated. I noted this week that they had been updated. Thanks to argonlefou's DemulShooter software for enabling many more games to run with this software (and also argonlefou's research for many of the memory addresses used - he may be thanked in a bunch of the plugin files), HowardCasto for all of his work with MAMEHooker, and as well HeadKaze/Ben Baker for the MAME Interop SDK, which I used (socket-interop/MAMEOutputsSocketIoInterOp.exe is my tool to forward MAMEHooker outputs to HDRecoil), and thanks to all of the folks on my development discord for helping test and spread the good word.

Enjoy. :cheers:
« Last Edit: March 04, 2024, 12:52:10 am by nugarp »
Wheel2XInput | HDRecoil | LeaderLamps | NetLauncher | Discord | Youtube

JayBee

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 505
  • Last login:December 05, 2024, 10:29:43 pm
  • Creator of the GUN4IR
Hey there, I just discovered your project, that's pretty sweet, great job :cheers:
It's really nice to see my GUN4IR feedback system being used so well!

nugarp

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 289
  • Last login:November 27, 2024, 02:09:25 pm
  • I want to build my own arcade controls!
Hey there, I just discovered your project, that's pretty sweet, great job :cheers:
It's really nice to see my GUN4IR feedback system being used so well!

No problem. We had a chat about it a while ago in the gun4ir-features-request and support channels on your discord (sept 2022) - it all started there :). Prior to the above post, I'd internally shared it with a few folks who I knew would not have trouble setting it up in the meanwhile and they had given a bunch of good compatibility feedback.

I'm "spazzy" on your discord server.

Thanks for the excellent platform to build off of. Hope you were able to give it a shot!
« Last Edit: March 26, 2024, 08:44:14 pm by nugarp »
Wheel2XInput | HDRecoil | LeaderLamps | NetLauncher | Discord | Youtube

hyo2012

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 71
  • Last login:May 26, 2024, 11:15:33 pm
  • I want to build my own arcade controls!
Hello? I am a Gun4ir user and I am interested in your hd-recoil application. However, there are difficulties in using it.

 After installing HD recoil with visual C check box, when I run start.bat, the application does not run.
It looks like can't find the location of the MAMEOutputsSocketIoInterOp.exe file.
The strange thing is that if you run start-minimized.bat, the application runs.
I edited config.json and entered the correct com port. And run app by start-minimized.bat.
App runs, However, my Gun4ir gun does not connected to app.
When running the game, the application says that the game is hooked, but gun4ir is still not connected.
If I run MAMEOutputsSocketIoInterOp.exe manually, It runs. But enter node index on powershell, It says 'could not find module memoryjs'

When using your old application node-game-output, gun4ir is connected. Don't know why. What should I do?
Can I load the app manually?  :)
« Last Edit: May 23, 2024, 12:11:43 am by hyo2012 »

squeak450

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:November 22, 2024, 05:03:45 pm
  • I want to build my own arcade controls!
Do you think you will ever incorporate some of the new light guns that are coming out. Such as Retroshooter & Blamcon

nugarp

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 289
  • Last login:November 27, 2024, 02:09:25 pm
  • I want to build my own arcade controls!
No, not personally. Anyone with any device can edit device.js to create their own outputs, though. It's all pretty straightforward for anyone who can read code. You will likely just need to edit the commands to match the serial commands to what those devices expect.
Wheel2XInput | HDRecoil | LeaderLamps | NetLauncher | Discord | Youtube