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

This forum is currently in read-only mode.
From the Asset Store
Fantasy Game includes more than 600 sound effects inspired by hit computer games like World of Warcraft and Diablo.
  • Another question, is it possible to access a VB.NET server with the Network plugin, because I started doing my server in VB but I can't connect with the network plugin :/

  • Unfortunately run into an odd bug when trying to update this plugin. I'm using VIsual Studio 2012 and get errors on:

    Edittime.cpp. In particular CArchive which is referenced. This makes sense because it is a MFC class...I just have no clue why this wouldn't have thrown an error earlier.

    I managed to fix that error by using the "bin" class instead, but during rundown the plugin crashes. It has been forever since I've coded this plugin so maybe I'm missing something, but very odd that the project wouldn't just compile fine right off the bat...I even used Visual Studio 2010 compatibility mode.

    Anybody that has done plugin development have a thought on this? I hate that it is difficult to debug plugins...

    EDIT: Also, an odd note that when importing the plugin (this even has issues with the plugin SDK) it does not include Edittime or ConstructSDK.ref in the build. Once I add constructSDK.ref into the build I get a warning that it can't find unique match for symbol "GetInfo".

  • scidave I have a copy of VS2010, want me to try compiling the code for you? I haven't touched CC plugins in a long time though so I might need a little guidance getting it to work.

  • 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.

  • 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.

    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

  • 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.

  • 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.

    I already started without PodSixNet

    #!/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()
    

    and client :

    #!/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()
    

    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

  • 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.

  • is this plugin allow us to make multiplayer game??..

  • 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, playerelite

  • playerelite When you made it work for Win7, you're sharing the working plug? Would be great. :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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 :(

  • 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.

  • Ashley already mention that he's gonna work on a P2P system(TCP/UDP) for Construct 2, so hopefully by next year we can see multiplayer in our games.

    EDIT: Just noticed this was Construct Classic section. My bad, ignore the comment above.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)