Yet-another Multiplayer Demo (with capx)

Show us your completed creations made in Construct 2

Post » Fri Oct 19, 2012 7:37 pm

@Schoening
What do you mean by weird places? Why weird? And what's App Data?
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Fri Oct 19, 2012 8:32 pm

I am gonna Re-Install NodeJS and Step By Step go through it
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Fri Oct 19, 2012 9:51 pm

It works now :)
I created the node_modules folder again. And NPM install socket.io inside it with a Admin CMD. thx thx
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Fri Oct 19, 2012 10:40 pm

[QUOTE=Schoening] It works now :) ...thx thx[/QUOTE]

HTH
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Tue Oct 23, 2012 11:01 pm

This confuses me a lot!

When is the Array Assigned?

B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Wed Oct 24, 2012 12:58 am

@juantar hi. I have the game and connected and everything but I have a problem from a remote website to move a sprite until it dies but it updates the other page you can help me
B
16
S
3
G
3
Posts: 15
Reputation: 2,813

Post » Thu Oct 25, 2012 2:36 am

@Schoening : it gets set when C2 receives an I (initialization) or a C (create another player). Basically it gets assigned when a new player gets created (including the player that "owns" the current game instance.

That array just holds the UID of the players' sprites to allow picking them when a network event arrives affecting them.
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Thu Oct 25, 2012 9:10 am

Thank you :)
And the Array int(Socket.LastDataElement(1)) does not get overwritten because it uses the variable myNumber = count++; on int(Socket.LastDataElement(1))?

B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Thu Oct 25, 2012 6:55 pm

@Schoening Exactly. The server script takes care of incrementing the player id every time a new player joins.

The "Array int(Socket.LastDataElement(1))" part is basicaly saying:

1. get the affected player id number from the message we receive from the server. In the sample, the messages always put the player id in the second position of the message, that is why you need to get the element from the last data that resides in index 1 in the internal message array. The first position is the type of message.
2. Once the number if obtained, convert it to an int. This is because the raw network message is of text type.
3. Once the affected player id is converted to an int, use that number to lookup the UUID of the sprite that belongs to that player.

B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Thu Oct 25, 2012 9:17 pm

If the server runs for a extended period of time. Won't the count++ array get massive?

B
40
S
11
G
4
Posts: 665
Reputation: 8,403

PreviousNext

Return to Completed Creations

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest