How To Make Player Movement - Steam Multiplayer Game in Unity

  Рет қаралды 25,784

Zyger

Zyger

Күн бұрын

In this video I will be showing you how to implement player movement. I will go over how to firstly move every player into the game scene. Then how to spawn players for every connection and create movement that syncs across the server.
-----Tutorial Links-----
Previous Video: www.youtube.com/watch?v=kld9s...
Mirror: assetstore.unity.com/packages...
FizzySteamworks: github.com/Chykary/FizzySteam...
Steam Docs: partner.steamgames.com/doc/home
Source Code: / 62190558
-----My Personal Links-----
Discord: / discord
Instagram: / gabzxd
Twitch: / officialzyger
Twitter: / zygerdesigns
➤WISHLIST MY GAME:
store.steampowered.com/app/16...
----Time Stamps-----
0:00 - Intro
0:11 - Transferring Players to a Game Scene
3:00 - Player Object Modifications
4:13 - Player Movement Script
7:23 - Syncing Movement
8:30 - Testing

Пікірлер: 122
@aryavatan
@aryavatan 2 жыл бұрын
Thanks for making this whole series on multiplayer development in Unity. As a relatively beginner game dev myself I still haven't dabbled with multiplayer but your tutorials will finally help me understand how multiplayer development works.
@ItsTheHolyPotato
@ItsTheHolyPotato 3 ай бұрын
For everyone who can't get the not host players movement to work, changing Sync Direction in the Network Transform component of the PlayerObject Prefab to "Client to server" worked for me.
@Shahmuradov
@Shahmuradov 2 жыл бұрын
Amazing tutotiral series! Looking forward to part 5 where we the camera follows each player's character
@LeoStaley
@LeoStaley 2 жыл бұрын
GMTK just asked us to vote for him for the Unity devlog award, andI found you by looking at the other contestants. I voted for him, but I've subscribed to you now.
@taikigrim
@taikigrim 2 жыл бұрын
Thank you for these tutorials, really looking forward for follow ups :)
@theus81423
@theus81423 15 күн бұрын
If you're following this tutorial and you're making a 2D version rather than a 3D version and one or more of your player prefabs are randomly not appearing 1) Make sure the Main Camera's Z position in your level scene has a smaller value than your player prefab. The player prefab Z position seems random, and the camera is at -10 by default. This means that if your player is spawned with a Z-axis position of -11, your prefab will be invisible. One way to fix this is to set the Main Camera's Z position in your level to be very small (-100 or so). 2) The client's prefab may spawn at an arbitrarily large X and Y coordinate position. It's not that the client's prefab didn't load, it's that it loaded in a position that is not being displayed by the camera. 3) This tutorial seems to work with the latest versions of Mirror and Fizzy Steamworks. You will need to change all references of "hasAuthority" to "IsOwned" as others have already mentioned.
@ImNotGam
@ImNotGam 2 жыл бұрын
I love the tutorial. I use Godot myself, so I have no use for this. But I love seeing how other people program these things. It's also very weird to see that it's a lot easier to do networking in Unity, as a lot more stuff is built in, as it's a more popular engine. I'll still be watching because it's a great video nonetheless.
@yaaannn8126
@yaaannn8126 2 жыл бұрын
this is so helpful ty so much
@yorimur
@yorimur 2 жыл бұрын
Amazing explanation ❤ Please continue 💪 So, Can we do animations same way movement ?
@0gameir834
@0gameir834 2 жыл бұрын
Hi, thank you very much, please include a select map tutorial if possible.
@robert.thompson
@robert.thompson 2 жыл бұрын
These videos are really good! I would recommend going a little slower maybe, I have to pause a lot!
@ZygerGFX
@ZygerGFX 2 жыл бұрын
thank you. noted! i jsut try to make the video not so long as some people just dont want to watch longer videos but i will keep it in mind.
@JohnnyCodes
@JohnnyCodes 2 жыл бұрын
Unfortunately making fast paced videos are a requirement for youtube. If you don't get enough watch time youtube won't share it even though a slower video might have been easier to understand. I struggle with this when I try to make entertaining tutorials too. They end up being more for entertainment rather than tutorial but it is a fine balance. That is why I have heard some creators say it is much easier to make a tutorial on a different site like skillshare or udemy because those algorithms don't reward watch time as much as youtube.
@brodiemcilfatrick7911
@brodiemcilfatrick7911 2 жыл бұрын
Love this series so far. Just curious how you would implement multiple colliders on a moving object. Eg. Character has arms and a sword which move and have their own colliders as well as the body. As you said we have to have physics components on the main player object. Thanks 😀
@brunoayre2234
@brunoayre2234 Жыл бұрын
Same question. Not too sure how to implement it though...
@lukakvlogs1478
@lukakvlogs1478 2 жыл бұрын
Love this series!!
@ZygerGFX
@ZygerGFX 2 жыл бұрын
thank you
@studio_gimbap
@studio_gimbap 6 ай бұрын
Thank you very much!
@halladutchi
@halladutchi 2 жыл бұрын
Love this series and need it so much! Thank you an please continue! :)
@pala9983
@pala9983 2 жыл бұрын
Nice tutorial!
@ZygerGFX
@ZygerGFX 2 жыл бұрын
thanks
@thoride_
@thoride_ 2 жыл бұрын
Once again great tutorial! Looking forward to the next one. Any chance there will be a video on how to quit the lobby and take you back to the host scene? I keep getting an error that the SteamAPI is trying to get initialized twice. Can't figure out how to get around this. Thanks!
@itsjstleo
@itsjstleo Жыл бұрын
I'm trying the same thing at the moment. Did you get any solutions?
@ohnepixel_enjoyer
@ohnepixel_enjoyer Жыл бұрын
@@itsjstleo you fixed it?
@olof4476
@olof4476 Жыл бұрын
Did you find a solution? struggling with the same problem atm
@itsjstleo
@itsjstleo Жыл бұрын
@@ohnepixel_enjoyer nope...
@theconfusedllama9405
@theconfusedllama9405 4 ай бұрын
Create an empty game object and MOVE the SteamManager script from the NetworkManager game object to the new game object.
@williamrosengren3139
@williamrosengren3139 2 жыл бұрын
Good Tutorial :)
@ZygerGFX
@ZygerGFX 2 жыл бұрын
Thanks!
@Njoyy-wo9ti
@Njoyy-wo9ti Жыл бұрын
Just a question, If I want objects getting destroyed over the network or like Vfx show how would I do that ?
@Chrizzonator
@Chrizzonator Жыл бұрын
In my case I want to make a turn-based strategie game with multiple characters per player. Do you have some suggestions how to handle this easily? I mean you choose that the PlayerIdentity keeps as a parent of a character model which I guess is not the solution for my problem.
@Keroyz
@Keroyz Жыл бұрын
Hello Zyger! How I could use my Monobehaviour playermovement script on the network behaviour? For you, you use networkbehaviour on the script but since mine uses Monobehaviour functions and when I switch it to NetworkBehaviour it causes errors, do you or anyone know how to implement the script to work correctly with NetworkBehaviour?
@youtuber9991
@youtuber9991 Жыл бұрын
Great videos! But I'm pretty confused: 1) Is the connection/game actually being hosted through steam? If not, where would it be hosted? 2) How and where does the server logic come into play which would actually monitor and enforce the rules of the game?
@ZygerGFX
@ZygerGFX Жыл бұрын
The hosting is through steam but the user who starts the host is the owner / admin of the server. Meaning they can change how it works. If you're using mirror there are restrictions on what you can do with the server logic, since most of it is done through mirror. I recommend reading the mirror docs for that. Although there are also server things you can chnage or control through steamworks. Once again just read up on it in the mirror or steamworks docs
@zywiiz4729
@zywiiz4729 9 ай бұрын
Hello, when i change the scene all client are disconneted, why? Thx for your answer
@Keroyz
@Keroyz Жыл бұрын
4:59 doesn't OnLevelLoaded(){} Function work the same? I'm asking because I think that updating to check if the SceneManager is on a currently level each frame sounds performance heavy.
@ZygerGFX
@ZygerGFX Жыл бұрын
It works similarly yes. The methodbI showed in video isn't really what you shpuld be doing if you actually want to release a game. But for simplicity of the video it's what I showed.
@justinsijbolts
@justinsijbolts Жыл бұрын
"Previous video" doesn't seem to be working in the description
@kristianwant6775
@kristianwant6775 2 жыл бұрын
Great tutorial! Following these have been so great, and very impressive. Although, the only issue i have now is when i run the game, one player spawns as per the script intends (in a random but assigned location), and the other player always spawns at x=0, y=0, z=0. I've looked through the video a few times again and im fairly sure everything matches up. do you have any ideas?
@lilwilly4953
@lilwilly4953 Жыл бұрын
I have the same issue
@kristianwant6775
@kristianwant6775 Жыл бұрын
@@lilwilly4953 let me know if you solve it! I gave up after this haha
@FedeRzVz
@FedeRzVz Жыл бұрын
@@kristianwant6775 Some news?
@kristianwant6775
@kristianwant6775 Жыл бұрын
@@FedeRzVz unfortunately not, i stopped following the tutorials after this
@FedeRzVz
@FedeRzVz Жыл бұрын
@@kristianwant6775 mhh so sad, do you remember trying something like modifying the spawn position? Something like for example that they reappear at a given height so that it does not appear below the map?
@tobin7673
@tobin7673 2 жыл бұрын
I feel like having a tutorial on character customization is like a necessity for these kinds of series imo. I think it would be a nice to have because in this day and age, a lot of devs want to turn their local multiplayer games into an online game.
@ramonhiide
@ramonhiide 2 жыл бұрын
Maybe someone can help me... Everything works, BUT when the game starts only one player is on it. I rewatched the tutorial but didnt get what I did wrong... any ideas? Thank you! Keep up the good work Zyger!
@ZygerGFX
@ZygerGFX 2 жыл бұрын
come join my discord and see if anyone can help you!
@iamskyrimwarrior
@iamskyrimwarrior 2 жыл бұрын
Same problem. But how I can see it's like each player has own map.
@confus1on723
@confus1on723 Жыл бұрын
I have the same issue. How did you fix it?
@sebastianschafer7751
@sebastianschafer7751 Жыл бұрын
Did you fix it? For me only the host is visible
@FedeRzVz
@FedeRzVz Жыл бұрын
@@sebastianschafer7751 Did you fix it?
@syncronice8070
@syncronice8070 Жыл бұрын
Hey how can i load more then 1 scene, i try it now since days
@channeltrash6257
@channeltrash6257 2 жыл бұрын
Hey Zyger, or anyone who can help: i watched lobby list video, and if i start a game and the other client tries to join the STARTED GAME then the game craches out.
@neutron3768
@neutron3768 2 жыл бұрын
please, make a video on how we can list these lobbies.
@serefcaliskan4865
@serefcaliskan4865 2 жыл бұрын
" The object of type 'GameObject' 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." If you are getting similar errors and cannot move, it means that you have done the character setup wrong. I discovered two solutions to this; 1- Making a regular and simple character or 2- Using the character in the lobby scene Description: The character is created with the button in the Main menu scene. It is destroyed "because we don't want it" in the lobby scene. It is reborn with the "Game Scene" and "make a decision!" she revolts.
@xzcw2953
@xzcw2953 Жыл бұрын
Does this use the new stem network
@Keisuke_Baji
@Keisuke_Baji 2 жыл бұрын
Ты лучшая! :3
@ashdev
@ashdev Жыл бұрын
i can notice a delay between host and client. can it be real time like pubg and other fast paced games where there is no delay? if yes how? most of the tutorials i saw have a delay. i dont know about multiplayer stuff. please help.
@ZygerGFX
@ZygerGFX Жыл бұрын
delays are in every type of online game, even PubG. But they make it less noticeable with a few tactics. One of which is client side prediction. But there are plenty of solutions to latency so i recommend you read up on it :))
@simplisticgames2036
@simplisticgames2036 Жыл бұрын
I am having a problem with the players that when I switch scene they are losing Authority. Anyone else have this problem? (I know this because I ran a Debug.Log(hasAuthority); ) and in the Lobby it says True as soon as we get into the game it says False.
@YadroGames
@YadroGames 2 жыл бұрын
your tutorials like Brackeys, But not face to face and black background, ;)
@t0xangames207
@t0xangames207 Жыл бұрын
1:16 Why do I need this line if it is already DontDestroyOnLoad ?
@quackncheese
@quackncheese Жыл бұрын
With newer versions of Mirror it says ClientAuthority is obsolete.. any ideas on what to do?
@interactivewavestudios
@interactivewavestudios Жыл бұрын
Change everywhere in every script where you have "hasAuthority" to "isOwned"
@thepancakeexpert
@thepancakeexpert 3 ай бұрын
​@Wavescu I love you
@krystiangraj9154
@krystiangraj9154 2 жыл бұрын
Hey, why transform.position for client do not change? All the time is on (0,0,0)
@ZygerGFX
@ZygerGFX 2 жыл бұрын
The method I showed in the video shouldn't actually be used. It was a basic implementation for the purpose of the video, so it's janky and doesn't always work. I recommend making your own method to move the players position once in the scene.
@Dara-gq6jl
@Dara-gq6jl 2 жыл бұрын
Do you know why my mouse movement wont sync, the only thing that syncs is the x, y and z positions for my player. But my mouse script works, its just the network wont show rotation. It would be great if you could make a video on fps movement! thanks though
@ZygerGFX
@ZygerGFX 2 жыл бұрын
Are you actually sending the rotation data ? You said you have a script controlling it but do you send this data over the server?
@Dara-gq6jl
@Dara-gq6jl 2 жыл бұрын
@@ZygerGFX not really sure, all my script is in a network, I’ll prob send a pastebin
@ZygerGFX
@ZygerGFX 2 жыл бұрын
@@Dara-gq6jl sorry but I wont be able to individual look at your code and help you. but look up how to sync rotations, its fairly straight forward. since this tutorial only shows how to sync your x,y and z positions.
@Dara-gq6jl
@Dara-gq6jl 2 жыл бұрын
@@ZygerGFX thank you so much, your an inspiration
@Dara-gq6jl
@Dara-gq6jl 2 жыл бұрын
@@ZygerGFX cause mine is really weird as the cameras are switched on the players for some reason.
@KeyatoKT
@KeyatoKT Жыл бұрын
I've tryed to figure it out by myself but I don't understand how you create a way to leave the game whenever you are in the lobby or in the game
@ZygerGFX
@ZygerGFX Жыл бұрын
Check my discord there's a channel which explains it :))
@rabiehaddad1925
@rabiehaddad1925 Жыл бұрын
I got third person shooter from invector where to assign it its going to work
@ZygerGFX
@ZygerGFX Жыл бұрын
So invector is going to be tricky. Since it's already massive and contains a bunch of convoluted scripts. You'll need to manually convert and chnage the code to be networked and work only with authority
@meeperhere
@meeperhere 2 жыл бұрын
KZfaq: 3 comments Me: can i see them? KZfaq: *n o*
@NBGTZ
@NBGTZ Жыл бұрын
when i tried to test it with my friend we Only the host got a PlayerModal and client didnt have PlayerModel like is still in MainMenu How can I fix it please?
@ohnepixel_enjoyer
@ohnepixel_enjoyer Жыл бұрын
same, any fix?
@ohnepixel_enjoyer
@ohnepixel_enjoyer Жыл бұрын
same, any fix?
@NBGTZ
@NBGTZ Жыл бұрын
I wish but still no luck
@ohnepixel_enjoyer
@ohnepixel_enjoyer Жыл бұрын
@@NBGTZ tell me your discord i fixed it
@FedeRzVz
@FedeRzVz Жыл бұрын
@@ohnepixel_enjoyer How you fixed it?
@aonalt
@aonalt 2 жыл бұрын
When will you make another part?
@ZygerGFX
@ZygerGFX 2 жыл бұрын
new multiplayer tutorials next week
@aonalt
@aonalt 2 жыл бұрын
@@ZygerGFX Awesome! What is it going to cover?
@ZygerGFX
@ZygerGFX 2 жыл бұрын
@@aonalt if you join my discord i do polls where people decide what the next topic will be. just depends what people vote on there :D
@aonalt
@aonalt 2 жыл бұрын
@@ZygerGFX Ok thanks!
@werlig
@werlig Жыл бұрын
My characters dont sync between clients, I did everything like in the video and still not work :(
@werlig
@werlig Жыл бұрын
Fixed! I had a mirror newer version, now i'm using the 40.0.9 and it work :)
@carrun0
@carrun0 2 жыл бұрын
How could i make it that each player gets their own First person character rather than what u did here?
@bradymeyerhoeffer3703
@bradymeyerhoeffer3703 2 жыл бұрын
Im looking for this too, but 3rd person pov but still attached to the character. It would be the same but just the camera in a different position, so let me know if you find anything!
@lol-xc5bz
@lol-xc5bz 2 жыл бұрын
Try to make a function where the camera gets rotated based on the movement of the mouse. The camera itself becomes a child object of the player, so it stays with it when the player walks. You can sync the rotation of the player across the network if you want
@etcoolgame
@etcoolgame Жыл бұрын
W
@Duxkd
@Duxkd 8 ай бұрын
its telling me hasAuthority couldn't be found how can i fix it ?
@cjhw
@cjhw 3 ай бұрын
Did you fix it? Idk how to fix it either.
@Ab1bok
@Ab1bok 3 ай бұрын
isOwned@@cjhw
@technobrawlofficial
@technobrawlofficial 7 ай бұрын
Why is it that the host can move but the 2nd player cant move?
@utkayfirat
@utkayfirat 3 ай бұрын
did you fix it ?
@technobrawlofficial
@technobrawlofficial 3 ай бұрын
yeah you have to use a client network transform instead of a normal one @@utkayfirat
@Shadowkiwi
@Shadowkiwi 2 жыл бұрын
Anyone else run into an issue where the second player just falls through the world?
@ZygerGFX
@ZygerGFX 2 жыл бұрын
make sure the player actually spawn above the platform. i saw a few people have this issue and it turned out to be their players weren't spawning correctly.
@Shadowkiwi
@Shadowkiwi 2 жыл бұрын
@@ZygerGFX Thanks that was the problem. My set position was not working correctly at first and had tried doing some round about way of doing it. Saw someones comment here about subscribing to the scene change event so looked into that and that has got it working :)
@FedeRzVz
@FedeRzVz Жыл бұрын
@@Shadowkiwi How did you fixed it?
@talha_xxl
@talha_xxl 2 жыл бұрын
Kalp at lan bana❤
@agoq6829
@agoq6829 2 жыл бұрын
amogus🍉
@_DNET_
@_DNET_ 2 жыл бұрын
sus
@ZygerGFX
@ZygerGFX 2 жыл бұрын
very sus
@EvilTaco
@EvilTaco 2 жыл бұрын
Movement player? 😳
@ZygerGFX
@ZygerGFX 2 жыл бұрын
?
@Taki7o7
@Taki7o7 Жыл бұрын
I like this series a lot, but unfortunately you teach a lot of bad practices ._. #nohate
@ZygerGFX
@ZygerGFX Жыл бұрын
yeah I agree, at that point in my life I myself coded with lots of bad practices and a lot of my code was super inefficient. Its much better now, still not 100% but yeah i agree with what you said :)
Simple Chat Bubble in Unity! (Chat, NPC, Multiplayer)
18:28
Code Monkey
Рет қаралды 45 М.
когда достали одноклассники!
00:49
БРУНО
Рет қаралды 2,9 МЛН
1❤️
00:20
すしらーめん《りく》
Рет қаралды 32 МЛН
Pokey pokey 🤣🥰❤️ #demariki
00:26
Demariki
Рет қаралды 6 МЛН
100😭🎉 #thankyou
00:28
はじめしゃちょー(hajime)
Рет қаралды 29 МЛН
How to Make a Multiplayer Game - The Lobby
24:47
Blackthornprod
Рет қаралды 84 М.
He said I Couldn't Make a 3D Game... So I Made One!
10:29
Dani
Рет қаралды 9 МЛН
How To Make A Multiplayer Game In Unity - Chat
10:02
Dapper Dino
Рет қаралды 64 М.
Easy Multiplayer in 7 minutes - Unity - Ep. 1 Setup (Fishnet Tutorial)
7:09
I Made Fruit Ninja, but in First Person
6:47
DevBanana
Рет қаралды 114 М.
What Unity Networking Solution Should I Use?
10:37
KHodow
Рет қаралды 29 М.
How To Integrate Steam With Your Unity Game
5:53
Dapper Dino
Рет қаралды 52 М.
How to make Bomberman in Unity (Complete Tutorial) 💣💥
2:20:49
How to MAKE YOUR GAME LOOK GOOD!
13:02
Brackeys
Рет қаралды 583 М.
УКРАЛИ банковскую КАРТУ у ДЕВУШКИ 😱 #shorts
0:57
Лаборатория Разрушителя
Рет қаралды 6 МЛН
26 мая 2024 г.
0:18
Dragon Нургелды 🐉
Рет қаралды 2 МЛН
Funny kid and Dad #shorts #funny #viral #comedy #youtubeshorts
0:15
mountainlion5
Рет қаралды 24 МЛН
Той! Той! Той! “Өмірлік жарым боласың ба”
22:40
QosLike / ҚосЛайк / Косылайық
Рет қаралды 354 М.
Самый Лучший Старший Брат 😍
0:38
ДоброShorts
Рет қаралды 9 МЛН