chykary / fizzysteamworks Goto Github PK
View Code? Open in Web Editor NEWThis project forked from raystorms/fizzysteamymirror
A transport for Mirror using Steam / Steamworks.NET
This project forked from raystorms/fizzysteamymirror
A transport for Mirror using Steam / Steamworks.NET
Although valve are saying they will remove the old solution soon, using next gen steam networking has a high chance disconnecting players from fragile steam p2p connection, while untick the toggle makes the connection a lot more stable.
For example it will through "Connection was closed by peer, Timed out attempting to connect" frequently.
Recently another problem tirggered me mad, that in the Steam lobby meta data, I am using a string called "password" to store the password of player's lobbies, an issue occurred for a week that the password function is not working anymore, after hours of debugging I found that Valve auto changed 'p' to uppercase 'P' in the background, which is pretty ridiculous, shouldn't they fix this bug which has been added randomly? I guess they are on vacation now.
Personally I plan to stick to the old networking solution until Valve abandon them. Hope this help those who are getting bothered by related problems.
Trying to install for the first time ever can't seem to figure out
-Assets\Mirror\Runtime\Transports\FizzySteamworks\LegacyServer.cs(14,35): error CS0246: The type or namespace name 'TransportError'
-Assets\Mirror\Runtime\Transports\FizzySteamworks\NextServer.cs(14,35): error CS0246: The type or namespace name 'TransportError' could not be found
Fizzy: 5.1
Unity: 2021.3.11
Steamworks foundation: 2.20.8
Mirror: 2022.10.0
Tried also with just SteamworksNET: 20.1.0 instead of foundation and the same errors appear
While connecting throws this error, hosting still works without a problem.
IndexOutOfRangeException: Index was outside the bounds of the array. Seems to be something to do with the byte array in line 74 of Common. Any ideas? :)
IndexOutOfRangeException: Index was outside the bounds of the array. Mirror.FizzySteam.Common.Send (Steamworks.CSteamID host, System.Byte[] msgBuffer, System.Int32 channel) (at Assets/FizzySteamyMirror/Common.cs:74) Mirror.FizzySteam.Common.SendInternal (Steamworks.CSteamID target, Mirror.FizzySteam.Common+InternalMessages type) (at Assets/FizzySteamyMirror/Common.cs:73) Mirror.FizzySteam.Client+<Connect>d__22.MoveNext () (at Assets/FizzySteamyMirror/Client.cs:61) UnityEngine.Debug:LogException(Exception) Mirror.NetworkClient:OnError(Exception) (at Assets/Mirror/Runtime/NetworkClient.cs:152) UnityEngine.Events.UnityEvent
1:Invoke(Exception)
Mirror.FizzySteam.<>c__DisplayClass21_0:b__3(Exception) (at Assets/FizzySteamyMirror/Client.cs:35)
Mirror.FizzySteam.d__22:MoveNext() (at Assets/FizzySteamyMirror/Client.cs:79)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(d__22&)
Mirror.FizzySteam.Client:Connect(String)
Mirror.FizzySteam.Client:CreateClient(FizzySteamyMirror, String) (at Assets/FizzySteamyMirror/Client.cs:39)
Mirror.FizzySteam.FizzySteamyMirror:ClientConnect(String) (at Assets/FizzySteamyMirror/FizzySteamyMirror.cs:81)
Mirror.NetworkClient:Connect(String) (at Assets/Mirror/Runtime/NetworkClient.cs:86)
Mirror.NetworkManager:StartClient() (at Assets/Mirror/Runtime/NetworkManager.cs:390)
d__20:MoveNext() (at Assets/Scripts/Networking/MyNetworkManager.cs:152)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
MainMenu:ButtonJoin() (at Assets/Scripts/Menus/MainMenu.cs:149)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2019.3.0f5/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)
`
Here is a screenshot of the console messages
https://i.imgur.com/oHWL5To.png
This error shows up in my console after importing FizzySteamworks.
it leads to this code
`#if !DISABLESTEAMWORKS
using Steamworks;
using System;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Mirror.FizzySteam
{
public abstract class NextCommon
{
protected const int MAX_MESSAGES = 256;
protected EResult SendSocket(HSteamNetConnection conn, byte[] data, int channelId)
{
Array.Resize(ref data, data.Length + 1);
data[data.Length - 1] = (byte)channelId;
GCHandle pinnedArray = GCHandle.Alloc(data, GCHandleType.Pinned);
IntPtr pData = pinnedArray.AddrOfPinnedObject();
int sendFlag = channelId == Channels.Unreliable ? Constants.k_nSteamNetworkingSend_Unreliable : Constants.k_nSteamNetworkingSend_Reliable;
EResult res = SteamNetworkingSockets.SendMessageToConnection(conn, pData, (uint)data.Length, sendFlag, out long _);
if (res != EResult.k_EResultOK)
{
Debug.LogWarning($"Send issue: {res}");
}
pinnedArray.Free();
return res;
}
protected (byte[], int) ProcessMessage(IntPtr ptrs)
{
SteamNetworkingMessage_t data = Marshal.PtrToStructure<SteamNetworkingMessage_t>(ptrs);
byte[] managedArray = new byte[data.m_cbSize];
Marshal.Copy(data.m_pData, managedArray, 0, data.m_cbSize);
SteamNetworkingMessage_t.Release(ptrs);
int channel = managedArray[managedArray.Length - 1];
Array.Resize(ref managedArray, managedArray.Length - 1);
return (managedArray, channel);
}
}
}
#endif // !DISABLESTEAMWORKS`
trying to just delete the "ptrs" from the argument causes a new error
Assets\Mirror\Runtime\Transport\FizzySteamworks\NextCommon.cs(36,13): error CS0120: An object reference is required for the non-static field, method, or property 'SteamNetworkingMessage_t.Release()'
If I replace SteamNetworkingMessage_t.Release() with data.Release() no errors occur
Hi, I just recently installed the unitypackage and after its imported it seems to be getting 3 errors in the Unity Console. The errors I recieve are as follows:
Error 1 :
Assets\Mirror\Runtime\Transport\FizzySteamworks\FizzySteamworks.cs(105,30): error CS0508: 'FizzySteamworks.ClientSend(int, ArraySegment<byte>)': return type must be 'bool' to match overridden member 'Transport.ClientSend(int, ArraySegment<byte>)'
Error 2:
Assets\Mirror\Runtime\Transport\FizzySteamworks\FizzySteamworks.cs(163,30): error CS0115: 'FizzySteamworks.ServerSend(int, int, ArraySegment<byte>)': no suitable method found to override
Error 3:
Assets\Mirror\Runtime\Transport\FizzySteamworks\FizzySteamworks.cs(11,18): error CS0534: 'FizzySteamworks' does not implement inherited abstract member 'Transport.ServerSend(List<int>, int, ArraySegment<byte>)'
I have tried using both versions 2.6 and 2.6.1 but I receive the same error for both. Any help would be appreciated! Thank you!
Your release package is out of date from the current state of the code on master.
Also happy to help get this project set to use package manager if you would like, this would remove the need to package a release unitypackage up saving you a step and insuring people are on the latest by simply running the in Unity package manager
Hi just wanted to let you know that in the new Mirror version, the return type of the ServerSend and ClientSend is now void, hence breaking the Transport FizzySteamWorks override. Also ServerSend now return only 1 connection id instead of the list
Hi,
I have just imported mirror into my project and imported the Fizzy Steam works file however I get the below errors (I have not changed anything)
Assets\Mirror\Runtime\Transport\FizzySteamworks\LegacyServer.cs(27,71): error CS7036: There is no argument given that corresponds to the required formal parameter 'arg3' of 'Action<int, TransportError, string>.Invoke(int, TransportError, string)'
Assets\Mirror\Runtime\Transport\FizzySteamworks\NextServer.cs(42,71): error CS7036: There is no argument given that corresponds to the required formal parameter 'arg3' of 'Action<int, TransportError, string>.Invoke(int, TransportError, string)'
Any idea why these error are coming up?
Hello, I have a problem, after importing FizzySteamworks-2.6.1 it gives a bunch of errors, here is the link to the photo: (https://yadi.sk/i/WtaOQ7R6109J9g) how can I fix the errors?
Apparently I recently discovered that when I build my game, the steam API cannot be initialized, future research has lead me to the fact that I need a steam App ID in the game directory and that it must be launched through steam, I was able to do that, however it still does not connect to the steam API. Is this an issue, or is there something I don't know about this forked Repo of the original maintained fizzysteamworks repo. I discovered in that one that the Steam manager script has a App ID in it.
Ive only tested this with RPCs but setting any of the channels to unreliable and then using it with an RPC call doesnt seem to fire the RPC at the other end. However, changing the channel type back to reliable works. So for example if i set an rpc to use channel 2, if channel to is reliable it works, if its unreliable it doesnt.
Hi there! I was just following a YT tut on getting this setup, I downloaded the last Unity Package shown in releases (v5.1) and after importing it to unity it only imported a few scripts. The tutorial I was using is a few years old now, and was using version 2.5.2. I downloaded the older release and sure enough it contained all the files I needed. Just pointing this out as I'm not sure if this is expected behaviour or not. It should be noted that Steamworks.NET stuff were the majority of the missing and causing the package from not working properly!
Hello, I am trying to make a multiplayer game with steam, so I'm currently using Mirror and FizzySteamworks. After following the DapperDino tutorial, everything worked. I went a little further, and nothing worked, so I came back few commits backward to when it was still working an I still have the same mistakes which is blowing my mind, here's the error I'm getting Server and Client side : https://cdn.discordapp.com/attachments/775305953922252810/908774217904971816/unknown.png
https://cdn.discordapp.com/attachments/775305953922252810/908774366387535942/unknown.png
When running SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePrivate, manager.maxConnections);
My callback from steam says k_EResultAccessDenied instead of k_EResultOK
My steam app id is 480 (Spacewar)
Why does Steam deny my create lobby request?
Unity: 2021.3.12f1
Mirror: 2022.9.15
FizzySteamworks: 5.1
Your transport uses a lot of client only interface calls so wont work on a steam game server
We have created a variant that wraps these with
#if UNITY_SERVER
// server variant
#else
// client variant
#endif
That said its based on our framework not Steamworks.NET so wouldn't work in your case but wanted to raise this to you. but you are welcome to it https://www.dropbox.com/s/topkpniiqshroo7/SteamMirrorTransport.cs?dl=0
Follows is a list of the modifications we made
Note we are aware of either a bug or at least bit of confusion around GameServer.Init with the Steamworks.NET wrapper causing issues on port bindings. So if you go to test this you may run into that you can see more on that here rlabrecque/Steamworks.NET#407
Step 2 in the README asks to replace "KCP" with "FizzySteamworks" in the NetworkManager, however the only reference to KCP in NetworkManager.cs is using kcp2k;
and replacing this line with using FizzySteamworks;
generates an error.
First of all, I'm sorry for asking it here as an issue!
I want to create a Steam friends server browser, which, as it says, it displays the client-hosted servers created by my friends. This is my second day of just research in this matter and I am not able to connect any dots. I have looked through:
I managed to make the Mirror's NetworkManager work using FizzySteamworks as the transport. Managed to Host/Join using User Steam ID (using the default HUD Mirror provides in the Unity package). Managed to make players sync movement and rotation.
I saw that in the Steamworks.NET Test project, I can create and join a lobby.
What I would like to know:
I have more questions, but they all depend on whether or not the button creates a server or a lobby.
Hi,
I was testing the Transport, but wanted to disabled it for some builds etc.
However, by disabling the component it was still running some code that requires Steam to be running.
I had to add the following code in the Awake function:
if(!enabled) { return; }
I think this should be a feature in this transport anyway.
Thanks for you work!
When you change scenes to a new scene with NetworkManager Mirror automatically destroys the duplicate NetworkManager GameObject.
The FizzySteamworks.cs on the NetworkManager GameObject then calls its OnDestory() method which calls Shutdown().
Since client and server are static the Shutdown method shuts down the connection.
Hi,
I recently updated the version and ran into a problem: in the old version, I could transfer up to 1 MB of data per second. But in the new version, if I leave "UseNextGenSteamNetworking" enabled by default, I can only send 1 MBit per second.
If I overshoot this size, I get an error:
Send issue: k_EResultLimitExceeded
In:
Assets/Mirror/Runtime/Transport/FizzySteamworks/NextCommon.cs:23
Assets/Mirror/Runtime/Transport/FizzySteamworks/NextServer.cs:161
Assets/Mirror/Runtime/Transport/FizzySteamworks/FizzySteamworks.cs:209
Assets/Mirror/Runtime/NetworkConnectionToClient.cs:118
Assets/Mirror/Runtime/NetworkConnectionToClient.cs:171
Assets/Mirror/Runtime/NetworkServer.cs:1529
Assets/Mirror/Runtime/NetworkServer.cs:1559
Assets/Mirror/Runtime/NetworkLoop.cs:188)
...
However, GetMaxPacketSize returns 512 * 1024 which is half a megabyte.
Is this the expected behavior? Has the new API reduced the maximum transfer rate by 8 times? If my game uses more than one megabit, do I need to stay on legacy p2p?
Thx.
When I have the server switch scenes for all players the console returns the following error client-side as soon as they change scenes:
"NullReferenceException: Object reference not set to an instance of an object
Mirror.FizzySteam.FizzySteamworks.ClientSend (System.ArraySegment`1[T] segment, System.Int32 channelId) (at Assets/Mirror/Runtime/Transport/FizzySteamworks/FizzySteamworks.cs:140)"
I am assuming a reference gets lost between the scenes but I don't know what. For more clarification the player objects dont destroy on load
Hello.
Will you add support for the latest Mirror version (v44.0.0)?
Hi i get this warning
Assets\Mirror\Runtime\Logging\NetworkHeadlessLogger.cs(13,31): warning CS0414: The field 'NetworkHeadlessLogger.showExceptionStackTrace' is assigned but its value is never used
I'm currently learning mirror and I'm almost done.
I'm trying to link a multiplayer game to Steam, and I've been looking around, but I have no idea how to do it, can you give me a simple example? If it's not convenient to give a complete one, you can just tell me some key code, like how to link a steam socket to mirror, etc.
Thanks!
Hi, I don't know when this problem has been with me since.
I have tried to modify FizzySteamworks.Timeout but it doesn't solve the problem.
But there is one thing, sometimes this problem does not occur, but most of the time it is not linked to the host.
I hope you can answer it directly here, there are too many people in Discover and I don't think anyone cares about my problem.
Thank you very much!
NextClient will not call its own OnDisconnected
event if disconnection is run via FizzyTransport.Shutdown
(which include voluntary disconnect) which does not call NextClient.InternalDisconnect
, result in transport.OnClientDisconnected
never called, result in NetworkClient.RemoveTransportHandlers
never called.
This will become error elsewhere such as client will fire AddPlayerMessage
multiple times, etc.
Just to cross post it here from Mirror github repo issue.
Full detail is in my comment in that issue.
Add following line to your "FizzySteamworks\NextClient.cs" at location in this screen shot.
if( Connected )
InternalDisconnect( );
public override void ServerDisconnect(int connectionId)
unity 2021.3.0f1
mirror 71.0.0
steamwork.net Release 20.1.0
FizzySteamworks 5.1
All are now the latest version
Test with the simplest project, replace KCP with FIZZY
No matter how you measure it, it can't be connected
What version can you connect to now?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.