Rollback netcode for Mega Man Battle Network!

Overview

Tango

Tango is rollback netplay for Mega Man Battle Network.

Design

Tango is composed of two parts: the launcher and the core. The launcher performs high-level control operations, such as starting matches and configuration, while the core performs emulation and netplay. There are additional supplementary tools (replayview, replaydump, keymaptool) that the launcher may also use for certain specialized operations.

The core and launcher send IPC requests to each other over stdout/stdin pipes.

Building

Core

The core is written in Rust. Despite being for Windows, you must have a POSIX-y MinGW environment set up. The following instructions are for Ubuntu.

  1. Install Rust.

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Install the Rust target and toolchain for x86_64-pc-windows-gnu.

    rustup target add x86_64-pc-windows-gnu
    rustup toolchain install stable-x86_64-pc-windows-gnu
  3. Install mingw-w64.

    sudo apt-get install -y mingw-w64
  4. Ensure mingw-w64 is using the POSIX threading model.

    sudo update-alternatives --install /usr/bin/x86_64-w64-mingw32-gcc x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-win32 60 &&
    sudo update-alternatives --install /usr/bin/x86_64-w64-mingw32-gcc x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix 90 &&
    sudo update-alternatives --config x86_64-w64-mingw32-gcc &&
    sudo update-alternatives --install /usr/bin/x86_64-w64-mingw32-g++ x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-win32 60 &&
    sudo update-alternatives --install /usr/bin/x86_64-w64-mingw32-g++ x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix 90 &&
    sudo update-alternatives --config x86_64-w64-mingw32-g++
  5. Build the core.

    cd core &&
    cargo build --target x86_64-pc-windows-gnu

Launcher

The launcher is written in Node + Electron.

  1. Run npm install to get all Node dependencies.

    cd launcher &&
    npm install
  2. Make a dev-bin directory in launcher and copy the core files into it. Note you will need to do this on every rebuild.

    mkdir launcher/dev-bin &&
    cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll \
        /usr/lib/gcc/x86_64-w64-mingw32/9.3-posix/*.dll \
        core/target/x86_64-pc-windows-gnu/release/tango-core.exe \
        core/target/x86_64-pc-windows-gnu/release/replayview.exe \
        core/target/x86_64-pc-windows-gnu/release/replaydump.exe \
        core/target/x86_64-pc-windows-gnu/release/keymaptool.exe \
        launcher/dev-bin
  3. In the launcher directory, you can use the following commands:

    npm run start  # start webpack (keep this running in the background)
    npm run start:main  # start electron (run this in a new terminal)

Server

The server is the remote HTTP server-based component that Tango connects to. It doesn't actually do very much, so you can run it on absolutely piddly hardware. All it does is provide signaling by send WebRTC SDPs around and providing TURN credentials. Note that it doesn't actually provide a TURN server itself, so you'll need some way to get TURN credentials.

If you already have Rust installed, you can build it like so:

  1. Enter the core directory and build it.

    cd core &&
    cargo build --release --bin tango-server

That should be it! The server should be available in the usual Rust output directory.

In order to configure your server, you'll need to set the following environment variables:

  • LISTEN_ADDR: Host/port to listen on. Defaults to [::]:1984. It's recommended to front this with e.g. nginx for TLS support.

  • USE_X_REAL_IP: Whether or not the client's IP is presented in the X-Real-IP header. If false, will use the IP of the TCP connection. Do not enable this if you do not have a reverse proxy (e.g. nginx) that will set this in all cases!

  • SUBSPACE_CLIENT_ID, SUBSPACE_CLIENT_SECRET: Credentials for WebRTC-CDN from https://subspace.com. If not set, clients will not be able to get TURN credentials and connectivity behind CGNAT will be limited.

Language support

Tango is fully internationalized and supports language switching based on your computer's language settings.

The order of language support is as follows:

  • English (en): This is Tango's primary and fallback language. All Tango development is done in English.

  • Japanese (ja): This is Tango's secondary but fully supported language. All text in the UI, barring some extremely supplementary text (e.g. the About screen) is expected to be available in Japanese. If new UI text is added, a Japanese translation SHOULD also be provided. Tango releases MUST NOT contain missing Japanese text.

  • Simplified Chinese (zh-Hans): These are Tango's tertiary languages. Support is provided on a best effort basis and translations are provided as available.

Comments
  • bn3 save editor view

    bn3 save editor view

    things to do:

    • [x] folder support
      • [x] find where the folder info is stored in EWRAM
      • [x] add chip data and icons
      • [x] expose chip info via getFolderEditor
    • [x] navicust support
      • [x] get navicust cata
      • [x] find where navicust data is stored in EWRAM
      • [x] expose navicust info via getNavicustEditor
    • [x] style support
      • [x] find where style data is stored in EWRAM
      • [x] make a UI for this
    enhancement good first issue 
    opened by bigfarts 7
  • Missing instructions to connect logitech controller input on MacOS

    Missing instructions to connect logitech controller input on MacOS

    MacOS: Ventura 13.0 Processor: Quad-Core Intel Core i7 Tango version: 4.0.23

    I tried playing with my logitech controller but it wasn't detected by Tango (in game or in the input setting section). I found SDL Github repo this issue https://github.com/libsdl-org/SDL/issues/5781 and saw the link to this page https://nachtimwald.com/2020/11/08/macos-iohidmanager-permission-issue/

    Based on the page I had to give Tango Input Monitoring privileges which worked

    Not sure where to put this kind of documentation in Tango for other users, but happy to open a PR given directions

    opened by btruhand 6
  • support switch joycons

    support switch joycons

    Tango's launcher doesn't detect Switch's JoyCons, NES, and SNES controllers, ignoring any button requests when attempting to map these controllers.

    Strangely, Switch Pro Controllers work perfectly fine, not sure how the above controllers operate differently from SPCs.

    enhancement 
    opened by LanHikariDS 6
  • Auto Updater

    Auto Updater

    For some reason, whenever a version change is made(3.2.44 to 3.2.45, for example) the program won't auto-update for me. I have stable update channel on and I don't know what I'd have to enable to allow it to auto update.

    enhancement 
    opened by goldspacedragon 3
  • [4.0] graphics are broken in obscure corner cases

    [4.0] graphics are broken in obscure corner cases

    • glutin:

      • up-to-date drivers: fine
      • nvidia: fine but stream is dark on discord?
      • really old intel graphics drivers: horrible texture mangling
      • mesa (with srgb): doesn't work, NoAvailablePixelFormat
      • mesa (without srgb): wrong colors
      • angle (using gles): wrong colors but slightly less wrong
      • powervr (using gles): lol
    • wgpu:

      • up-to-date drivers: fine
      • some intel drivers: crashes on vulkan, must use d3d12
      • angle (using gles): wrong colors but just as wrong as glutin gles
      • mesa (using gles): doesn't work at all, just hangs
      • powervr (using gles): lol
    bug 
    opened by bigfarts 2
  • Initial Linux support

    Initial Linux support

    Most of the stuff breaking Linux support was already fixed thanks to some back and forth on Discord with @bigfarts . This PR mainly just adds some stuff to package.json to allow it to build an AppImage with everything it needs.

    Overview of this PR:

    • Added build:linux script to package.json, which does the build without calling the Windows-specific update-bin.sh script
    • Added dist:linux script to package.json, which is identical to dist except it calls build:linux instead of build
    • Added a linux section to package.json, which tells Electron to also copy libSDL2 shared objects from the host to the AppImage, this way the AppImage works fine even if the user's machine doesn't have SDL2 installed
    • Ensures tango-core is spawned from the launcher while inheriting the full environment. Otherwise it won't be able to find any bundled shared objects and will crash.

    Building:

    • The build process is straightforward, even easier than building for Windows. I believe your workflow already satisfies all the dependencies, it's just a matter of changing some of the commands out. But for completeness, here's what I used to build on a clean Ubuntu 20.04 Docker image:
    # Update system and install apt dependencies
    apt update -y
    apt upgrade -y
    DEBIAN_FRONTEND=noninteractive apt install -y alsa build-essential clang cmake curl git libnss3 libsdl2-dev libsdl2-ttf-dev pkgconf sudo
    
    # Install Rust, not using apt since apt's version is too old
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
    
    # Install node 18 because apt is on version 12 or something
    curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && \
    	sudo apt-get install -y nodejs
    
    # Clone tango
    git clone --recurse-submodules https://github.com/tangobattle/tango
    
    # Build the core
    cd tango/core
    cargo build --release --target x86_64-unknown-linux-gnu
    
    # Copy the core binaries to the launcher
    cd ..
    mkdir -p launcher/bin
    cp core/target/x86_64-unknown-linux-gnu/release/{tango-core,replayview,replaydump,keymaptool} ./launcher/bin/
    
    # Install npm dependencies
    cd launcher
    npm install
    
    # Build the launcher and package the AppImage
    npm run dist:linux
    
    # AppImage will be found at:
    # ./packages/Tango-3.1.10.AppImage
    

    Things of note:

    • When packaging this for release, I recommend compiling on Ubuntu 20.04 instead of Ubuntu 22.04. This is so that it gets compiled with a slightly older version of glibc, allowing it to run on a wider range of systems. If this were compiled on Ubuntu 22.04, it would only be compatible with a very limited number of systems with the recent version of glibc used by 22.04.
    • I haven't tested this on an online PvP match at all. The game runs though, so I have no reason to believe the netplay would be broken. Perhaps some beta Linux builds can be released so the wider community can give it a try and report problems.
    • For whatever reason (at least on KDE), Tango's icon doesn't show in the application window. Instead, it uses the default placeholder X11 icon. Not a huge deal but I don't know why this is: image
    opened by ubergeek77 2
  • Controller support

    Controller support

    There's always an external program that will help out with that, but not everyone is a tech literate person willing to take a minute to set up a keyboard emulation program. With Tango 3.0 focusing on user-friendliness (or so it seems to me), I feel like adding controller support fits in with that theme.

    enhancement 
    opened by Lumanator 2
  • juice: Send failed, datagram is too large

    juice: Send failed, datagram is too large

    unsure why this happens

    [2022-09-28T11:44:27Z WARN  datachannel::sys] rtc::impl::IceTransport::LogCallback@354: juice: Send failed, datagram is too large
    
    opened by bigfarts 1
  • Add license scan report and status

    Add license scan report and status

    Your FOSSA integration was successful! Attached in this PR is a badge and license report to track scan status in your README.

    Below are docs for integrating FOSSA license checks into your CI:

    opened by fossabot 1
  • read ncp/chip/etc info out of the ROM instead of bundling it

    read ncp/chip/etc info out of the ROM instead of bundling it

    marwe — Today at 16:34 nice, I think that's pretty much the only way to make the dynamic dream a reality otherwise the other option would have to be like the patch devs supplying additional hardcoded metadata for the save viewer

    enhancement 
    opened by bigfarts 1
  • replay desync

    replay desync

    opened by bigfarts 1
  • Tango keeps crashing on open when Switch joycons are connected to Macbook

    Tango keeps crashing on open when Switch joycons are connected to Macbook

    MacOS version: Ventura 13.0 Processor: Quad-Core Intel Core i7 Tango: 4.0.23

    I saw that support for Switch Joycons is available for Tango. But whenever I try to open Tango while my Macbook is connected to my Switch joycons it would crash. The log outputs are always the same (pasting just the crash reason):

    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SdlError("Couldn't open Bluetooth_057e_2006_0x7fe5e8704080")', tango/src/main.rs:253:54
    stack backtrace:
       0: _rust_begin_unwind
       1: core::panicking::panic_fmt
       2: core::result::unwrap_failed
       3: core::result::Result<T,E>::unwrap
       4: tango::child_main
       5: tango::main
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
    

    The program doesn't crash when Tango is already open and I connect my Switch joycons, but the program wouldn't pick up the inputs from the joycons (didn't check the logs for thesee, but can try and replicate if needed)

    I also noticed that my Switch joycon bluetooth connection identifier (the green lights) would be at 2 green lights whenever I have it connected with Tango open, which I think means that it is connected as the second device to the bluetooth interface. But I checked and there were no other bluetooth devices connected to my Macbook

    opened by btruhand 1
  • bn123 makes weird beepy noises

    bn123 makes weird beepy noises

    i'm not sure why:

    • this only happens during the turn (also the audio gets scrunkly)
    • in the custom screen the audio is not scrunkly
    • doesn't seem to cause any timing issues
    • maybe skipping samples?
    bug help wanted 
    opened by bigfarts 1
  • bn6 random battle support

    bn6 random battle support

    this seems relatively complicated to implement, as during the random battle screens there is SIO communication going on. i don't really know what the SIO in question is, though, and how much of it is actually required (and how much of it can just be fudged).

    enhancement help wanted 
    opened by bigfarts 0
Releases(v4.0.27)
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
PAC-MAN Leaderboard includes the Leaderboard API. You can add your name and score, and see other player's scores.

PAC-MAN Leaderboard includes the Leaderboard API. You can add your name and score, and see other player's scores.

Pedro Guerreiro 7 Oct 26, 2022
The repository shows the compiler (simulator) of the Little Man Computer, which also contains some programs in the LMC programming language for implementing different functions.

Little Man Computer The repository shows the compiler (simulator) of the Little Man Computer, which also contains some programs in the LMC programming

Cow Cheng 2 Nov 17, 2022
MZ-Switchwire - Convert Anycubic Mega Zero v1 to Switchwire

Anycubic Mega Zero v1 Switchwire Mod 390mm X-Axis with MGN9H - Click for 3D prev

null 5 Dec 25, 2022
Your non mega-corporate Open source PLM. Click the website down below for more information.

PLMore PLMore is an open-source Product Lifecycle Management Software. It offers an alternative to the heavily priced archahic Windchill/Teamcenter so

Oussema Zouaghi 6 Aug 23, 2022
Your non mega-corporate Open source PLM. Click the website down below for more information.

PLMore PLMore is an open-source Product Lifecycle Management Software. It offers an alternative to the heavily priced archahic Windchill/Teamcenter so

PLMore 4 Jun 20, 2022
Fullstack Dynamic NFT Mini Game built using 💎 Diamond Standard [EIP 2535] 🏃‍♀️Players can use Hero NFT to battle against Thanos ⚔ Heroes can be Healed by staking their NFT 🛡

?? Fullstack Dynamic NFT Mini Game ?? ?? Using Diamond Standard Play On ?? ?? ⏩ http://diamond-dapp.vercel.app/ Project Description ?? Fullstack Dynam

Shiva Shanmuganathan 21 Dec 23, 2022
The SheetJS Community Edition offers battle-tested open-source solution

The SheetJS Community Edition offers battle-tested open-source solutions for extracting useful data from almost any complex spreadsheet and generating new spreadsheets that will work with legacy and modern software alike.

SheetJS 32k Dec 29, 2022
🚀 Battle-tested Next.js TypeScript Prisma template with an opinionated architecture. 🔋 Included ™️

?? The Ultimate Next.js Starter Pack Next.js ^12 + TypeScript + Prisma + Chakra UI starter packed with useful development features. I've adopted indus

Nam 7 Dec 10, 2022
Pokémon: Duel Battle

Pokémon: Duel Battle Sebuah Web Apps yang dibuat sebagai syarat kelulusan Dicoding Submission Belajar Fundamental Front-End Web Development. Tech Proj

Ryan Aunur Rassyid 3 Sep 16, 2022
Simple but Complete & Fast network monitor for your home network

netmon Netmon is an opensource project for protecting and monitoring your home network. Netmon is written to run on a Raspberry PI and is optimized to

Tommaso Ventafridda 9 Jul 6, 2022
Decentralized Social Network Money Frauds/Scams including BitClout, Twetch, Steemit, PeakD

Decentralized Social Network Money Frauds and DAOs: BitClout, Twetch, PeakD, Steemit ... Updates 4/29/2021 https://www.coindesk.com/wyoming-dao-llc-la

Scott Stirling 29 Nov 27, 2022
A simple way to share files and clipboard within a local network.

Shortcut Simple way to share files and clipboard with devices within a local network. Usage Run the ./shortcut executable. A browser window will be op

Dhamith Hewamullage 17 Mar 13, 2022
This Project is made with HTML5, CSS3, ReactJS, Axios, MetaMask, thirdweb, Rinkeby Test Network, Web 3.0 Technologies, and OpenSea API.

Abstract Collections This Project is made with HTML5, CSS3, ReactJS, Axios, MetaMask, thirdweb, Rinkeby Test Network, Web 3.0 Technologies, and OpenSe

Shobhit Gupta 34 Jan 4, 2023
Anagolay Network Javascript SDK written in Typescript

Anagolay Network Javascript SDK written in Typescript. This repo will contain the bindings to Anagolay Network with the sane defaults for pallet usage

Anagolay Network 4 Nov 26, 2022
Hundreds of Offensive and Useful Docker Images for Network Intrusion. The name says it all.

?? HOUDINI: Hundreds of Offensive and Useful Docker Images for Network Intrusion HOUDINI is a curated list of Network Security related Docker Images f

SecSI 1.1k Dec 31, 2022
A lazy plugin for printing local network when starting NodeJS server. I made this so you don't have to.

lazy-net A simple, lightweight plugin for printing local network when starting Node.js or Express.js server. I made this so you don't have to. There a

Trần Quang Kha (始) 1 Feb 10, 2022