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…