Yet-another Multiplayer Demo (with capx)

Show us your completed creations made in Construct 2

Post » Thu Nov 22, 2012 3:44 am

Does anyone know how to catch the following error when the server code execution is terminated?

"Javascript error!
TypeError: this.socket is null
http://localhost:50000/socket.io.min.js, line 2 (col undefined)

This is either a bug in Construct 2 or a problem in a third party plugin or behavior - please report it to the developer!"

I thought it might be if ...


socket | is data available?    Do stuff here while server is running

ELSE

<catch error / disconnection to server here>

But that doesn't seem to catch it... or using the 'On Error' event, or inverting 'socket | !is data available' event...

?
B
56
S
13
G
1
Posts: 151
Reputation: 4,499

Post » Thu Nov 22, 2012 10:43 am

@remy-jay I think JohnnySheffield's version (http://www.scirra.com/forum/plugin-zack0wack0s-socketio-mod_topic56503.html) fixes this issue.

I think you can also add the disconnect event and adding an action there to disable the ondata received event (system->disable event group). You will need to put the ondata received in its own group.
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Sun Dec 02, 2012 2:08 pm

Just want to ask , does this plugin works if i made the game for windows 8 ? or it just work for ios? Thanks in advance.
B
4
Posts: 2
Reputation: 386

Post » Mon Dec 03, 2012 2:14 pm

I have not tested windows 8 rt, but it works on chrome on win 8 desktop version
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Sat Jan 12, 2013 11:30 am

Hi,

Managed to get a game and socket io server working fine on my computer thanks to these examples. But does anyone know how and where to host the game and the socket.io server files?

I tried uploading them on nodejitsu, but unfortunately all I'm getting there is a 'welcome to socket.io' message instead of the very basic tester game I was hoping to see.

Does anyone have any experience with uploading these files? If so, any info or pointers would be appreciated.

Thanks!
B
3
Posts: 4
Reputation: 658

Post » Sat Jan 12, 2013 5:39 pm

@HollyB
Can't help you with this plugin but take a look at my MultiPlayer + online demo. My demo's hosted on Nodejitsu, so you should be able to do the same if you use my plugin/behavior and examples.
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Sat Feb 02, 2013 5:11 pm

Hello.
I'm completely new to any form of game-making (real noob), and have no programming competence of any form, so pliz be patient with me. That's the main reason i ended up with DL'ing C2, which seemed like a cool and pretty-easy to learn software. Just wanting to ask if this plugin of yours is the furthest the C2 community has gotten to a real multiplayer feature for C2? And how does it work, could i make a PvP game like for instance "tetris battle" with it, or would that require more complexity and development?

The answers might already be in the thread, but as I stated i am completely new to "game-making", so I don't udnerstand much of the issues discussed, I need very basic language to understand. Thanks for any answers in advance :)
B
3
Posts: 6
Reputation: 681

Post » Sat Feb 02, 2013 5:19 pm

I'm sorry. My post were supposed to be posted on the "Multiplayer + online demo" topic. Had both threads open. Silly me :P
B
3
Posts: 6
Reputation: 681

Post » Wed Feb 20, 2013 7:49 pm

[QUOTE=lonehangman] @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.[/QUOTE]


i try this solution

socket.on('disconnect', function (data) {
     
      socket.broadcast.emit("message",'D,' + mySelf[0] );
      entities[myNumber] = count--;
console.log('D'+ ',' + mySelf[0]+ ',' + 'SCONNESSO');
     
});

because with your code, the new player can still see the old player who is disconnected.

and for this I put in my layout a LOGOUT button but is the same if you close the browser.

I created a new client, it communicates with another client and enters into aliens, box etc etc, now I have a little problem, when the client aliens that acts as a virtual machine connects sends a connect message, put the aliens on the player client and everything works. the problem is that it also creates a spaceship, perhaps due to the message I, how can I fix this?LimonSpace2013-02-20 20:04:50
B
11
S
5
G
1
Posts: 53
Reputation: 1,633

Post » Fri Feb 22, 2013 7:26 am

solved
B
11
S
5
G
1
Posts: 53
Reputation: 1,633

PreviousNext

Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 1 guest