Where can I go for help on Blender P2P or Peer to Peer online game type of coding?

Where can I go for help on Blender P2P or Peer to Peer online game type of coding?

I’ve found video tutorials on how to code sever and client scripts, but I’m looking for a place to start from for using Peer to Peer / hosting your own game and letting others join.
but how do I make it so you and others can join unknown IPs without a dedicated severe?

You need a dedicated server that all of the peers “know” about, so that they can be told where to find one another. Otherwise, the internet is a very large place, and you’re unlikely to “bump into” other peers by broadcasting all over the world. Plus, this is bad for security and bandwidth reasons. This dedicated server could simply be a web host with server-side-scripting (PHP / Python / Ruby) that can store a list of active client IPs.

I always wondered how to run something like second life, in the bge.

(coding in game )

how do you add the logic? (can you eval a whole python script from a in game text editor?)

Instead of peer-to-peer, I think you’re actually asking for a game … tracker.
One person starts a game, other people can see it on the web, and can join it. Am I right?

If so, the easiest way is to have two servers:

  • A tracker server, running on the web somewhere (eg a VPS)
  • The person hosting the game runs a game server

When a person (hoster) hosts a game, the game sends a message to the tracker telling it that a game exists.
When a person (joiner) looks for active games, they query the tracker to get the IP address and game details for the hosted game.
Then the joiner disconnects from the server and has to connect to the hoster. The tracker’s job is done.

True peer-to-peer networking can get a little more complex than the multiple-servers approach, particularly if you don’t want the user to have to open ports on their router to be able to host.
I’ve just finished a tracker implementation for online games and it took about a week to get it working and feature complete. I’ve also spend a week on peer-to-peer and haven’t had nearly as much luck. I haven’t even got the peers talking properly, let alone any actual features. I really dislike webRTC, it seems somewhat, well, convoluted. (and who wants to support 18,000 petabyte packets anyway. It just makes servers more complex…). In python, where you have low-level control, things should be a fair bit easier.

Simply put: you can’t, not without either both of you knowing each other’s IP address before hand or having a dedicated server with a fixed address that you both can connect to.

Additionally, if you don’t want players to have to configure port-forwarding on their routers, you’ll need to learn about UDP hole punching. Understand what it is, why it’s necessary, and how to do it.

Here’s a great paper on it: http://www.brynosaurus.com/pub/net/p2pnat/
Here’s an example UDP hole punching client and server written in Python: https://gist.github.com/koenbollen/464613

Instead of a server could I just have a webpage that has an API that can be edited with the most resent IPs for the Peers to grab and run a Ping test on?

Would this be a tracker like @sdfgeoff is talking about?

What do you think webpages run on? You’ve just described using a server to exchange IP addresses in a roundabout way.

A server cost 3,000 usd and a webpage only cost 30 a year; A server has to run the same game, I’m just talking about a list that can be changed, an A.P.I.
They’re not the same thing. :stuck_out_tongue:

I never said you had to buy a whole server. If you’re paying for a webpage, you’re simply paying to use some of the processing power of the server that the webpage is running on. You can also run a server from your personal computer at home at no additional cost other than what you’re already paying your ISP. “Server” is just a generic term used to describe a computing machine that accepts and responds to requests made by client machines. It doesn’t have to refer to fancy and expensive hardware.

And no, the server does not have to run the same game as the client. Any process - be it a video game, web browser, operating system, etc. - can communicate with any other process. There’s no requirement that they need to be the same.

To get back on topic; I’m looking for an alternative to using a server and/or runing my computer 24/7 for a game.
Peer to Peer will be the back up encase I cant keep up the server payments or I move from the location I have my IP at. And the game has already been made and given out.
I don’t want it to lose all it’s online options. an Example would be “Wight Knight Chronicles” for PS3. it lets you make your own 3D RPG town that others can visit and shop at; but the net support has stopped. It would of been great if there was a alternative set up ahead of time before release, so people could have still used its options after it’s dedicated Servers where no more.
I’m looking for a place / tutorials that might help me in learning python programing for such a cost affective program for my own game I plan on making in Blender.

Like I’ve already said, if you don’t have a pre-established rendezvous server, the only way for players to connect across the internet is for them to manually share their IP addresses with each other. Many games both old and new allow players to connect this way in the absence of a centralized server. The only problem is that one of the players will need to configure port-forwarding if they are behind a NAT.

I have the impression the above posts are somehow talk about issues with peer-to-peer network rather than how you can implement them.

The design is pretty straight forward. It is basically still client-server.

Each terminal acts as both client and server. The server side waits for connection requests, while the client side actively tries to connect to other terminals. On a pure client-server architecture there is either client or server (typically one server).

That is the basic. From here you need to discover all the “features” of network communication e.g. connecting, disconnecting, authentication, communication. On higher level, you need to look into user accounts, lobby, user groups, game sessions, game communication, conflict resolving. Pretty much the same as on any other architecture (with the exception you do not have an explicitly defined “master”).

If you do not want to spend months in figuring that out you might want to have a look at open simulator. I think there was another system, but I can’t find it yet.

Client-server is easier for the fact that you don’t need to worry about symmetric NAT punchthrough (having two peers connect properly, behind a NAT) .

Letting clients know about one another is easy. A webhost (see the quote above) can easily provide a table of IP addresses, without having to pay for more expensive hardware.
The difficult part is how to handle peer-to-peer “coding”. The best approach would be to use some GIT-like protocol for merging user changes and handling conflicts between users, without a master server - GIT is decentralised, it doesn’t need a master server. However, you can use a GitHub repository (or remote GIT server)

However, GIT is quite coarse grained - with commits - whereas you probably want to visualise the text being edited in character-by-character realtime. This is something you will need to think carefully about, and learn some strong programming skills.

Here are a few interesting links on the topic (p2p or server)


Awhile back wrote a nice little web site using flask that doubled as a master server. Ran it on a cheap-o VPS for 20 dollar. You don’t need the whole server.

Heh, my tracker is python-based and runs on a $5 VPS (DigitalOcean)
Still, it is an ongoing cost and a few years back I wouldn’t have had the means to run it.

My $5 VPS is way more powerful than it needs to be for my tracker and associated website, so if anyone has a blender tracker they want to run, send me a PM and I may be happy to make you a user on the VPS so you can host it. (after a code review and a chat about intentions etc.)

Before I purchased the $5 month VPS, I was simply using a computer plugged at home port-forwarded through he router running a service such as no-ip or ddns. It’s disadvantage was a much slower connection and potential uptie issues. I’m going to do a thurough comparison between the pi and the VPS soon to establish whether I should keep on paying for the VPS
(I also use the PI as a backup server for all my non-critical files (it has a 2tb hard drive plugged in), and can access it from anywhere in the world)

As you no doubt now realize, networking is a very big topic…

I’ve seen em as cheap as $1/month depending on your requirements.