Multiplayer Mod Support?

I'm trying to make a multiplayer game somewhat similar to Garry's Mod, but I'm running into an issue during testing/planning.

I'd like to structure it similar to Minecraft Forge's server system. Where the server contains the mods people will play with. And it requires them to have those mods. But I'm not sure how to sync everyone's mod objects together.

Currently, I have a ModContentManager that takes the content from the mod (An AssetBundle) and puts them into their own list. (Vehicles, Maps, Props, etc.) But none of the objects are synced.

I originally ran a test where a player would spawn an object, but only sometimes it would spawn for the other players.

I'm not sure what I should do... Could someone give me some insight on this? I'm currently very confused.
If you need any info like code or screenshots, just ask and I'll be glad to give it.

Most games prevent joining a server without having the required mods. I'd suggest a similar system. Whether you want to just tell the user what mods they need to get, or automate the download/install of these mods on first join to the server, is up to you.

[quote]
I originally ran a test where a player would spawn an object, but only sometimes it would spawn for the other players.
[/quote]

I'm not clear if you're referring still to not having the required mods, or some network spawn syncing issue. If the latter the solution is probably specific to whatever network API you are using. For all I know you're just sending network spawn messages as unreliable messages and they are getting lost along the way.

[quote]
I'm not sure what I should do... Could someone give me some insight on this? I'm currently very confused.
If you need any info like code or screenshots, just ask and I'll be glad to give it.
[/quote]

I'd tackle the network syncing issue first, without involving mod support, as a network syncing issue you can't fix will end up a deal breaker for any game.

unrelated question for my current game, what system are you using for the multiplayer and how do you get it to sync player movements with little latency. i am currently using Photon (PUN) and have a script to Sync player movements but its very laggy even tho i have removed the rigid body from the player if its not thiers. thanks for the help and hopefully you do good on your game, maybe send the link so i could try it for my self one time. it seems fun!


unrelated question for my current game, what system are you using for the multiplayer and how do you get it to sync player movements with little latency. i am currently using Photon (PUN) and have a script to Sync player movements but its very laggy even tho i have removed the rigid body from the player if its not thiers. thanks for the help and hopefully you do good on your game, maybe send the link so i could try it for my self one time. it seems fun!

I’m using Mirror for my networking solution.

For syncing, I’m just using Mirror’s standard NetworkTransform component, and it works most of the time… But I haven’t put it through any tough testing yet. I do have a few ideas though once I test it.

Thanks so much, I’ll try mirror also is it hard or...

Mirror is very similar to UNet. (Unity’s original networking solution)
You can sometimes follow along with Unity’s Documentation:
https://docs.unity3d.com/Manual/UNet.html
And here’s their official docs:
https://mirror-networking.com/docs/

Happy coding! :slight_smile:

Hey @Joe-Censored ... I have been testing and fiddling with stuff. Syncing seems to work properly, but clients and servers can't send information to each other.

I've found out about NetworkMessages from this forum post :
[quote]
2) On Client1 send a Message to the server which includes the string when the send button is pressed. When the server receives the string, the server sends a message to Client2 again including the string. When Client2 receives the string it updates the text box with the contents. (This is the way I would do it)

https://docs.unity3d.com/Manual/UNetMessages.html
[/quote]

I have tried following Mirror's documentation page about it, constructed something similar and attempted to test it... But I get this error:

Unknown message ID 61784 connection(0)
UnityEngine.Debug:LogError(Object)
Mirror.NetworkConnection:InvokeHandler(Int32, NetworkReader, Int32) (at Assets/Mirror/Runtime/NetworkConnection.cs:275)

The code for the message I send is inside of a Player Manager. Currently, I'm trying to make the client grab the server's map, check if it has it, and then load it if so.
It's called for each player from an event in my Custom Network Manager called EventPlayerAdded which is called in the OnPlayerAdded method of the network manager.

public class PlayerEventAnnouncement : MessageBase
{
    public string message;
}

public void Announce(string message)
{
    PlayerEventAnnouncement announcement = new PlayerEventAnnouncement()
    {
        message = message
    };

    NetworkServer.SendToAll(announcement);
}

public void OnAnnouncement(NetworkConnection conn, PlayerEventAnnouncement announcement)
{
    Debug.Log("Announcement: " + announcement.message);
}

What's causing this error, and how could I fix it?
Also do you have any tips on how I could get the most out of these NetworkMessages? Because I think they might just be the solution I've been looking for all along. :)