I wrote a simple module to use easely the python TCP socket to create game. With it it is possible to synchronize some object's rotation, location, properties, ...
But when I test it, there is a problem.
BGE seems to be stopping the scrit during the execution or anything like this.
I start the server (server-test.py) on python 3.2 in a shell
I open client-test.blend with blender 2.73 and I launch the game.
the client connect himself to the server, and normaly sends sync requests, but the script is stopped just at line 46 of file client.py
and it continues when I stop the BGE !
Here is my work
the server console output is then :
[('192.168.1.10', 45619)]
{}
[('192.168.1.10', 45619)]
{}
[('192.168.1.10', 45619)]
{}
getpacket: 'registerloc\x00Cube'
getpacket: 'registerrot\x00Cube'
getpacket: 'registerprop\x00Cube\x00prop'
send 'setloc\x000\x000\x000\x00Cube'
send 'setrot\x000\x000\x000\x00Cube'
send 'setprop\x00Cube\x00prop\x00None'
send 'setloc\x000\x000\x000\x00Cube'
send 'setrot\x000\x000\x000\x00Cube'
send 'setprop\x00Cube\x00prop\x00None'
send 'setloc\x000\x000\x000\x00Cube'
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.2/threading.py", line 740, in _bootstrap_inner
self.run()
File "/home/jimy/tron-reboot/server/BGE-bug-socket/server.py", line 140, in run
if data.position : self.sendall('setloc\0%d\0%d\0%d\0%s' % (data.position[0], data.position[1], data.position[2], obj))
File "/home/jimy/tron-reboot/server/BGE-bug-socket/basic_connection.py", line 206, in sendall
self.send(i, data)
File "/home/jimy/tron-reboot/server/BGE-bug-socket/basic_connection.py", line 202, in send
self.tunnels[index].send('{}{}{}'.format(START_MARK, str(data), END_MARK).encode())
socket.error: [Errno 32] Broken pipe
[('192.168.1.10', 45619)]
{'Cube': {pos=(0, 0, 0), rot=(0, 0, 0), parent=False, properties={'prop': None}}}
[('192.168.1.10', 45619)]
{'Cube': {pos=(0, 0, 0), rot=(0, 0, 0), parent=False, properties={'prop': None}}}
^CTraceback (most recent call last):
File "server-test.py", line 12, in <module>
sleep(1)
KeyboardInterruptAll is normal on this side : when the server receive the requests, it starts synching.
The client continue execution only after the BGE stopped (after Blender Game Engine Finished)
The client side get :
Blender Game Engine Started send queued Blender Game Engine Finished queue send 'registerloc\x00Cube' queue send 'registerrot\x00Cube' queue send 'registerprop\x00Cube\x00prop' receiving getpacket no packet send queued receiving getpacket getpacket: 'setloc\x000\x000\x000\x00Cube' confirmed Writing: /tmp/client-test.crash.txt /usr/local/bin/blender : ligne 2 : 17951 Erreur de segmentation /usr/local/share/blender/blender "$@"
Please help me !
I am on a important game project and I need multiplayer (tron-R {reboot|reloaded}.
jimy.byerley@gmail.com