Coder Social home page Coder Social logo

fizzyfacepunch's Introduction

FizzyFacepunch

This is an alternative version of FizzySteamworks that uses Facepunch instead of Steamworks.NET.

Mirror docs and the official community Discord.

FizzyFacepunch brings together Steam and Mirror . It supports both the old SteamNetworking as well as the new SteamSockets.

Dependencies

Both of these projects need to be installed and working before you can use this transport.

  1. Facepunch FizzyFacepunch relies on Facepunch to communicate with the Steamworks API. Requires .Net 4.x
  2. Mirror FizzyFacepunch is also obviously dependant on Mirror which is a streamline, bug fixed, maintained version of UNET for Unity.

Setting Up

  1. Install Mirror (Requires Mirror 66.0+) from the official repo unitypackage or from the Asset Store.
  2. Install FizzyFacepunch unitypackage from the release section.
  3. In your "NetworkManager" object replace "Telepathy/KCP" script with "FizzyFacepunch" script.
  4. Enter your Steam App ID in the "FizzyFacepunch" script.

If the latest FizzyFacepunch unitypackage doesn't work then download the source of this repo, and copy it to the Assets/Mirror/Runtime/Transports/FizzyFacepunch folder in your Unity project. (because maybe someone already fixed it)

Note: The default 480(Spacewar) appid is a very grey area, technically, it's not allowed but they don't really do anything about it. When you have your own appid from steam then replace the 480 with your own game appid. If you know a better way around this please make a Issue ticket.

Host

To be able to have your game working you need to make sure you have Steam running in the background.

Client

  1. Send the game to your buddy.
  2. Your buddy needs your steamID64 to be able to connect. The transport shows your Steam User ID after you have started a server.
  3. Place the steamID64 into "localhost" then click "Client"
  4. Then they will be connected to you.

Testing your game locally

You can't connect to yourself locally while using FizzyFacepunch since it's using steams P2P. If you want to test your game locally you'll have to use "Telepathy/KCP Transport" instead of FizzyFacepunch.

fizzyfacepunch's People

Contributors

apkatsikas avatar axvemi avatar benhhopkins avatar chykary avatar jcrombez avatar jesusluvsyooh avatar kanefreeman avatar karmydev avatar linjmeyer avatar lukeseers avatar scriptsengineer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fizzyfacepunch's Issues

Friend invites

Hi, I just wanted ask If it's possible to use steam's invite system, joining lobbies etc. with mirror and this wrapper. Thank you.

lobby.Members sending a list of empty Friends on second call

Hello, I use a NonDestructible object to store my lobby, the players in it etc.
When I change scene, I need to "reload" the visual elements in the UI, to do that quickly I decided to just empty my dictionnary and re-call my OnLobbyEnteredFunction with the current lobby as parameter.
It works on first loading, but on the second I just get a list of user with the ID "0" and an empty Username. But the lobby Id is still the same. Here's my code :

private void OnLobbyEntered(Lobby lobby)
 {
     Debug.Log(currentLobby.Id);
     currentLobby = lobby;

     foreach(Friend member in lobby.Members)
     {
         Debug.Log(lobby.Id);
         Debug.Log(member.Id);
         Debug.Log(member.Name);
         //I'm starting to add users
         AddUser(member, new SteamUser(member.Id, member.Name));
     }

     /*if (SteamClient.SteamId != lobby.Owner.Id)
     {
         textDumpster.text += "You joined " + lobby.Owner.Name + "'s lobby !\n'";
     }*/
 }

For test purpose, I removed everything that starts a GameServer and stuff, I just load another scene then reload the original scene (by returning to the orignal scene a duplicate of my GameObject is created, but quickly deleted, although the Facepunch component of this duplicate has the time to return an error about the Steam connection already being open, as Facepunch's awake method is called before my script one's).

Get Player SteamId from Player GameObject

Is there any way to find out the Players SteamID from its PlayerObject?
I want to display the Playername of every Player above their names.
I don't want the Players to send their Name to the other Clients because they could fake their name.
The Host should already have the associated SteamID right? How do I get there from the Server? So the Server can send everyone which Name everyone has.

OnStopClient not called when Mirror initiates disconnect

When Mirror initiates a disconnect (not when the application does, for example by calling StopClient) the FizzyFacepunch NextClient does not perform the disconnect in a way that triggers OnStopClient to be called. Mirror disconnects that occur as a result of, for example, an exception in a client RPC handler, or an authenticator rejection where ClientReject is called, does not trigger OnStopClient allowing the application code to know the client is terminating and thus exit to another scene.

I was able to correct the issue in my local copy of FizzyFacepunch by changing the NextClient.Disconnect method to the following:

public void Disconnect()
    {
      cancelToken?.Cancel();
      SteamNetworkingSockets.OnConnectionStatusChanged -= OnConnectionStatusChanged;

      if (HostConnectionManager != null && Connected)
      {
        Debug.Log("Sending Disconnect message");

        Connected = false;
        OnDisconnected?.Invoke();

        HostConnection.Close(false, 0, "Graceful disconnect");
        HostConnectionManager = null;
      }
    }

I am unsure if this is a suitable solution, but it works as a bandaid for now. Was Disconnect written to not call the OnDisconnected event because OnConnectionStatusChanged is expect to call it? My testing indicated that even if I move the SteamNetworkingSockets.OnConnectionStatusChanged -= OnConnectionStatusChanged; line to the end other the method, after HostConnection.Close is called, OnConnectionStatusChanged is not called during the disconnect.

FizzyFacepunch could not initialise: Calling SteamClient.Init but is already initialized

I just added FizzyFacePunch to an existing project using Facepunch. In my game menu scene I init the Steam client, but the network client/host isn't started until navigating to the game scene. This causes the following exception
FizzyFacepunch could not initialize: Calling SteamClient.Init but is already initialized

This exception is caught and logged already so it is not a stability issue. I would propose checking if Facepunch is already started and skipping the init as needed.

(Everything works great btw thank you!)

MissingReferenceException when re-creating NetworkManager

Hi,

I was getting MissingReferenceException: The object of type 'FizzyFacepunch' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.

When transitioning to an offline Scene with Mirror.

I noticed this comment which tipped me off - https://github.com/vis2k/Mirror/blob/b7c63c3067bf206e1d97470f57a677e1472c421b/Assets/Mirror/Runtime/Transport/Transport.cs#L221

See this PR - #10

Error after importing into a project

So, I have an empty project.

I installed Mirror from the Asset Store, last version. Also imported Facepunch, but, when I do import FizzyFacepunch (last package version) I'm getting this error:

image

Empty connections when Host after Client

I noticed strange bug. If you join friend server, then leave and create new server as host and same friend enter your server, it's cause strange things like:

  • Server spawn client player prefab twice
  • Serves tries to remove/unspawn client prefab twice

Also, count of empty (ghost) connection depends on how much you joined your friend when he was host. So if you joined his server 4 times and after it you start as host and fried joins your server, you will got 4 empty connections.

I noticed this bug in my project, then I created a new one simple project and this bug happened too.

Also I think that this bug somehow connected with another one, I opened issue for it recently: Issue Link

Receive many errors on connect when connecting on an intentional my own steam id

Received only in "Use Next Gen Steam Networking"

NullReferenceException: Object reference not set to an instance of an object
Mirror.FizzySteam.NextClient.FlushData () (at Assets/Addons/Mirror/Runtime/Transport/FizzyFacepunch/NextClient.cs:188)
Mirror.FizzySteam.FizzyFacepunch.ClientLateUpdate () (at Assets/Addons/Mirror/Runtime/Transport/FizzyFacepunch/FizzyFacepunch.cs:85)
Mirror.NetworkClient.NetworkLateUpdate () (at Assets/Addons/Mirror/Runtime/NetworkClient.cs:1263)
Mirror.NetworkLoop.NetworkLateUpdate () (at Assets/Addons/Mirror/Runtime/NetworkLoop.cs:189)
NullReferenceException: Object reference not set to an instance of an object
Mirror.FizzySteam.NextClient.ReceiveData () (at Assets/Addons/Mirror/Runtime/Transport/FizzyFacepunch/NextClient.cs:171)
Mirror.FizzySteam.FizzyFacepunch.ClientEarlyUpdate () (at Assets/Addons/Mirror/Runtime/Transport/FizzyFacepunch/FizzyFacepunch.cs:69)
Mirror.NetworkClient.NetworkEarlyUpdate () (at Assets/Addons/Mirror/Runtime/NetworkClient.cs:1239)
Mirror.NetworkLoop.NetworkEarlyUpdate () (at Assets/Addons/Mirror/Runtime/NetworkLoop.cs:182)

Steam Deck Crash with Mirror + FizzyFacepunch

My project uses Mirror with FizzyFacepunch transport based somewhat around the Mirror Room Example. Normally it works great, but I am seeing that if Steam Deck users host a game, the Steam Deck crashes to desktop after the client connects. The client does successfully enter the host's room, but the host's game crashes.

From the logs it seems to happen after OnConnectionStatusChanged completes in Mirror.FizzySteam, but before NetworkRoomManager OnServerReady would normally trigger. Image is a photo of the Deck user's log right before they crashed to Steam Deck desktop. From the client's point of view, the connection is successful, but the host is gone.

20221031_101548 (1)

Compatability issue with new facepunch steamworks build

I've done a lot of looking on the internet for documentation on this and, there is next to nothing, apparently when I go through the installation steps of both FizzyFacepunch and facepunch.steamworks, Fizzyfacepunch is unable to find the dependency facepunch.steamworks in my project files, is there a specific folder from the facepunch.steamworks build that this transport requires?

After re importing both things, I receive this error (In visual studio):
image

I finally figured out that the facepunch.steamworks has duplicate libraries for different bit based systems:

image

So once I removed the ones I wasn't gonna use, I was left with these errors:
image

No unitypackage available ?

Hi,

In the README, it is specified a unitypackage is available. Unfortunately, none are available on the release page.

Possible solutions :

  • Put a unitypackage on the releases
  • Put a disclaimer to copy manually the sources inside a Mirror Transport directory

Have a great day, thanks for your work !

Cannot ban or kick

Hello,

How to ban or kick someone from a lobby?
If it's not available could someone help me coding it myself from steamWorks.net?

NetCommon.MAX_MESSAGES value of 1024 triggers exception in Facepunch.Steamworks because it's out of the defined range of [1..256]

NextClient.ReceiveData and NextServer.ReceiveData both call ConnectionManager.Receive with a value which is too large, which triggers this exception: https://github.com/Facepunch/Facepunch.Steamworks/blob/1bae58560200c74fe53beeddb382aea4d83615f1/Facepunch.Steamworks/Networking/ConnectionManager.cs#L113 and causes connections to fail.

Changing MAX_MESSAGES to be within the specified range (E.g. 256) results in no errors and a connection being established successfully.

Every new connection as client adds additional LoadScene

I have a problem with FizzyFacepunch (with KcpTransport all works fine). When I connect to my friend's server for the first time all ok, but every next time I connect it's loading one more map. For example on third connection:
image
I think that problem with FizzyFacepunch library, because with any other transports all works fine.

Error after importing Facepunch to a project

Assets\Mirror\Runtime\Transport\FizzyFacepunch\LegacyCommon.cs(54,38): error CS0117: 'P2PSessionError' does not contain a definition for 'NotRunningApp'`

Assets\Mirror\Runtime\Transport\FizzyFacepunch\LegacyCommon.cs(58,38): error CS0117: 'P2PSessionError' does not contain a definition for 'DestinationNotLoggedIn'

These 2 errors pop up after importing facepunch files to a project. I cann't find any solution anywhere.
image

Server List

Is there a way to implement a server list with this? Does this automatically use Steam's built in server list?

ClientSend and ServerSend signature error

Hello,

When importing this package with Mirror 53, compilations errors appear (FizzyFacepunch not properly overriding ClientSend and ServerSend Methods)

Are you planning on keeping this module up-to-date with Mirror ? Or should I use Steamworks.NET instead ?

Many Thanks

FizzyFacepunch could not initialise: SteamAPI_SteamNetworkingSockets_v008

Hi,

I did all the steps you wrote on the start page but if I start the game in Unity, I get this exception:

FizzyFacepunch could not initialise: SteamAPI_SteamNetworkingSockets_v008
UnityEngine.Debug:LogError(Object)
Mirror.FizzySteam.FizzyFacepunch:Awake() (at Assets/Mirror/Runtime/Transport/FizzyFacepunch/FizzyFacepunch.cs:43)

It doesn't matter if I add 480 as SteamAppID or the SteamID from my own game.

Do you have any idea?

Error While Importing FizzyFacepunch to a project

I was working on a multiplayer game and i tried to add FizzyFacepunch as a Transport. On Import It started to give out those errors.
image

then i imported all of the networking stuff to a brand new project and it happened again.

How to choose SteamSockets?

FizzyFacepunch brings together Steam and Mirror . It supports both the old SteamNetworking as well as the new SteamSockets.

How can I ensure the newer sockets are used in order to avoid IPs from being made public (as happened to Dani with Crab Game)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.