0 votes

im a noob about networking just started multiplayer stuff, networking. and i really know nothing but i watched this video https://youtu.be/K0luHLZxjBA and decided to try out. it went well but i did this in scuffed 2D i really didn't care how it looks i just wanted to test if this actually works. and suprisingly it worked on the same machine tho. but now i'm trying to connect two different devices via local network but doesn't seem to be working well. hope anyone can help
this the project almost the copy of the video but with a little different game mechanics
https://github.com/ash-hashtag/veryverysimplemultiplayer.git

Godot version 3.4
in Engine by (21 points)

1 Answer

+1 vote

A Multiplayer noob? Skipping a few steps i see.

In your Node2D.gd set the 'ip' var to be that of the 'host' on both devices as "127.0.0.1" is assgined to be localhost

This can be found out in a multitude of ways with the easiest being to call IP.get_local_addresses() or IP.get_local_interfaces() and selecting the appropriate one

On the host device (the one designated as server) also do

net.set_bind_ip(ip)

Unrelated


not important but the lines in game.gd

var p1 = preload("res://player.tscn").instance()

and

var p2 = preload("res://player.tscn").instance()

Seems weird to preload the same Packed scene twice so it should be like

var player = preload("res://player.tscn")
var p1 = player.instance()
var p2 = player.instance()
by (5,202 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.