Yet-another Multiplayer Demo (with capx)

Show us your completed creations made in Construct 2

Post » Wed Oct 10, 2012 5:58 pm

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?
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Thu Oct 11, 2012 2:37 am

@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.
B
18
S
9
G
5
Posts: 77
Reputation: 4,946

Post » Thu Oct 11, 2012 12:43 pm

@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, @lonehangman '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:( )
B
1
Posts: 2
Reputation: 229

Post » Thu Oct 11, 2012 1:24 pm

@stylewow or @BarneyK

You can make a button send the disconnect message, which does the same thing.
B
18
S
9
G
5
Posts: 77
Reputation: 4,946

Post » Thu Oct 11, 2012 3:57 pm

@lonehangman 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.
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Thu Oct 11, 2012 6:07 pm

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

Any idea for nameplates?BarneyK2012-10-11 18:09:42
B
4
Posts: 7
Reputation: 390

Post » Thu Oct 11, 2012 8:54 pm

Thank you for all the input people :D

Gonna try out the several ideas to see what I like the most and to learn more about javascript :)

Later on I think it would be best to run even more on the server side.
Like health of players so that no cheating happens and that players die on all clients and not just the ones in perfect sync.
But that after I get this to work :)
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Thu Oct 11, 2012 9:27 pm

@Schoening I'm planning to work the health thing out :)
Here's my to-do list:
- make nameplates
- server-side healths
- figure out how to make accounts for reloadable status
- graphics and other fancy stuff

And if I can make somehow accounts, than I can try to make achievements and other competitive stuff.

Any idea people for anything above? :)
B
4
Posts: 7
Reputation: 390

Post » Thu Oct 11, 2012 10:31 pm

Check out Clay.IO for the stats, and achievements. I am sure the owner could help as well.

What do you mean graphics? C2 for the visuals for me ^^ Else I would just work with some libaries
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Fri Oct 12, 2012 1:34 am

@Schoening

A good and easy place to learn javascript is at http://www.codecademy.com/
It's a good place to start and learn the fundamentals and some of the advanced stuff too.

@BarneyK
For nameplates...I don't really know, although I'll try to think of something.

Maybe we should open another thread later on, that has all the javascript and capx files for each socket.io capability.
B
18
S
9
G
5
Posts: 77
Reputation: 4,946

PreviousNext

Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 1 guest