The Ultimate Multiplayer Tutorial for Unity - Netcode for GameObjects

The Ultimate Multiplayer Tutorial for Unity - Netcode for GameObjects

samyam

1 год назад

171,137 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@kestama2
@kestama2 - 17.11.2023 20:41

So fell in love with your magic voice))

Ответить
@miriyau
@miriyau - 22.11.2023 23:55

there will be NetCode update :D

Ответить
@darrenj.griffiths9507
@darrenj.griffiths9507 - 04.12.2023 18:39

This was extremely interesting, thank you. I've put it on my "saved" list for future re-watching.

Ответить
@CheddarGoblinDev
@CheddarGoblinDev - 07.12.2023 01:06

I don't understand why there is a seperate script lying around in the documentation (ClientNetworkTransform) - instead of including it as a boolean flag in the NetworkTransform or whatever? I am totally confused by this

Ответить
@yusufum_
@yusufum_ - 12.12.2023 02:47

great

Ответить
@lizkimber
@lizkimber - 18.12.2023 19:50

ive come across this and with netcode 1.7.x at least it seems by default it only updates the machine its on not both.. the extract check of isowner isnt necesary.. could get confusing.

Also, the objectpool has a built in countactive to get used, and the networkobjectpool no longer seems to have an initialize/clearpool etc code, and will spawn the initial 30, but then moan after that any spawns "Object is already spawned" even when all the objects have been released and are unused. So annoying to need to make an objectpool when unity provides one and its bust. I had to add a try loop round because even when all objects in the pool are avaiable it will occasionally error which is lunacy

So, I ran into a lot of problems, so i even bought your code in case id been a sausage finger, and your code does the same.
a) if you run as a server only, it never spawns food because it needed a client connection and so the spawner exits because clients are 0
b ) if you run round and eat a lot of food, and out of 50 only expect to have 10 on screen, often a food will be moved, rather than grab a free one of the 40 - the object pool seems faulty
c) often even if you host only, no clients, it will try and despawn something already despanwed and throw errors

I really enjoyed the video but now am a little confused, because the pool seems fundementally flawed

Ответить
@velmrok1660
@velmrok1660 - 21.12.2023 00:13

thats cute

Ответить
@Ryan-khan-y
@Ryan-khan-y - 29.12.2023 18:15

Wow nice
your voice so sweat ❤️ best of luck✨

Ответить
@DawnColon-hn8pl
@DawnColon-hn8pl - 19.01.2024 16:13

cool video)

Ответить
@АртемийКазаков-с6ч
@АртемийКазаков-с6ч - 29.01.2024 13:03

cool video)

Ответить
@raunaqverma7905
@raunaqverma7905 - 02.02.2024 13:40

Best Explanation for networking ❤

Ответить
@itsdonix
@itsdonix - 04.02.2024 22:17

One of the best Unity Multiplayer tutorials ive seen, gives almost all Basics you need for a Unity Multiplayer Game

Ответить
@lucaspradlwarter6140
@lucaspradlwarter6140 - 07.02.2024 19:07

Great Tutorial with a lot of personal tips on the side :) Very nice...
* I do wonder though if somehow i missed something or this just wasn't really implemented yet :
when a player gets eaten player & tails are gone as expected in that client. On the other clients none of these are destroyed ! Same on the server. There is just dead bodies all over ?!?:)

* & since the tails were collapsing over each other when the head stops, i changed the tail update method,
private void Update() {
deltaPos = followTransform.position - transform.position;
deltaPos.z = 0f;
if (deltaPos.magnitude < distance) return;
transform.position += deltaPos * Time.deltaTime * moveStep;
transform.up = deltaPos.normalized; // Added 'legs' to each tail-segment needed this transform .up
}

Ответить
@andresmorazun
@andresmorazun - 08.02.2024 19:12

I don't know how many tiems I've come to this tutorial in the last 3-4 months while trying to learn netcode for gameobjects. I'm so grateful for your content @samyam!

For everyone else, like and subscribe!

If you are working with NGO in Feb 2024, update to version 1.8.0, lots of quality of life improvements. Specially regarding how they handle RPCs, check the docs!

Ответить
@swolyjr
@swolyjr - 17.03.2024 23:49

I cant get my prefab to go into the Networks prefabs lists. anyone have any help they can offer to help me resolves this, please?

Ответить
@michaelbutz284
@michaelbutz284 - 19.03.2024 22:21

Only 48 minutes of this great video and I have learned so much more than in any other course. Thank you so much for this. Guess I'll have to throw around more praise at the end of the video. But if the quality holds up, it's more than deserved 👍

Ответить
@swolyjr
@swolyjr - 20.03.2024 02:57

Can i not run this on VS for my scripts ?

Ответить
@unicorps8996
@unicorps8996 - 13.04.2024 01:05

it's working for unity Android 2D ?

Ответить
@SolarSoftMedia
@SolarSoftMedia - 13.04.2024 20:13

Please consider updating your tutorials so we can still follow along. The NetworkObjectPool.cs is nothing like it is in this video. Different variable names and different functions, the dequeue for example, doesn't even exist.

Ответить
@SolarSoftMedia
@SolarSoftMedia - 14.04.2024 17:14

response.Reason in the ConnectionApprovalHandler.cs is not valid.

Ответить
@hancurobert8510
@hancurobert8510 - 12.05.2024 20:53

I cannot belive I just happened to stumble across this hidden gem of a video! Great job!!!

Ответить
@thiagothek7046
@thiagothek7046 - 15.05.2024 19:50

is it better than photon?

Ответить
@CrabKingFish
@CrabKingFish - 15.05.2024 22:26

Hi SamYam, I love your video , and I have always been curious as to how coders like dani and yourself manage to learn all of these networking concepts. For me personally, when I open any documentation, my mind just explodes, so i guess do you just push through and read all of the documentation or do you utilize any other sources? oh and what about how you learnt the concept of client-side prediction?

Ответить
@PawanRamnani-r9b
@PawanRamnani-r9b - 30.05.2024 23:21

Amazing video.

One small query :
After lobby, i have to move to the Level Selection scene which selects which level to choose.

That level scene is an addressable which is being downloaded from cloud.

But net code does not seem to work with addressable scene.

Any advice?
I am thinking two options :

1)
Use RPC to manually load the addressable scene on all clients

2)
Make all the contents of the scene an addressable prefab and then include the empty scene in build settings which can be loaded through netcode. Then instantiate the adressable when the scene is loaded by netcode.

Thanks in advance 😃

Ответить
@truongvantam4994
@truongvantam4994 - 16.06.2024 18:21

don't you use the MovePlayerClient function?

Ответить
@truongvantam4994
@truongvantam4994 - 16.06.2024 22:18

In the authoritative movement section, I don't understand why you don't use the MovePlayerClient function and the player can still move. In my project I'm following yours, if I do the same as you, only the player on the host can move smoothly and the player on the client can move uncontrollably.

Ответить
@056vasanthanr
@056vasanthanr - 18.06.2024 15:35

@samyam Food Networked Object has not been hide after the player has been reached

Ответить
@graffyeditzz7619
@graffyeditzz7619 - 21.06.2024 09:51

My tail prefab didn't follow tha head prefab 😢 instead it moving opposite of thr player

Ответить
@optus231
@optus231 - 05.07.2024 14:46

Hi, I am having issues when I try to play with a friend. I sent him the build but seems that there are issues due the IP as it is in localhost 7777. Do I need to open the ports? If this is not an option for me, how can I use an external server to run the game? Thank you in advance.

Ответить
@buraponmanmai101
@buraponmanmai101 - 09.07.2024 12:17

thank you

Ответить
@henriquebarreirapachedefar1190
@henriquebarreirapachedefar1190 - 14.07.2024 05:47

For people having problem using Pool, she's using version 1.1, you gotta change when following this tutorial. Took me a while to realize. Thanks for the content! Please if you can, show us the version of the libraries u are using, those libraries change versions very fast and sometimes we cannot watch full video because we get stuck due to versions. Just a humble suggestion, anyways, thanks for the content!!! <3

Ответить
@umutcanakyol7457
@umutcanakyol7457 - 24.07.2024 20:46

Hı,Can i use that for multiplayer card game?

Ответить
@Taogyre
@Taogyre - 31.07.2024 18:21

if you're using the updated Network Object Pool then you need to replace the method here and delete anything to do with nonPooling
public int GetPrefabCount()
{
return m_PooledObjects.Count;
}

Ответить
@brian.8712
@brian.8712 - 07.08.2024 18:28

For those that don't want to type out the ClientRpcParams delareation every time, you can paste the following helper functions into your game manager:

public static ClientRpcParams NewClientRpcSendParams(ulong recipientId)
{
return new()
{
Send = new ClientRpcSendParams
{
TargetClientIds = new ulong[] {recipientId}
}
};
}

public static ClientRpcParams NewClientRpcSendParams(ulong[] recipientsId)
{
return new()
{
Send = new ClientRpcSendParams
{
TargetClientIds = recipientsId
}
};
}

Ответить
@kadie17
@kadie17 - 15.08.2024 02:39

Just starting to tackle the multiplayer functionality in my game, and this is the first video I came across. Got some snacks to munch on while I binge the rest of your content. Looking forward to becoming a patron in the future, love your work.

Ответить
@Adrien13Sanctioned
@Adrien13Sanctioned - 27.08.2024 00:35

How do you handle host migration, or is it possible in netcode for gameobjects without lobby or relay?

Ответить
@gam_buziya6469
@gam_buziya6469 - 06.09.2024 13:34

Hi, can you help me? Why my objectPool doesnt hide objects for client, only for server, rewatched the moment many times, and dont know, why i have this problem

Ответить
@Zubairnawazgameartist4040
@Zubairnawazgameartist4040 - 08.09.2024 22:39

Thanks for 106 subscribers completed ❤🎉

Ответить
@atilliator
@atilliator - 21.09.2024 16:49

"Don't drink coffee" 🤣

Ответить
@shoop9274
@shoop9274 - 22.09.2024 16:57

OnNetworkspawn seems very buggy for objects pre placed in the scene documentation says you can replace objects but when pressing play mode it does not work reliably...

Ответить
@neobossgaming
@neobossgaming - 01.10.2024 15:18

i got a error saying after getting the pacage: "Asembly with name ......"(the name of the package) alreadyy exists, for those of you who also got this, just open file explorer and open the project file and delete all the projects except Assets, Project Settings, user Settings, and the .sln

Ответить
@Viezieg
@Viezieg - 03.10.2024 20:20

got "'PlayerLength.onNetworkSpawn()': no suitable method found to override"

Ответить
@castlecodersltd
@castlecodersltd - 05.11.2024 20:27

I really enjoyed this, thank you 🙂

Ответить