Yet-another Multiplayer Demo (with capx)

0 favourites
From the Asset Store
BATTLE-ONLINE-DEMO
$4.75 USD
5% off
Demo Game Multiplayer Online with member registration system
  • hello. JohnnySheffield I once said you were working with 3 more people to do something like I have in mind and that you could provide me a demo. wanted to know if sige up what you said, and if at least you can help me with a couple of things I still do not understand. thanks

  • hi all,

    I noticed that when there is already a person in the game and you plug in another person the client moves the image to half the distance between the two spacecraft and the two most clients do not see their spaceships.

    why? how can I fix I want that each client can roam the map as my game window is 2048 x 2048

  • I realized that the problem is caused by scrol-to

  • LimonSpace

    I have the same issue with creating multiplayer games. If I log in with 2 or more players, the "ScrollTo" function messes up everything.

    Is there a way to have a ScrollTo function for each player, but don't affect the others?

    Idea: what if I make a personal, invisible scrollto-box, and when a player joins, destroys everyone's but their?

  • LimonSpace and BarneyK : I recommend you use the following event/action code instead of the scroll to behavior:

    Condition:

    Every Tick

    Pick Player by UID (in my sample I store the player's UID in the Controller object's MineUID instance var)

    Action:

    System->Scroll to object (choose the player)

    That would allow C2 to pick the sprite owned by the player and scroll to it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • juantar Thanks! It's a great idea, I'll give it a try!

    Btw thanks for the awesome tutorial of making games available to play online! You just know what's going on here!:D

  • Struggling with removing players that "leave".

    I would like to remove the Sprite of the player that has left the game.

    Closed browser or pressed leave.

  • Schoening Here's my solution for the leave button:

    Event: Button -> on clicked AND Sprite -> Pick instance with UID Controller.MineUID

    Action: Send "DC," & str(Sprite.NetworkID)

    Event: System-> compare: Socket.LastDataElement(0)="DC"

    Subevent: Controller -> compare: MineID != int(Socket.LastDataElement(0)

    AND Sprite -> Pick instance with UID Array.At(int(Socket.LastDataElement(1)))

    Action: Sprite -> Destroy

    This is my solution for that, and it works for me perfectly:) But the browser closing is problem for me too.

  • Ohh, I forgot to write down my problem:)

    So I want to make nameplates above the players. It works only when someone moves, because I put them into the update message. The name is appears at the moving player, but disappears from the others. It stays at the same place above the last moved.

    Someone has any idea for this?

  • Thanks Barney, Ill check it out.

    I could just copy-paste one of the current events inside the example_server.js and change the tag to "dc" right?

  • Schoening

    That is somewhat correct, but use this anyway.

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

          

          socket.broadcast.emit("message",'D,' + mySelf[0] + ',' + mySelf[1] + ',' + mySelf[2]);

          entities[myNumber] = null;

          

    });

    juantar

    or anyone that can help.

    I've created a server and made it all work. I uploaded it to various different hosts. But they all seem the have the worst connections, with an average ping time of 300 ms.

    What would be the best host to host such a server.

  • Schoening

    This is my server.js command for the button one:

    else if (new_data[0] == 'DC')

         {

              socket.broadcast.emit("message",

                   'DC,' + mySelf[0] + ',' + mySelf[1] + ',' + mySelf[2] + ',' + mySelf[3] + ',' + mySelf[4]);

              delete entities[myNumber];

              console.log('>> ' + mySelf[7] + ' disconnected');

              

         }

    This deletes the player, when hit the button, 's deletes on closing the browser. I tested it, and if you have the BOTH in the .js, it's the best. :)

    (Btw I'm BarneyK, but I get internal server error on login:( )

  • stylewow or BarneyK

    You can make a button send the disconnect message, which does the same thing.

  • sorry, I have only tried it on local networks. You can try serving from your home connection (if you have a good internet connection) or get a trial for a virtual hosted server.

  • You are right. Such a better solution, than mine, thanks!:)

    Any idea for nameplates?

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