Thursday 19 July 2018

Local network game lobby

I am building an Electron-based game that uses Socket.io for local multiplayer (not connecting to an Internet-based server). I am having trouble setting up the client connection to the host. Because the socket.io server is local, not on the internet, I can't predict the IP address for it. From thinking about it, I have two options:Tell the host their IP address, then provide it to the client.Have the client scan the local network for the game being hosted.I'm not quite sure how to do either of these, and I'm honestly not picky. I looked very briefly at the node docs for os, but I didn't see a reliable way to get the correct network IP address. I also saw a way somewhere to scan a network for open ports, but I'm not sure if my game will be the only thing using that port or not, so I'm not sure if I should set up some kind of response to ping against that won't trigger socket.io.I realize this is kind of a niche case, but does anyone have a good place to start on either of these methods? I'm really not picky, I just want to get this going so I can start testing the host/client interaction. Thank you in advance!

Submitted July 20, 2018 at 06:06AM by yagaboosh

No comments:

Post a Comment