Skip to content

Commit

Permalink
Merge pull request #30 from heathen-engineering/master
Browse files Browse the repository at this point in the history
Recreated Package Manager fix
  • Loading branch information
Chykary authored Nov 24, 2021
2 parents 2885c05 + cc7f560 commit 14144f0
Show file tree
Hide file tree
Showing 30 changed files with 342 additions and 96 deletions.
50 changes: 0 additions & 50 deletions NextCommon.cs

This file was deleted.

34 changes: 24 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,45 @@

This is a community maintained repo forked from **[RayStorm](https://github.com/Raystorms/FizzySteamyMirror)**.

Mirror **[docs](https://mirror-networking.gitbook.io/docs/transports/fizzysteamworks-transport)** and the official community **[Discord](https://discord.gg/N9QVxbM)**.
Mirror **[docs](https://mirror-networking.com/docs/Transports/Fizzy.html)** and the official community **[Discord](https://discord.gg/N9QVxbM)**.

FizzySteamworks brings together **[Steam](https://store.steampowered.com)** and **[Mirror](https://github.com/vis2k/Mirror)** . It supports both the old SteamNetworking and the new SteamSockets.

**NOTE Steamworks.NET has a known issue preventing the use of the new SteamSockets and can only be used if you have implamented Steamworks.NET change set 424 or are using Heathen's Steamworks; if either case is true you will need to uncomment code located in the NextCommon.cs in the ProcessMessage method for the Steam Sockets integration to work**

## Dependencies
If you are using Heathen's Steamworks Foundation or Steamworks Complete you do not need to install Steamworks.NET as they already have it included.

You must have Mirror installed and working before you can use this transport.
**[Mirror](https://github.com/vis2k/Mirror)** FizzySteamworks is also obviously dependant on Mirror which is a streamline, bug fixed, maintained version of UNET for Unity.

You must also have installed and working either
You must have Steamworks.NET installed and working before you can use this transport.
**[Steamworks.NET](https://github.com/rlabrecque/Steamworks.NET)** FizzySteamworks relies on Steamworks.NET to communicate with the **[Steamworks API](https://partner.steamgames.com/doc/sdk)**. **Requires .Net 4.x**

or
## Installation
### Unity Package Manager

Unity Package Manager support is still fairly new but you can use it like so:

1. Open the Package Manager
2. Click the "+" (plus) button located in the upper left of the window
3. Select the "Add package from git URL..." option
4. Enter the following URL:
`https://github.com/Chykary/FizzySteamworks.git?path=/com.mirror.steamworks.net`
5. Click the "Add" button and wait several seconds for the system to download and install the Steamworks.NET package from GitHub.

### Manual

Fewer steps but more error prone and subject to being out of date with the latest changes:

1. Download the latest [unitypackage](https://github.com/Chykary/FizzySteamworks/releases) from the release section.
2. Import the package into Unity.

**[Heathen's free Steamworks Foundation](https://assetstore.unity.com/packages/tools/integration/steamworks-v2-foundation-186949) or [Heathen's premimum Steamworks Complete](https://assetstore.unity.com/packages/tools/integration/steamworks-v2-complete-190316)**
**NOTE: Heathen's Steamworks is built on and includes Steamworks.NET so if you already have that installed you must fully remove it first**

## Setting Up

1. Install Mirror **(Requires Mirror 35.0+)** from the Unity asset store **[Download Mirror](https://assetstore.unity.com/packages/tools/network/mirror-129321)**.
2. Install FizzySteamworks **[unitypackage](https://github.com/Chykary/FizzySteamworks/releases)** from the release section.
3. In your **"NetworkManager"** object replace **"Telepathy"** script with **"FizzySteamworks"** script.
1. Install Steamworks.NET instructions can be found [here](https://github.com/rlabrecque/Steamworks.NET).
2. Install Mirror **(Requires Mirror 35.0+)** from the Unity asset store **[Download Mirror](https://assetstore.unity.com/packages/tools/network/mirror-129321)**.
3. Install FizzySteamworks from package manager as discribed in the above Install step.
3. In your **"NetworkManager"** object replace **"KCP"** with **"FizzySteamworks"**.

## Host
To be able to have your game working you need to make sure you have Steam running in the background and that the Steam API initalized correctly. You can then call StartHost and use Mirror as you normally would.
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions com.mirror.steamworks.net/BidirectionalDictionary.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions com.mirror.steamworks.net/FizzySteamworks.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "FizzySteamworks",
"references": [
"GUID:68bd7fdb68ef2684e982e8a9825b18a5",
"GUID:30817c1a0e6d646d99c048fc403f5979"
],
"includePlatforms": [
"Editor",
"LinuxStandalone64",
"macOSStandalone",
"WindowsStandalone32",
"WindowsStandalone64"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions com.mirror.steamworks.net/FizzySteamworks.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
11 changes: 11 additions & 0 deletions com.mirror.steamworks.net/FizzySteamworks.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
11 changes: 11 additions & 0 deletions com.mirror.steamworks.net/IClient.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
11 changes: 11 additions & 0 deletions com.mirror.steamworks.net/IServer.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 36 additions & 36 deletions LICENSE → com.mirror.steamworks.net/LICENSE
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
MIT License
Copyright Fizz Cube Ltd (c) 2018
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
===
Copyright Marco Hoffmann (c) 2020
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License

Copyright Fizz Cube Ltd (c) 2018

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

===

Copyright Marco Hoffmann (c) 2020

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

MIT License
7 changes: 7 additions & 0 deletions com.mirror.steamworks.net/LICENSE.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
11 changes: 11 additions & 0 deletions com.mirror.steamworks.net/LegacyClient.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
11 changes: 11 additions & 0 deletions com.mirror.steamworks.net/LegacyCommon.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
11 changes: 11 additions & 0 deletions com.mirror.steamworks.net/LegacyServer.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
11 changes: 11 additions & 0 deletions com.mirror.steamworks.net/NextClient.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions com.mirror.steamworks.net/NextCommon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#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
11 changes: 11 additions & 0 deletions com.mirror.steamworks.net/NextCommon.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
11 changes: 11 additions & 0 deletions com.mirror.steamworks.net/NextServer.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 14144f0

Please sign in to comment.