Blender Networking Ideas

I’m currently working on my own attempt to bring network gaming to Blender. This is more so for experience than any thing else, but I still want what I’m making to be useful. Because of this, I want to ask you guys what you would want in something such as this.

What I already have is pretty simple. There’s a server and client blender file. First you start the server, and then the client. The client will then attempt to connect to the server. As of now, what I have written is capable of connecting multiple clients, recieving data from each client, and having clients receive data from the server. The data that is sent and received is customizable, but not easily done so.

Using what I have made, I’ve made a simple game where your move around as a cube, and you can interact with each other. Here’s a link to the video of it.
http://www.youtube.com/watch?v=Cp3J7FFaBBc

Once this becomes a bit more complete I’ll post it into the resources section

If you guys have any questions or requests, I’ll be happy to respond.
Also, ideas for naming this would be nice too. :slight_smile:

Very nice. I have made my own networking clients an servers with blender games before, and even an IRC client with blender.

I was just wondering what lag time is, also what protocol you use(UDP or TCP) With my Client/Server, I had roughly 1 second of lag time connecting from the United States to the Netherlands.

Good luck and great job.

Right now I am using a TCP, though if I wanted to, I could change some things around and make it use UDP instead. Also, I’m not exactly sure how I would test the lag time. The best I can do is test it on my LAN, in which case it’s pretty much instantaneous.

I just uploaded a video. The quality isn’t that great because of the screen recorder, but it still showed it in action. I’m thinking of adding a simple chat system into it. Also, I was wondering, at which point do you guys think that simplicity becomes restricting? Should I give it a GUI for displaying the chat, or should I leave that up to the person using it?

Also, do you guys no of any decent screen recorders I could use?

I don’t even know if anyone is reading this, but still, I have another update. :spin:

I’ve changed around a few things, and now I’m using UDP IP.

It seems as though what I’m working on is starting to diverge into two separate projects. What I originally had planned to do turned out to seem to complicated for those who are new to Python. Noticing this, I started to work on something to simplify things.

My original goal has been completed, and looking back, it pretty much turned out to be wrapper for a socket. If you were to write a simple client and server, it would turn out something like this.

Server:

import bi_net
from bge import logic

cont = logic.getCurrentController()
own = cont.owner

class Server(bi_net.Server):
    def __init__(self):
        bi_net.Server.__init__(self)
    
    def on_connect(self, address):
        print(address, 'has connected')
    
    def on_disconnect(self, address):
        print(address, 'has disconnected')

if not 'init' in own:
    logic.server = Server()
    logic.server.send('data')
    own['init'] = 1

input = logic.server.recv()
print(input)

logic.server.send(input)

Client:

import bi_net
from bge import logic

cont = logic.getCurrentController()
own = cont.owner

class Client(bi_net.Client):
    def __init__(self):
        bi_net.Client.__init__(self)

if not 'init' in own:
    logic.client = Client()
    own['init'] = 1

input = logic.client.recv()
print(input)

logic.client.send(input)

To me, that looks simple and easily understood, but I’m sure to someone who is a programming illiterate that would seem like enough code to cause their mind to implode.

Seeing this, I went ahead and did my best at making a script that someone could use for a simple client server setup.

Now if someone wanted to make a server and client, they would just have to attach a simple script to an object and put two modules in the directory of their game. This results in the client and server looking similar to this.

Server:

import simple_server

Client:

import simple_client

Just to clear up any questions about the server:

  • Both servers are able to handle multiple clients.
  • Using the bi_net module you are not limited, you just have to know what to do.
  • Using the simple_server module you are limited, but most things are taken care of.
  • The simple_server module does not support anything regarding IPO.
  • The simple_server module does support physics.
  • The simple_server module uses the bi_net module

Whenever I get a chance, I’ll try to upload a better video. That last one was a bit…

there is a more simple solution:
add #comments.
e.g

#defines a class, which is like a section, which is called to.
#it allows you to use the same code lots of times in a
#script without retyping it.
#the parameters in the () tags allow you to input data to the class.
class Server(bi_net.Server):

is this actually online or lan, or does it just send an receive locations on one computer

Networking means either lan or online.
(Both)
Listen Alan, if you want help with multiplayer, pm me.