[PLUGIN] Network v0.3a update***

Post and try out addons that are currently in development.

Post » Sun Jun 02, 2013 6:57 pm

[QUOTE=scidave] Thanks for the offer Jayjay. I really need someone to try to compile it in Visual Studio 2012 with the compilation target of XP - 2012 so it can be more platform neutral.

I thinking there is some type of incompatibility with VS 2012 and the COnstruct SDK or it is something with the new version of ENET no longer working with the plugin and I will have to manually go through the pain of troubleshooting (which took days with the original plugin). Have to put print statements all over the place with a painful compile, copy plugin, and run scenario.

I just wanted to get a feel that other folks have built CC plugins with VS 2012 to rule out that issue.[/QUOTE]
I am now looking to another way with PodSixNet, I saw your tutorial and examples files but there is something I don't like, the server is doing directly what the client saw.

I want to make something like the Network Plugin with PodSixNet
Like a function "sendPacket" and an event onPacket()

Could you please explain me how to ?
Thank
B
7
S
1
Posts: 58
Reputation: 683

Post » Tue Jun 04, 2013 5:55 am

You can do the same thing with PodSixNet. The tutorial describes the scenario you are talking about, but there is more Python code so probably harder to understand.

When you send a message you do something like:
connection.send('action':'move'....data coordinates, etc)

The event would be:
def Network_move(self,data):
    ....code that does stuff to "data" with a message "move"

It is all very similar, but just harder to understand at first. If you take a couple passes through the tut you should pick it up..but you need to have some basic Python skills already to fully use it.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Tue Jun 04, 2013 3:22 pm

[QUOTE=scidave] You can do the same thing with PodSixNet. The tutorial describes the scenario you are talking about, but there is more Python code so probably harder to understand.

When you send a message you do something like:
connection.send('action':'move'....data coordinates, etc)

The event would be:
def Network_move(self,data):
    ....code that does stuff to "data" with a message "move"

It is all very similar, but just harder to understand at first. If you take a couple passes through the tut you should pick it up..but you need to have some basic Python skills already to fully use it.[/QUOTE]
I already started without PodSixNet
[code]
#!/usr/bin/python
# coding: ascii
import socket
import select
import ctypes

ctypes.windll.kernel32.SetConsoleTitleA("MineGalaxy")

hote = 'localhost'
port = 1011

connexion_principale = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connexion_principale.bind((hote, port))
connexion_principale.listen(5)
print("http://orbit84.tk/")
print("MineGalaxy Project: server ready")
print("=================================")
serveur_lance = True
clients_connectes = []
while serveur_lance:

     connexions_demandees, wlist, xlist = select.select([connexion_principale],
     [], [], 0.05)

     for connexion in connexions_demandees:
          connexion_avec_client, infos_connexion = connexion.accept()

          clients_connectes.append(connexion_avec_client)
          print '[CONNECTION] Something established connection with the server.'
     clients_a_lire = []
     try:
          clients_a_lire, wlist, xlist = select.select(clients_connectes,
          [], [], 0.05)
     except select.error:
          pass
     else:

          for client in clients_a_lire:

               msg_recu = client.recv(1024)

               msg_recu = msg_recu.decode()
               print("[PACKET] Get : " + msg_recu)
               
               
               if msg_recu == "connect":
                    client.send(b"playerConnect:map_id:name:life:shield:ship")
               elif msg_recu == "disconnect":
                    client.send(b"playerDisconnect:name")
               elif msg_recu == "attack":
                    client.send(b"attack:name:target")
               elif msg_recu == "isOnline":
                    client.send(b"serverStatus:yes")
               else:
                    client.send(b"unknownPacket:1")

               #client.send(b"5 / 5") - ceci enverra un packet au client qui a envoye le packet
               if msg_recu == "fin":
                    serveur_lance = False

print("Fermeture des connexions")
for client in clients_connectes:
     client.close()

connexion_principale.close()
[/code]

and client :

[code]
#!/usr/bin/python
# coding: ascii
import socket
import codecs

hote = "localhost"
port = 1011

clientA = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientA.connect((hote, port))

msg_a_envoyer = b""

while True:
     messageA = "isOnline"

     clientA.send(messageA.encode())
     messageB = clientA.recv(1024)
     messageB.decode()
     if messageB == "serverStatus:yes":
          connectbutton = 1
          
clientA.close()
[/code]

But Construct don't know what encode() is :
---------------------------
Erreur
---------------------------
Traceback (most recent call last):
File "<string>", line 27, in <module>
LookupError: no codec search functions registered: can't find encoding

---------------------------
OK   
---------------------------


What do you think is the best to do, continue using socket library or use PodSixNet ?

Regards, playerelite
B
7
S
1
Posts: 58
Reputation: 683

Post » Thu Jun 06, 2013 11:36 pm

I'd strongly recommend using PodSixNet or Mastermind. They wrap socket and deal with marshaling data. It will save you tons of time versus reinventing the wheel.

From what I read in your code, you are trying to redo a part what PodSixNet already does for you. You will quickly find that your code (at least as it is written now) doesn't handle data as well as PodSixNet.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Fri Jul 12, 2013 12:04 pm

is this plugin allow us to make multiplayer game??..
B
11
S
2
G
2
Posts: 62
Reputation: 2,153

Post » Sat Oct 05, 2013 1:54 pm

Hey, I'm back

I tried to make a multiplayer game with PodSixNet but I always get errors etc..., could you please give me the source of the Network Plugin so I can edit it and make it work for Windows 7 ?

I really need it or I need a working version :(

Thanks in advance, playereliteplayerelite2013-10-05 13:55:02
B
7
S
1
Posts: 58
Reputation: 683

Post » Sat Oct 05, 2013 8:41 pm

@playerelite Here's the source: https://app.box.com/s/mi3ohjgbqvjj403m54dc
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Mon Oct 07, 2013 11:24 pm

@playerelite When you made it work for Win7, you're sharing the working plug? Would be great. :)
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Fri Oct 18, 2013 10:20 pm

Ahah ^^
It's C++ and I dont know C++ :( don't think I can make it work for Windows 7, if only someone was good in C++ here and able to make it work with windows 7 : would be amazing :D

But I don't think someone will do this, everybody is using Construct 2 now :(playerelite2013-10-18 22:21:29
B
7
S
1
Posts: 58
Reputation: 683

Post » Mon Oct 21, 2013 5:48 pm

Yes and in C2 there won't be a plugin like that in the near future :/. Realtime Multiplayer(udp) stuff seems a little harder to implement in C2.
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

PreviousNext

Return to Work-in-progress addons

Who is online

Users browsing this forum: No registered users and 0 guests