Hi
I am planning for moving two objects in two systems by using networking in blender.
I have client and server program but i have no idea how to start with the code for moving the object using this client and server code.I need the procedure for doing it.
The client and server code are as follows
Server.py:
#------------SETUP--------------#
1.from GameLogic import *
2.from socket import *
3.from cPickle import *
4.cont = GameLogic.getCurrentController()
5.obj = cont.getOwner()
6.if obj.OneTime == 0:
7. Host = ‘’
8. ServerPort = 10000
9. GameLogic.sServer = socket(AF_INET,SOCK_DGRAM)
10. GameLogic.sServer.bind((Host,ServerPort))
11. GameLogic.sServer.setblocking(0)
12. obj.OneTime = 1
13.PosYou = obj.getPosition()
14. scene = getCurrentScene()
15.Client = scene.getObjectList()[“OBClient”]
16.PosClient = [0,0,0]
#------------RECEIVE/SEND--------------#
17.try:
18. Data, CLIP = GameLogic.sServer.recvfrom(1024)
19. UPData = loads(Data)
20. PosClient = [UPData[0],UPData[1],UPData[2]]
21. Client.setPosition(PosClient)
22. Data = dumps((PosYou))
23. GameLogic.sServer.sendto(Data,CLIP)
24.except:’’’’
25. pass’’
Client.py:
#------------SETUP--------------#
1.from GameLogic import *
2.from socket import *
3.from cPickle import *
4.cont = GameLogic.getCurrentController()
5.obj = cont.getOwner()
6.if obj.OneTime == 0:
7. ServerIP = GameLogic.IP
8. Serverport = 10000
9. Clientname =
10. ClientPort = 10001
11. GameLogic.sClient = socket(AF_INET,SOCK_DGRAM)
12. GameLogic.sClient.bind((Clientname,ClientPort))
13. GameLogic.host = (ServerIP,Serverport)
14. GameLogic.sClient.setblocking(0)
15. obj.OneTime = 1
16.PosYou = obj.getPosition()
17.scene = getCurrentScene()
18.Server = scene.getObjectList()[“OBServer”]
19.PosServer = [0,0,0]
#------------RECEIVE/SEND--------------#
20.Data = dumps((PosYou))
21.GameLogic.sClient.sendto(Data,GameLogic.host)
22.try:
23. Data, SRIP = GameLogic.sClient.recvfrom(1024)
24. UPData = loads(Data)
25. PosServer = [UPData[0],UPData[1],UPData[2]]
26. Server.setPosition(PosServer)
27. Server.setOrientation(OriServer)
28. except:
29. pass
Please help me regarding the procedure to move the objects using networking in blender…
Awaiting for reply…