Multiplayer in Godot 4 in 3 minutes

Multiplayer in Godot 4 in 3 minutes

16BitDev

10 месяцев назад

78,131 Просмотров

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


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

@Gyozamang
@Gyozamang - 26.10.2023 08:48

This works well over my LAN. How do I make it so it's a very simple way to do over the internet? Like how do I make it so it uses a UPNP port and connect to my ip address as a peer connection?

Ответить
@DJGamer_2022
@DJGamer_2022 - 06.11.2023 21:58

SE PUDE ASER EN 3D TAMBIEN?

Ответить
@WillDel
@WillDel - 08.11.2023 19:06

How to make the player who entered different from the host?

Ответить
@unpayasocualquiera2417
@unpayasocualquiera2417 - 12.11.2023 20:44

mucha gracias crack 👍

Ответить
@sekaizyu0321
@sekaizyu0321 - 14.11.2023 12:10

Hi, I do not understand English and use translations.
Sorry if it is hard to communicate.
I would like to ask you a question.

Using this video as a basis,
I added a script to change the position of the host and client.
Before call_deferred("add_child",player) in _add_player
The following code was added

if id == 1:
player.position = Vector2(500,500)
else:
player.position = Vector2(0,0)

In this case, there seemed to be no problem.

However, if we try to add more collision to the player, a problem occurs.
We add a collision and make it somewhat larger so that it follows the image.
After that, when we run it, the client side is now positioned directly above the host.

Does anyone know the cause and solution to this problem?

Ответить
@ammonggames2421
@ammonggames2421 - 18.11.2023 17:18

When i trie to conect two computers it doesn't worked

Ответить
@antoniosanchezcalderon1351
@antoniosanchezcalderon1351 - 25.11.2023 10:56

did it exactly the same way and it doesn't work. the host spawns but the client screen shows nothing and doesn't have authority.

Ответить
@Lachrymogenic
@Lachrymogenic - 28.11.2023 12:05

couldnt watch the tutorial music made me cry

Ответить
@n_d_cisive
@n_d_cisive - 28.11.2023 14:29

You just earned a sub

Ответить
@Assem_DEV
@Assem_DEV - 02.12.2023 03:21

Does this code work remotely or on people connected to the same network?

Ответить
@toukokinnunen1135
@toukokinnunen1135 - 10.12.2023 01:19

Have a little tip from me as a token of appreciation 👍

Ответить
@mr.condekua6141
@mr.condekua6141 - 12.12.2023 06:24

Why on earth you set the authority to the name of the Character? I mean, your functions that creates characters name the first one "1", and the second one something like "@1@1" that you convert to integer "277281" (just random numbers) and the set authoriy to it. You never get the ID of the peer, not even set authoty using this ID and still, this somehow works
I dont get it

Ответить
@jennyml9024
@jennyml9024 - 18.12.2023 06:34

thanks, that was a nice guide, maybe you do more multiplayer tutorials?

Ответить
@pierre-yves4444
@pierre-yves4444 - 24.12.2023 19:05

Hello, I use Godot 4.2.1 and the player_scene.instantiate() in _add_player function throw me this error : Cannot call non-static function "instantiate()" on the class "PackedScene" directly. Make an instance instead. Any hints why ?

Ответить
@bergsprekken123
@bergsprekken123 - 28.12.2023 01:51

insanely nice tutorial, I could just watch pause write the code do the steps and voila :) I was wondering how would you add the world, for example if a tilemap was added and we had to sync the tilemap?

Ответить
@Khalirei
@Khalirei - 05.01.2024 04:46

So I haven't tested this and I know very little about networking in games, but I'll assume it works judging from the other comments. I have a question though, is there anyway for someone to abuse P2P connections with malware or viruses through the open ports for the game?

Ответить
@lutherschultz4725
@lutherschultz4725 - 06.01.2024 04:40

how does multiplayer spawner change the name of the spawned node to the id of the peer? does it just do this automatically?

Ответить
@jamessweet6962
@jamessweet6962 - 11.01.2024 22:21

Would this be a good option for me to use if each of the players is different? they all have different models and abilities

Ответить
@bruri7522
@bruri7522 - 17.01.2024 04:02

Does this work on a project that uses dedicated server, rpc?

Ответить
@bvitytwrbq
@bvitytwrbq - 21.01.2024 14:23

big thank!
im only beginning the multiplayer discover and this certainly has been a nice start

Ответить
@theulfhednar2655
@theulfhednar2655 - 31.01.2024 17:57

Thank you very much for this.
The task that I thought would be the hardest ended up being the easiest haha.

Just gotta figure out some more things now.

Ответить
@Kaspigo
@Kaspigo - 31.01.2024 22:06

works only on the same pc as host

Ответить
@BOT_dev
@BOT_dev - 08.02.2024 16:35

'multiplayer_peer'(on base:'null instance') with value of type 'ENetMultiplayerPeer'.

what's up with this?

Ответить
@Top_Drop
@Top_Drop - 10.02.2024 21:41

Го теперь на Godot 3? Но я попробую сделать это на Godot 3 вместо Godot 4!!!!?❤❤❤

Ответить
@JackyTrieu
@JackyTrieu - 13.02.2024 13:57

my game not add player

Ответить
@paremyoutube
@paremyoutube - 16.02.2024 19:20

Does this work online?

Ответить
@amakivideos
@amakivideos - 17.02.2024 15:48

Thank you for the tutorial! It's very helpful 👍

Ответить
@D0cez
@D0cez - 21.02.2024 20:40

Hi, i need help, how to make "unique" camera in godot for every player?

Ответить
@oneyearcreative
@oneyearcreative - 27.02.2024 03:13

This is my favourite tutorial out of probably hundreds(or even thousands) of tutorials I have ever seen. Extremely concise, straight to the point, each step explained. Whole point explained on minimal working example and in 3 minutes. Insta subscribe.

Ответить
@Engoneer
@Engoneer - 27.02.2024 03:51

out of all the tutorials that ive seen so far I want to also say this one is amazing

Ответить
@KyleHarmieson
@KyleHarmieson - 10.03.2024 02:33

Thanks to you, 16BitDev, I today made my very first multiplayer prototype. Thank you so much.

Ответить
@memumemu7539
@memumemu7539 - 14.03.2024 04:53

Ответить
@B-mo0000
@B-mo0000 - 15.03.2024 16:53

Ответить
@ahmadsaerozi6688
@ahmadsaerozi6688 - 21.03.2024 19:42

Thanks, its works

Ответить
@ahmadsaerozi6688
@ahmadsaerozi6688 - 24.03.2024 14:30

How to make if player instantiate object (bullet) other player can see the object

Ответить
@igorigor3960
@igorigor3960 - 04.04.2024 14:59

how safe is this multiplayer code for players ?

Ответить
@couchwow
@couchwow - 06.04.2024 20:09

can you make a slightly extended version with passwords?

Ответить
@sunshinecoco12
@sunshinecoco12 - 19.04.2024 02:09

Thank you so much for this short, simple, yet usefull tutorial. I just could not get multiplayer to work at all before this, but now, it works basically perfectly.

Ответить
@nakano15
@nakano15 - 22.04.2024 21:53

The way the multiplayer connection is done in the video will give error once a player connects.
Is recommended to make a variant of AddPlayer which checks if "multiplayer.is_server()" is true before trying to spawn a player character, or else it will try creating a copy of the player object, while it already exists in the client.

Ответить
@ChatterDoesMatter
@ChatterDoesMatter - 27.04.2024 08:39

VERY FAST

Ответить
@SudoStudioDev
@SudoStudioDev - 29.04.2024 05:58

I never expected that Godot Multiplayer need just 3 mn, hahha

Ответить
@rakowumusic5143
@rakowumusic5143 - 04.05.2024 12:02

Local on my machine it works perfectly. But does it work also for other Devices? My peer to peer connection does not work when i run the game on two different devices sharing the same network. Not even with lan.

Ответить
@tcreft2857
@tcreft2857 - 08.05.2024 21:47

mas e para pc com celular?
vocé sabe como faz o cross plataform?

Ответить
@user-uj1cr1qg6k
@user-uj1cr1qg6k - 09.05.2024 03:51

One question, can it work online?

Ответить
@zeanegame1806
@zeanegame1806 - 15.05.2024 19:27

Can this work on 3D too?

Ответить
@freezkyle4674
@freezkyle4674 - 19.05.2024 10:48

subbed!

Ответить
@WCIIINoob
@WCIIINoob - 19.05.2024 21:12

thanks for this awesome tutorial!
Can you have more than one multiplayer-spawner in an scene or just one, which has to handle a long auto-spawner-list?
E.g. one spawner for player. Other for NPC-enemies, other for ressources, bullets, ...?

Ответить
@thechicken6430
@thechicken6430 - 28.05.2024 01:55

Just a problem I had with this, _add_player isn't a function

Ответить
@emanuelmatos5228
@emanuelmatos5228 - 30.05.2024 00:26

Amazing, not only demonstrated knowledge, skills, it demonstrated how quick and easy was to set up using Godot, thank you so much!!!!!!!! the best multiplayer tutorial I 've ever seen.

Ответить
@OlivierPons
@OlivierPons - 30.05.2024 20:45

I find this tutorial very good if you just want to copy-paste everything shown without asking questions... But I can't find a single tutorial that explains the developers' goals and how they implemented it to understand the overall functioning scheme instead of just copy-pasting from all the videos currently available on the internet about multiplayer with GODOT 4.

Ответить