The goal of this project is to create a "crowd control" mod for Daimakaimura / Ghouls 'n' Ghosts on MAME.
The idea of a crowd control mod is allowing stream viewers to trigger certain in-game effects.
- Set/randomize weapon
- Set/increment/decrement armour (naked, steel, gold)
- Transform arthur into a duck for n seconds
- Transform arthur into an old man for n seconds
- Transform arthur as usual (turns into a duck or old man depending on current armour state)
- Give invincibility for n seconds
- Set/randomize/increment/decrement/max/min in-game "rank" (difficulty setting)
- Set arthur's run speed for n seconds
- Set arthur's jump height for n seconds
- Set gravity for n seconds
- Set/decrement in-game timer
- Damage arthur
- Kill arthur instantly
- Create middleware to send effect triggers to plugin
- Integrate with Streamlabs donation API
- Look into integrating with Twitch APIs?
- Trigger effects using bits
- Trigger effects using channel points
- Create donation "menu" frontend
- Display all available effects and their costs
- Display effect cooldowns
- Display effect queue?
- Manage effect cooldowns
- Manage dynamic effect costs
Components:
- MAME plugin
- Node.js middleware
- React frontend
- Integration with twitch/streamlabs APIs
The daimakaimuracc MAME plugin will be executing all effects. It is a LUA script that has read/write access to game memory and communicates with the middleware app over a socket connection.
The middleware app acts as a proxy between the MAME plugin and the donation API(s). It also serves data to the menu frontend.
The React frontend will connect to the middleware and render a "donation menu" that can be displayed on stream.
- Node.js
- MAME 0.251 or later
- Daimakaimura ROM (
daimakai.zip)
- Copy the contents of the
mamedirectory from the root of the project into your MAME installation folder - When prompted, replace all existing files
- Navigate to
<MAME installation>/plugins/daimakaimuracc/and open the fileinit.luain a text editor - Adjust configuration as necessary
- To test whether the plugin works without needing to set up the other components, set
useNetworktofalseandchaosModetotrue. This will trigger random effects periodically.
- To test whether the plugin works without needing to set up the other components, set
- Launch MAME from a terminal using the following command:
mame.exe daimakai -plugin daimakaimuracc
- In a terminal, navigate to the
apidirectory from the root of the project - Run
npm install - Run
npm run start - Test whether the middleware is running successfully
- In your browser, visit http://localhost:3080/deathprice
- It should return "1"
- Launch MAME using the previous command
- Note: it is important that the middleware is running before MAME.
- In the terminal window that you launched the middleware from, you should see it responding to MAME with a "Connected" message
- Test whether the middleware is able to successfully send commands to MAME
- In MAME, insert some coins
- In your browser, visit http://localhost:3080/sendData/16
- In the terminal window that you launched the middleware from, you should see "Sending ID 16 to client"
- In MAME, start the game
- As soon as you have control over Arthur, you should see the Death effect trigger
- In a terminal, navigate to the
frontenddirectory from the root of the project - Run
npm install - Run
npm run start - Test whether the frontend is running successfully
- In OBS, add a new browser source
- Set the URL to http://localhost:3001
- The browser source should be rendering a GnGCC donation menu
- Test whether the frontend is able to communicate with the middleware
- In your browser, visit http://localhost:3080/sendData/16 to trigger the Death effect again
- In the donation menu in OBS, you should see the listed price of the Death effect increase
- To adjust the layout, style or prices of the menu, see
/frontend/src/App.js
Currently, the middleware does not receive requests from any donation APIs. This means that any effects redeemed must be triggered manually for now.
To trigger effects, an HTTP request must be sent to the middleware server at /sendData/:effectId. With the default config, and the death effect, this would look like: http://localhost:3080/sendData/16. Below is a full list of available effects sorted by their ID.
- Random Weapon
- Downgrade Armour
- Upgrade Armour
- Fast Run
- Slow Run
- High Jump
- Low Jump
- Duck Transformation
- Old Man Transformation
- Invincibility
- Subtract Time
- Random Rank
- Increase Rank
- Decrease Rank
- Max Rank
- Death
- Low Gravity
- Min Rank
- Elgato Stream Deck
- Configure each effect as a "System" -> "Website" button
- Set the URL to the
/sendData/:effectIdendpoint of the middleware. - Enable the "GET request in background" option
- Repeat this process for each effect you would like to be able to trigger from your Stream Deck.
- Browser bookmarks
- A bookmark can be created for each effect that will trigger the effect when it is visited.
- You may be able to trigger these bookmarks from a device other than the computer running the middleware server and game, such as another computer or a smartphone.
- The devices must be on the same network
- Replace
localhostin your effect URLs with the local IP of the computer running the middleware server