All Projects → georgefst → monpad

georgefst / monpad

Licence: BSD-3-Clause license
A fully-customisable web-based gamepad, designed to be used from smartphones.

Programming Languages

haskell
3896 projects
elm
856 projects
Dhall
116 projects
javascript
184084 projects - #8 most used programming language
powershell
5483 projects
CSS
56736 projects
shell
77523 projects

Projects that are alternatives of or similar to monpad

Borderless Gaming
Play your favorite games in a borderless window; no more time consuming alt-tabs.
Stars: ✭ 3,452 (+10052.94%)
Mutual labels:  steam, games
Giveawaycompanion
Saves your time on games giveaway sites.
Stars: ✭ 59 (+73.53%)
Mutual labels:  steam, games
Depressurizer
Depressurizer is a program that helps you categorize your steam games.
Stars: ✭ 612 (+1700%)
Mutual labels:  steam, games
SteamDepotDownloaderGUI
A simple GUI tool based on DepotDownloader for downloading Steam depots.
Stars: ✭ 26 (-23.53%)
Mutual labels:  steam, games
Docker Dontstarvetogether
Dockerfile for building a Don't Starve Together dedicated server image.
Stars: ✭ 240 (+605.88%)
Mutual labels:  steam, games
GetFreeGames
Python script to search and find free games using Steam's API and to claim them using ASF's IPC API.
Stars: ✭ 18 (-47.06%)
Mutual labels:  steam, games
Depressurizer
A Steam library categorizing tool.
Stars: ✭ 1,008 (+2864.71%)
Mutual labels:  steam, games
BoilR
Synchronize games from other platforms into your Steam library
Stars: ✭ 664 (+1852.94%)
Mutual labels:  steam, games
Luxtorpeda
Steam Play compatibility tool to run games using native Linux engines
Stars: ✭ 232 (+582.35%)
Mutual labels:  steam, games
Getdlcinfofromsteamdb
Get Data from Steam / SteamDB / EpicDB (ex Get DLC Info from SteamDB) it's a userscript able to extract all the information of the DLCs Games from Steam / SteamDB / EpicDB and are exported in various formats. It also has small tools :)
Stars: ✭ 210 (+517.65%)
Mutual labels:  steam, games
Lauhdutin
A Rainmeter skin for launching games.
Stars: ✭ 65 (+91.18%)
Mutual labels:  steam, games
Steam-Server-Manager
PowerShell Steam Server Manager
Stars: ✭ 33 (-2.94%)
Mutual labels:  steam, games
CreamInstaller
Automatically finds all installed Steam, Epic and Ubisoft games with their respective DLC-related DLL locations on the user's computer, parses SteamCMD, Steam Store and Epic Games Store for user-selected games' DLCs, then provides a very simple graphical interface utilizing the gathered information.
Stars: ✭ 274 (+705.88%)
Mutual labels:  steam, games
Boxtron
Steam Play compatibility tool to run DOS games using native Linux DOSBox
Stars: ✭ 262 (+670.59%)
Mutual labels:  steam, games
DualSenseX
Connect your DualSense Controller, use Adaptive Triggers, Emulate Xbox 360 or DualShock 4 through USB or Bluetooth on PC
Stars: ✭ 699 (+1955.88%)
Mutual labels:  steam, games
Steamdock
A clean dock for your Steam games
Stars: ✭ 17 (-50%)
Mutual labels:  steam, games
Game-Assets-And-Resources
Free and paid game assets and game resources for 2D games, 3D games, mobile games, Steam games, Unity games, and other games.
Stars: ✭ 164 (+382.35%)
Mutual labels:  steam, games
humble-bundle-key-redeemer
Bulk redemption/activation of Humble Bundle Steam keys.
Stars: ✭ 21 (-38.24%)
Mutual labels:  steam, games
Proton Caller
Run any Windows program through Proton
Stars: ✭ 130 (+282.35%)
Mutual labels:  steam, games
FLOSS-Games-on-Steam
A list of FLOSS games available on Steam
Stars: ✭ 90 (+164.71%)
Mutual labels:  steam, games

Monpad

Monpad allows you to use touchscreen devices remotely as inputs to your computer, via a web interface. While initially designed to emulate gamepads, it is highly customisable - for example, you could use it to set up your phone as a wireless keyboard or mouse, or a buzzer for quizzes.

While touchscreen controls are probably too fiddly for particularly serious/complex games, Monpad is ideal for 'party' games, where relatively few buttons/joysticks are required, and the player limit is often much higher than the number of physical controllers one is likely to own.

Some example configurations:

Build

Prerequisites:

  • Haskell:
    • cabal ≥ 3.6
    • ghc ≥ 9.2
  • Elm:
    • elm ≥ 0.19.1
  • (Linux only) libevdev headers:
    • Debian/Ubuntu: sudo apt install libevdev-dev

If you haven't done so before, run cabal update to grab the latest package index from Hackage.

Run ./build.sh* to build. The first time you run this, it could take a while, as cabal will need to download and build all dependencies.

* On Windows, it's .\build.ps1. Though you may need powershell.exe -executionpolicy bypass -file .\build.ps1 due to permissions issues. I don't personally know a thing about Windows permissions, so if anyone has a better idea please let me know.

Run

Run ./dist/monpad to start the server (you can pass the -h flag to see all options).

Then connect from your web browser:

  • From the same device, you can navigate to eg. http://localhost:8000.
  • From another device on the same network, connect with your local ip, instead of localhost.
  • Allowing connections from an external or unsecured network is strongly discouraged, since no security features are yet implemented.

Note that the monpad binary is self-contained - you can move it to any location you wish.

Customise

The controller layout and button/axis mapping can be fully customised using Dhall. Examples are in this repository. Note that some of these files import each other by relative path, so they are best kept together. Running the build script with the argument dhall will generate standalone versions, specialised to the host OS, though these will be less human-readable.

Compatibility / Troubleshooting

Windows

There is currently no support for creating OS-level devices on Windows. But it's very much on the roadmap.

Linux

uinput

You will need permissions to write to /dev/uinput. This can usually be achieved by creating a group specially for uinput permissions:

sudo groupadd uinput
sudo usermod -a -G uinput $USER
echo 'KERNEL=="uinput", GROUP="uinput", MODE:="0660", OPTIONS+="static_node=uinput"' | sudo tee -a /etc/udev/rules.d/99-uinput.rules > /dev/null

Alternatively, you can just run monpad as root.

SDL

The server creates an evdev device, via uinput, but this in itself is not enough to be picked up by many games. For broad compatibility, you will need to set the SDL_GAMECONTROLLERCONFIG environment variable (EDIT: this is less necessary than it used to be, but I'm unsure of the scope). There are various ways to manage this, such as:

  • Set persistently for the current user (you will need to log out and back in for this to take effect):
    echo 'SDL_GAMECONTROLLERCONFIG="000000004d5000004d50000000000000,Monpad,platform:Linux,a:b0,b:b1,x:b3,y:b2,guide:b4,leftx:a0,lefty:a1,"' >> ~/.profile
  • Launch a particular program (in this case Steam) with the variable set locally:
    SDL_GAMECONTROLLERCONFIG="000000004d5000004d50000000000000,Monpad,platform:Linux,a:b0,b:b1,x:b3,y:b2,guide:b4,leftx:a0,lefty:a1," steam

This should register the gamepad correctly with SDL, Unity, Unreal, Steam etc. Note that the value given above is specific to Monpad's default layout. If using a custom layout, it is recommended that you download the SDL2 Gamepad Tool, and paste the result of clicking Copy Mapping String.

Browsers

Due to the use of some recent Web APIs, an up to date browser is recommended. Even then, support is not equal across the board. Firefox (Android and Linux) is the most well-tested, followed by Chrome on Android.

Miscellaneous issues

  • Firefox does not currently give permission to switch to fullscreen on a change of rotation.

Apple

Apple devices (more specifically, WebKit-based browsers) have a lot of issues. This includes Firefox and Chrome on iOS. Many of these issues also apply to Safari on MacOS, but that's unlikely to be a platform anyone's currently using with a touch screen.

This is mostly down to Apple's refusal to implement Web APIs as specified, due to often-excessive accessibility or security considerations, which demonstrate a lack of trust in both users and developers. In other cases, behaviour is simply buggy. There's a limit to what we can do to work around these problems downstream. Ultimately, Apple devices are currently a poor target platform for complex web applications (as opposed to more traditional web pages).

Contributing

Get involved! I'm particularly looking for someone who's keen on adding Windows support, since I don't currently have a Windows PC to test on.

Note that a basic version of the server (which doesn't create uinput devices) can be started from GHCI by running the function Test.test [] [] [] from cabal repl. This will pick up changes to HTML/CSS/JS/Dhall assets when the webpage is refreshed, including the compiled JS from Elm, which can be generated by passing the target 'elm' to the build script.

Acknowledgements

Many thanks to everyone (particularly xboxdrv maintainer @Grumbel) who helped me with understanding the mechanisms by which games recognise controllers and receive input on Linux. I never would have pieced that all together myself.

And a shout out to @CPTblackadder and @ortk95 for forcing me to work on all this for far longer than I wanted to.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].