Tako98's Forum Posts

  • 8 posts
  • good evening I uploaded my game in multiplayer with plug and socket zack on Dropbox, Now I ask myself, after I uploaded the game which I enter the ip server in order to allow the exchange of data from the client to the server? Diagram: Dropbox with the game (the game can choose to connect to the IP, but I have already set "192.168.1.X <---- Server, but does not connect.!

    <img src="smileys/smiley11.gif" border="0" align="middle" /> <img src="smileys/smiley11.gif" border="0" align="middle" /> <img src="smileys/smiley11.gif" border="0" align="middle" /> <img src="smileys/smiley11.gif" border="0" align="middle" /> <img src="smileys/smiley11.gif" border="0" align="middle" /> <img src="smileys/smiley11.gif" border="0" align="middle" /> <img src="smileys/smiley11.gif" border="0" align="middle" />

  • Today after so many attempts I managed to connect the server to the client without having problems, I thought that when a user entered a "room" was created as an object and for all other users, the problem is that after you have created the character the client should send a command to the server to update the other clients open to display all the characters, but I do not know how I installed socket, but the problem that I do not know what to write and what language should I use? For example there is a send command, but what I write I click in the textbox?. Let me give you a diagram. Client connects to the server you build your character -> everything right here then I open another tab and go back to the client, but I do not see the other character! Help me I am confused

    <img src="smileys/smiley11.gif" border="0" align="middle" /> <img src="smileys/smiley18.gif" border="0" align="middle" /> <img src="smileys/smiley12.gif" border="0" align="middle" />

  • the problem is to configure the program for a connection with the server, I selected connect here and do not know what ip enter. I tried putting the disk, hamachi, but nothing as if no incoming data to the server.

  • how to communicate with the server and client construct 2? I designed the server with a guide on the forum I post the link:https://www.scirra.com/tutorials/571/modded-socketio. now I designed the server and construct 2 I added the plugin and insert socket connect ip, ip which I enter? I also tried to use hamachi but when I start the server no sign of life, sorry but I used the google translator because I do not speak English.

    Server code:// This is required to run the server

    // here we define the port the messages are sended though.

    // in this case, it is port 8080, you can define it to every port you want.

    //but take note, some ports are already in use, then it will throw in an error message.

    var io = require("socket.io").listen(8080);

    //a variable for our "automatch making"

    TmpRoom="wait";

    //if a client connects to this, it performs this whole, big function.

    io.sockets.on("connection", function (socket) {

         // when the client emits 'adduser', this listens and executes

         socket.on("joint", function(data){

              // checks, if no other waiting player exists,

              if(TmpRoom=="wait")

              {

                   //if yes, then it perform this

                   // it sais TmpRoom = data, that is the username that is data

                   /*That means, TmpRoom is not anymore = wait! so the next one that

                   wants to join here, go into the next loop, the "else" loop */

                   TmpRoom = data;

                   //then it creates, and joins a room, that is called after the users username

                   socket.join(TmpRoom);

                   //Now it sends the message, you,playersname

                   socket.send("you," + TmpRoom);

                   // and now, it ends the loops.

              }

              

              else

              {

                   //Joins the Temporary Room, to the enemy player

                   socket.join(TmpRoom);

                   //Then it sends, the name of the room.

                   socket.send("Room," + TmpRoom);

                   //now, the interesting part. It not just sends a data to ONE client,

                   //but to all clients in the room. To all clients in the TmpRoom.

                   // the data that it sends, are the currently room name.

                   io.sockets.in(TmpRoom).send("enemy," + TmpRoom);

                   //and the username from the other player.

                   io.sockets.in(TmpRoom).send("enemy," + data);

                   //now it again sets the TmpRoom = wait, so the next that tries to join,

                   //again, is going to the upper loop, and creating its own room.

                   //Rooms are automatically "destroyed" when the Host, leaves the room.

                   TmpRoom = "wait";

              }

                   

         });

         //if the socket, gets a custom function from C2, called Message with some data(the room name),

         //then it performs this:

         socket.on("message", function(data){

              //now it is in the loop, and if the server gets a event called Chatmessage,

              //probably with a string message, then it performs this:

              socket.on("chatmessage", function(data2){

                   //Sends a chat message in the room.

                   //it sends data to all clients in the room. that

                   //the sending client defined in his "message" function.

                   io.sockets.in(data).send("chatmessage," + data2);

              });

              //that is pretty much the same and don�t require any explanation

              // i hope.

              socket.on("GameSettings", function(data2){

                   //Sends the Game settings, x,y coordinate, String, everything!

                   io.sockets.in(data).send("GameSettings," + data2);

              });

         });

         // when the user disconnects. perform this:

         socket.on("disconnect", function(data){

              //on disconnecting, it leaves the room.

              socket.leave(data);

         });

    });

  • StephenC

  • 2 day ago

  • but the game is loaded only if you found interesting? StephenC

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Good evening, I published my game, I figured if the game will be released when you or Will you advise me otherwise, once published, where can I find it?

    <img src="smileys/smiley19.gif" border="0" align="middle" /> <img src="smileys/smiley19.gif" border="0" align="middle" /> <img src="smileys/smiley19.gif" border="0" align="middle" /> <img src="smileys/smiley19.gif" border="0" align="middle" /> <img src="smileys/smiley19.gif" border="0" align="middle" /> <img src="smileys/smiley19.gif" border="0" align="middle" /> <img src="smileys/smiley19.gif" border="0" align="middle" />

    <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" />

  • 8 posts