Skip to content

Repository files navigation

DiscordReleasesGitHub Sponsors

EpicSocket

Transport for Mirage using Epic online services relay

Installation

The preferred installation method is Unity Package manager.

If you are using unity 2019.3 or later:

  1. Open your project in unity
  2. Install Mirage
  3. Click on Windows -> Package Manager
  4. Add com.playeveryware.eos as to scopedRegistries
    • Important: currently eos must be installed manually by adding https://github.com/PlayEveryWare/eos_plugin_for_unity_upm.git#v1.0.4
  5. Add the com.miragenet.epicsocket package`

Required Scoped Registers

This repo requires the following Scopes registers, These values can be set in project settings within the editor or by adding them to manifest.json

"scopedRegistries": [
{
"name": "OpenUPM",
"url": "https://package.openupm.com",
"scopes": [
"com.cysharp.unitask",
"com.openupm",
"com.miragenet",
"com.playeveryware.eos"
]
}

Git install

Alternatively to OpenUPM you can install using git url by adding this to manifest.json

"com.miragenet.epicsocket": "https://github.com/MirageNet/EpicSocket.git?path=/Assets/EpicSocket#v1.0.0-beta.1"

Epic setup

Check eos_plugin_for_unity for Epic setup and examples

Basic usage

When using EpicSocketFactory with Mirage you should start the client/server via the EpicSocketFactory instead of by themselves. This is because the SocketFactory will make a connection to the relay first and then start the client/server when the relay is ready to use (this avoids timeout issues).

publicstaticasyncUniTaskHostWithEpic(NetworkManagermanager,EpicSocketFactoryepicFactory){awaitepicFactory.InitializeAsync();varlobbyHelper=newLobbyHelper(EOSManager.Instance.GetProductUserId(),EOSManager.Instance.GetEOSLobbyInterface());epicFactory.StartAsHost(manager.Server,manager.Client);awaitlobbyHelper.StartLobby(4,"Default");}publicstaticasyncUniTask<LobbyDetails>GetFirstLobby(EpicSocketFactoryepicFactory){awaitepicFactory.InitializeAsync();varlobbyHelper=newLobbyHelper(EOSManager.Instance.GetProductUserId(),EOSManager.Instance.GetEOSLobbyInterface());varlobbies=awaitlobbyHelper.GetAllLobbies();// most of the time you will want to have the user pick the lobby, but for this example we just pick the firstreturnlobbies.First();}publicstaticasyncUniTaskConnectToLobby(NetworkManagermanager,EpicSocketFactoryepicFactory,LobbyDetailslobby){varremoteUser=lobby.GetLobbyOwner(newLobbyDetailsGetLobbyOwnerOptions());awaitepicFactory.StartAsClient(manager.Client,remoteUser);}

About

Transport for Mirage using Epic online services relay

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages