Making a multiplayer mod using Mirror

Discuss modding questions and implementation details.
User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: Making a multiplayer mod using Mirror

Post by BadLuckBurt »

Y07A wrote: Wed Nov 09, 2022 6:28 pm So here is the very first version of this project: https://github.com/EmptyBottleInc/DFU-T ... ultiplayer
It's a build of the 0.14.5 including multiplayer features.
This is using Kcp transport, so if you want to play online, you need to do port forwarding :shock: but dont worry I will soon make a newer version with steam Transport and a tutorial on how setup the thing to play with steam friends.
Thank you, I've forked the repo to hopefully contribute once I grasp how the code works after I give it a look later, I'll give the release a go this weekend if the person I have in mind has some time to spare :lol: or I'll just run two instances but in any case I hope I can assist in turning this into a proper mod or figuring out how to adjust DFU's core to allow for that to work.

I would urge all members of the community who understand how to port forward to do the same and report back with their experience.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

User avatar
Y07A
Posts: 22
Joined: Wed Oct 28, 2020 4:09 pm

Re: Making a multiplayer mod using Mirror

Post by Y07A »

Hey, here is another release: https://github.com/EmptyBottleInc/DFU-T ... es/tag/0.3
This one is including stable steam transport implementation, so no more need to do port forwarding.

I also did a quick tutorial to set up the thing: https://www.youtube.com/watch?v=pEvdcE6smFQ
Here is a demo of it working in local with 4 players: https://www.youtube.com/watch?v=r2yBhFBGo88

This build is adding:
- loot sharing between players
- players attack/walk animations
- Foes position/Death sync
- Door opening (as long as you don't open them with your weapon)
- Improvements and corrections on other features

User avatar
TalonTarp
Posts: 17
Joined: Mon Oct 10, 2022 10:42 pm

Re: Making a multiplayer mod using Mirror

Post by TalonTarp »

Played for a bit with someone on the discord. Didn't have any issues getting in (thankyou for the video tutorial) But we did notice a few things that acted weird.

1) Character Z levels were acting strangely on transitions until save and load. If one of us saved crouching and loaded then stood up it would look like we were floating to the other person. Also had a couple times after screen transition where our co op partner would be airborne on our screen until they saved and loaded.

2) Dropped gold pieces don't sync so while we could share other bits of loot we could not transfer gold (the graphic for an item being dropped did still appear)

3) If one of us loaded into the same area after clearing part of it everything would respawn for the person who reloaded but not for the other.

4) Quests did not sync

5) Enemies from quests would only spawn for the player who took that quest and everyone else could not see or interact with those enemies.

6) the time differences can get strange when it's snowing for one player but not the other.

7) loading in without clearing mod settings prevented us from sharing loot until we cleared our mod settings (rip my setup, time to go through and adjust them all.....again xD )

8) Some doors did not open for the other player when used. Might have been us opening the door while our weapon was drawn but unsure.

9) Guards don't come to attack you if your partner breaks the law.

10) Palace guards Don't aggro to you when your partner attacks them.

User avatar
Y07A
Posts: 22
Joined: Wed Oct 28, 2020 4:09 pm

Re: Making a multiplayer mod using Mirror

Post by Y07A »

TalonTarp wrote: Mon Nov 14, 2022 5:29 pm Played for a bit with someone on the discord. Didn't have any issues getting in (thankyou for the video tutorial) But we did notice a few things that acted weird.
...
Ok, I take note of that, thanks for the feedback !

I will try to put a release this week or next week, focusing on syncing time/meteo between players. Random quests syncing seems to represent a lot of work I think, so I'll focus on it later, when the other things will be working well :D .

Sappho20
Posts: 67
Joined: Wed Jun 29, 2022 8:54 am

Re: Making a multiplayer mod using Mirror

Post by Sappho20 »

Hi,
I have tested the multiplayer mod. It was awesome, really good fun to play with someone! There were issues that I will get to, but overall what worked overshadowed the bugs, it was so much fun to be able to work with someone else in Daggerfall and fight our way through dungeons and travel through the wilderness and towns.

All the testing I did was with no mods, but I intend to play this again adding mods to see how it works.

I would say all of TalonTarp’s feedback is valid and I experienced them all as well.

The biggest difficulty is that enemies have to be activated by all players near simultaneously or else each player cannot see them and they have to kill the enemies individually. Therefore you need to stick very close to other players to kill enemies together. If you leave a dungeon and re-enter then any enemies that activate immediately have to be killed by each player, once done further enemies are fine though, if you stay close to your friends.

In addition, If a player uses a torch it does not light up the place for others.

Also, I never got doors to open for other players, this made enemy activation harder as I would open a door and activate an enemy whilst the other player opened the door second and had to face an enemy I could not see or fight.

There will need to be a sprite for riding a horse and or cart, and when a player dies, there are such sprites as horse riders in other mods. Not a big deal, funny to see my friend suddenly float into the air and speed off on his invisible horse.

Syncing the time (date and time) may be difficult, I wondered if the ‘Host’ should be master of time (and weather), if he rests so do all others, or at least time skips for them (if they rest no time passes), same with fast travel, it may be annoying if someone loses 2 weeks but I imagine most players will stick together so it won’t be a big issue, and players will have to co-ordinate just like in D&D.

Weather effects do not apply to other players: in fog people fade into fog but friends do not.

Leavers (activators) do not work for everyone: in privateers hold the throne does not move up for other players and each player has to use it. Once again not a big issue here, but maybe annoying in a dungeon where everyone has to open a trap or door as players cannot split up.

This MOD has one really big advantage and that is the casual nature of the multiplayer! You can use any saved game and players can join you or leave without any issue. I can play a single player game and get my friends to join me for 1 dungeon or adventure. They can leave and I can go back to single player afterwards! In fact, there is no obligation for other players to be anywhere near you at all. It seemed to work fine with one of us in Daggerfall City and me in Wayrest. Basically, you are not locked into a multiplayer game once started (perhaps if people used the Immersion Role MOD then it would add to each players motivations rather than just the main quest).

All in all I really appreciate the hard work that has gone into this and I look forward to any updates! I highly recommend others to try this mod too.

User avatar
Y07A
Posts: 22
Joined: Wed Oct 28, 2020 4:09 pm

Re: Making a multiplayer mod using Mirror

Post by Y07A »

Hi here,

I'm seeing that more and more people are interested in this project by the forums and by youtube, thanks for the feedback :D

I made another release on github, the 0.4.
This one is focusing on Time/Weather syncing, interactables objects activation syncing. It also add a menu, there is only 2 options for now "Time controlled by host only" and "Display players names", but now that it's implemented It will be useful for later features. It comes with Many other things and improvements, you can see the release notes on github.

link: https://github.com/EmptyBottleInc/DFU-T ... es/tag/0.4

dartoxer
Posts: 5
Joined: Mon Aug 12, 2019 11:09 pm

Re: Making a multiplayer mod using Mirror

Post by dartoxer »

Hello!

First of all, thank you for doing this! Playing Daggerfall in multiplayer is a dream come true :).


Two things:

1. It seems the monsters in dungeons are only synced if the players are the same level and the generated monsters are the same. For example, when me and my coop partner are both level 2 and we enter a dungeon (Druigod) the monsters are bears, giants and orcs and everything was in sync. However if I was level 3, the generated monsters were scorpions, giants and tigers and the other player couldn't see them and I couldn't see his. We tested this multiple times and the dungeon monsters are always out of sync if the players are different levels.


2. This is a weird one. No matter where you are in the world, players can see each other in the distance and even "meet up" by walking. Even though in their own game they are in completely different zones. For example I was next to a dungeon entrance in Daggerfall zone and my coop partner was in a town in Sentinel zone. I could see him in the distance and I walked up to him. In my game he was standing in the middle of a forest and in his game I was in town. Is this because each pixel on the world map is a separate zone and the player sprites are displayed in every zone? If you want to test this, make sure to enable tcl in the console and go under the map because due to the difference in terrain height (z coordinate) sometimes the other player is under the map or flying in the sky.

User avatar
Y07A
Posts: 22
Joined: Wed Oct 28, 2020 4:09 pm

Re: Making a multiplayer mod using Mirror

Post by Y07A »

dartoxer wrote: Wed Nov 23, 2022 3:39 am Hello!

First of all, thank you for doing this! Playing Daggerfall in multiplayer is a dream come true :).


Two things:

...
I just forgot that the enemies filling in dungeons is linked to the player level :shock: .

Thank you for pointing out this issue, it's a really big one for the multiplayer experience.

I'm currently working on and I will include it in the last release, as well as the other issue you pointed out.

User avatar
Y07A
Posts: 22
Joined: Wed Oct 28, 2020 4:09 pm

Re: Making a multiplayer mod using Mirror

Post by Y07A »

So I made an other release correcting the "differents enemies in dungeon" situation, now enemies are set using host level. This release is also adding random encounters syncing, as well as city guards, so now you should see most of the time same enemies as the others players :o .

Let me now if you get some issues.

Link to the 0.5: https://github.com/EmptyBottleInc/DFU-T ... es/tag/0.5

dartoxer
Posts: 5
Joined: Mon Aug 12, 2019 11:09 pm

Re: Making a multiplayer mod using Mirror

Post by dartoxer »

Thank you for the update. I tested 0.5 and here are my observations.

- Dungeon monster types (rat, bear etc) are now shown correctly based on the host's level.
- Random spawns from resting/waiting are synced.

Dungeon issues:


Sometimes the player who enters first gets duplicated monsters as soon the other player also enters. The second player only sees one monster.

- Player 1 who sees the two monsters has to kill both. And when he kills the first of the two, the one monster for player 2 also dies.

- If player 2 kills his own monster, both duplicates automatically die for Player 1.

Quest spawn issues:

We tested a few different fighter's guild quests. Spawning is buggy right now. I will to go into details for each one.

Player1 = quest owner
Player2 = the "follower"

The TLDR version is that quest monsters only spawn for Player2 if he is already in the same instance (house, dungeon, outside world) as Player1 when the spawn happens. And even then for certain quests it only spawns for Player2 about half the time. Also, if Player1 kills the quest monster it dies in both games. However if Player 2 kills it, it only dies in his own game.

We switched host/client multiple times during testing and it didn't affect the outcome.

Detailed version for quest spawns:

- Harpy infested house / Werewolf hunting in a dungeon: As soon Player1 enters the house/dungeon, the game spawns the quest monster. This means if Player1 enters first, the monster will spawn before Player2 could enter and Player2 won't see the monster. If Player2 enters first and Player1 follows, then I would say there is a 50% chance the quest monster will spawn for Player2 and 50% chance it won't. We tested this with Player1 entering and re-entering the house/dungeon multiple times while Player2 is already inside and the spawn is very buggy for Player2. Player1 can always see the quest monster.

- Bat infested house: This is a quest where the monsters don't immediately spawn as soon you enter the house. So if both players are inside when the spawning begins (5-10 seconds after Player1 enters), the monsters spawn correctly for both players.

- Issue with both quests: Even if the monsters spawn correctly for both players, monster death isn't entirely in sync. If Player2 kills a quest monster, it only dies in his game and in Player1's game it's still alive. However if Player1 kills the quest monster it dies in both games.

Post Reply