Has anyone got multiplayer working beyond LAN in BGE?

I came across this game:

but it seems to be quite old, and appears like it only uses LAN.

There is also agoose77’s addon:

However all demo’s of this are contained within 1 PC (both server and client).

Another couple demo’s on youtube also involve similar setup’s but again, only through LAN.

Is it even possible to go beyond LAN with BGE?
What are some major obstacles that stop this from happening?

Thanks:)

Yeah those 2 videos are only LAN. It is possible to route a connection through a website with php and I do have the code for that. If you want it, send me a message.

The problem with dedicated servers is that they require a cost to keep online and running.
Having a Listen or peer-to-peer server somehow would be a lot more convenient, but I’m not sure if it’s possible.

Me and some of my colleagues did a multiplayer prototype game, working even beyond NAT(beyond routers). With chat and up to 10 players.However it was back in 2012 and I was not responsible for the network part, but it was working just fine with a dedicated server.

Be realistic. not that many people will be playing a blender game at the same time so it won’t use many resources. But if you still think so, the code can still be used as a leaderboard/messaging system.

I remember seeing this project when I first joined BA!
I wonder why other p2p or listen servers couldn’t be used?

Perhaps a dedicated server would be possible with free web hosting services online or something.

I meant more the fixed cost of keeping a server up and running but as mentioned above perhaps I can utilize free web hosting to do this. I might also look a bit more into the leaderboard/messaging system, although I’m not sure how reliable that will be beyond a leaderboard in regards to ping.

No need for any server. It all goes through the website because it just does POST to the php to send a request and GET to receive information. It’s reliable for leaderboard and messaging but yeah, Maybe not so much for realtime multiplayer.

my limited network understanding tells me

. a server can be any pc hosting the game

. ‘real time’ is relative, lag will have more ill effect to FPS than regular MMO, thus bandwidth costs for FPS are inherently more expensive

Kewl Incredible District is an MMORPG that I never played but I know was made in blender by one person, however it was banned and taken down because the community was upset with the design and at the guy who made it ; I don’t know the details beyond and behind all that

So yeah MMO can be done in bge, given enough time and patient

Yes, I have done several little multiplayer demo’s with a friend.

First up, let’s clear a misconception:
If it works on a LAN, to get it to work on the internet, all you have to do is open a port on your router. This is done through your routers configuration page, and most old games required gamers to do this if they wanted to host.

Second:
I’d suggest using a server just to track games, and to broker connections between them, but have the actual game data not going through the server. This vastly reduces the load on the server and means that people don’t have to deal with ping time to your server once the game is established - only the ping time to each other. There are various methods for doing this (look up Hole punching).

Doing it through POST/GET:
I’ve never coded up a system for doing this. I know it’s possible, but haven’t bothered. I don’t like PHP, and prefer to do everything in python - so I just go the dedicated server route

Dedicated Servers:

Running your own dedicated server is the running cost of a raspberry pi - about $5 of electricity per year. Admittedly, I just use the server as a tracker, so the server does not have to actually run the game. If you need the server to actually run the game, then it will cost significantly more electricity and you need a much more powerful computer.
@Thatimster: I can give you a hand setting up your own if you like. Talking over these things in person is often a lot easier.

A budget for a raspberry pi server:
Raspberry pi 3: $35 USD
8gb uSD card: <$10

Cost: $45USD

(Assuming you have a spare USB cable, USB wall charger, HDMI cable (only needed for initial setup) etc.
I have a 2tb spinning disk hard drive plugged into mine - extra $100
I plan to build a new raspberry pi server with a 240GB SSD - extra $100

Heck, you can write python scripts for Andoid phones, no reason that can’t be a server if you’re happy with a wireless link to it (which I’m not).


If you don’t want to spend the time hosting your own, I can suggest digitalocean, who do VPS’s for $5 per month. However, that will get you even less CPU/RAM than your raspberry pi - except the ping time to the rest of the world will be way better.

If you want me to host something for you, drop me a message.
The same goes for anyone in the BGE community. Have a chat to me, tell me why you want what hosted, what ports you want exposed, and chances are I can donate some server space. It won’t be good ping time (because I’m in a funny country), but it will be fine for getting started and testing things. It will be SSH access to a linux box, so some computer skills will be needed (or need to be learned.)

The pi server has been running for nearly two years, and sits there doing pretty much nothing (it runs the tracker for this non-BGE game)

Wow very interesting, looks like you have put a lot of work into this field already. I haven’t looked beyond basic python sockets yet but was mainly concerned with it’s feasibility before I decided to commit to anything.

So essentially you are suggesting having a simple server that initiates games and collects scores of previous games?
I’m guessing the server allows you to bypass having to open router ports.

Using a POST/GET system could be interesting, especially with server based frameworks like Flask which use python instead of PHP.

After what you mentioned starting up a server just to initiate connections is probably a good idea, but I’ll have to do some more research and learning in regards to the networking topic itself and getting communications going.
Did you write everything from scratch for your server?

Also the demo that you linked, what did you use to build it if you didn’t use BGE?

There seem to be quite a few ‘free’ vps services out there as well which might be good for initial scaling once an mvp is created.

Did you write everything from scratch for your server?

SO I used websockets to handle the connections (like the socket library in python), but everything on top of that is written from scratch. I really should work on it some more, I need to run a STUN/TURN server to get proper multiplayer going for that game.

Also the demo that you linked, what did you use to build it if you didn’t use BGE?

I used playcanvas, an HTML5 game engine (because I wanted to make a web-based game).

‘free’ vps services

Oh? I couldn’t find any, at least, not that offered proper access (root access to a linux box).

I’m guessing the server allows you to bypass having to open router ports.

Ever computer can start an outgoing connection.
Servers are programmed to accept incoming connections
Routers block incoming connections except on specific ports

So normally:

  1. Computer A attempts to open a connection to computer B
  2. The router between computer B and the internet refuses the connection

If you have a UDP stream (because they don’t care that much where information is coming from/going to) and a server then:

  1. Computer A opens a connection to the server
  2. Computer B opens a connection to the server
  3. The server points computer A to computer B and steps out of the way
  4. Connection established because both computers opened outgoing connections.
  5. Profit?!

Yeah, networking basics are very simple. Open a socket, bingo. The tricky part is using the socket layer efficiently, and securely.
My multiplayer demos worked, but they had ups and downs. The latest version was very usable, I wasn’t happy with doing dumb serialisation in the manner that the api allowed, so I stopped development for now

Sent from my SM-G920F using Tapatalk

So, I may be able to give some inputs on that.

I used to work with WebRTC (Web Real Time Communications) a standard P2P API available in modern browsers.

The thing is, even if you manage to write the P2P part, you still need a server in the end.
The reason is mostly discovery and, in roughly 15% of the case, because of NATs.

Let’s think about discovery: how do you find other peers if you don’t have any well known server? You have to rely on out of band communication (let’s say chat servers where people share their IPs).
So yeah, if you want it to be a smooth, transparant experience, before even starting a game, you need at least a discovery server. (In case you’re interested, the discovery part is called signaling in WebRTC).

Then there is NATs. As mentioned before, most routers block incoming traffic, so you need to circumvent that via well known techniques. In most case you can get a P2P connection working but in 15% of the cases you end up in what we call symetric NATs, where no one can accept incoming connections. You then need a TURN server.
Anyway, there is no need for a headache since protocols addressing all that exist already. The whole thing is called ICE [1] (terrible name) which is a combination of STUN + TURN (also terrible names, what were they thinking).

Finally, P2P sounds cool and nice, but in the end it’s a little nightmare.
For games it may matter not so much in comparison of videoconf on the web, but you may want to care about your players having a similar experience.

Having any kind of full-mesh topology gives every player a different latency to each other, and that can be quite frustrating for them. And let’s not forget potential net-splits.

I can elaborate on the P2P topologies if you want, but my guts would be to take the simple road and use a server.
Hosting is, IMO, cheap enough to not bother, at least until you get really popular. A lot of gaming communities seem to do that and even let people run their server and let them be discovered via a central server, so I think that’s the way to go.

I hope my wall of text have been useful to someone :slight_smile:

[1] ICE: https://en.wikipedia.org/wiki/Interactive_Connectivity_Establishment