Socket.IO Plugin - Discussion

Discussion and feedback on Construct 2

Post » Sat Oct 04, 2014 7:20 pm

DatapawWolf wrote:And what about database communication? Is that even possible through the browser?

The serverhost can cover this by AJAX call to PHP. Btw, this is actually a solid way (i think) to prevent cheating/hacking by having the host to do the communication to DB.

Honestly, I haven't covered this yet because I have no knowledge in it, still a PHP beginner, not yet sql. If only we're capable of communicating to DB using C2, with node,js plugin or something, then we can actually achieve this purely by C2.

I'm not sure requesting DB plugin for C2 will have any attention because it is niche and possibly only see small usage, and possibly cause beginners to use it unwarily and cause their DB to be hack. But I still wish it will be made though, regardless official or 3rd party plugin. Some discussion.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Sat Oct 04, 2014 10:50 pm

@DuckfaceNinja well, bringing Node.js or any other server-sided code back into the mix kind of defeats the whole purpose of having this within C2. :p

Ah well, I dunno. I'd still love to see the option to use the WebSocket plugin with Socket.IO, however, if it's definitely not going to be an option, I might as well look into creating a custom server with Node.js.
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,826

Post » Sat Oct 04, 2014 11:31 pm

DatapawWolf wrote:
Ashley wrote:That could also be running in a browser tab on a dedicated server if you like.
How reliable is that?

Very reliable. The ghost shooter multiplayer demo has been running for weeks as host on the multiplayer server without problems.

Ashley wrote:or just be assigned to the first peer who happens to join the room.
Then there is no authority, correct?

No, there is authority. The host peer is always authoritative on the game state. It's just the multiplayer engine makes the first peer to join the room the host.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,625

Post » Sun Oct 05, 2014 12:09 am

Ashley wrote:
DatapawWolf wrote:
Ashley wrote:That could also be running in a browser tab on a dedicated server if you like.
How reliable is that?

Very reliable. The ghost shooter multiplayer demo has been running for weeks as host on the multiplayer server without problems.
Wait, what do you mean by that? You mean you've been running a host using the shooter demo?

Ashley wrote:or just be assigned to the first peer who happens to join the room.
Then there is no authority, correct?[/quote]
No, there is authority. The host peer is always authoritative on the game state. It's just the multiplayer engine makes the first peer to join the room the host.[/quote]But if the first peer becomes a host, who checks that peer? Or am I thinking about this incorrectly?
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,826

Post » Sun Oct 05, 2014 1:00 am

@DatapawWolf
Multiplayer is awesome. However doing MP requires an entire different way of thinking. And your having troubles adapting to the different thought process. This is going to make MP difficult. As a personal experience. I worked on a MP game with a co-worker. I did the entire networking side including writing the server in NodeJS and the client in C# Unity. All the other guy had to do is use 3 functions and understand network messaging. He understood the messages very quickly. But it's been 2 weeks and the networking thinking is still causing him troubles. Smart guy though. We have managed to get through enough.

Anyways stop thinking of Peer as being a player. Break that chain now. Peer != Player. Peed is any computer connected. So First Peer is the Host. Who says it's a player peer? Your assuming that a player is going to be a first peer and thus authoritative host. This is an incorrect form of thinking.

You can create a first room peer and run it on your dedicated hardware server. Thus your now controlling the authoritative information. This peer
A. Does not have a playable character or if it does it's out of bounds.
B. This peer NEVER logs out as it's run on your computer as the authoritive host.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Sun Oct 05, 2014 2:03 am

jayderyu wrote:You can create a first room peer and run it on your dedicated hardware server. Thus your now controlling the authoritative information. This peer
A. Does not have a playable character or if it does it's out of bounds.
B. This peer NEVER logs out as it's run on your computer as the authoritive host.

Ah, ok. Thanks, that clears it up better!
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,826

Post » Sun Oct 05, 2014 6:54 am

DatapawWolf wrote:But if the first peer becomes a host, who checks that peer? Or am I thinking about this incorrectly?

Download the capx in my last bug report if you want to see a method of ensuring your server to always be the host. This is one of the few ways to do it, it uses roomlist checking to verify a host exist or not before peer attempt to join room.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Sun Oct 05, 2014 1:39 pm

DatapawWolf wrote:Wait, what do you mean by that? You mean you've been running a host using the shooter demo?

The game is coded so that the host peer does not participate in the game, and then it's been running in a Chrome tab on a dedicated server for weeks without any issues. So it's basically like having a dedicated server for the game. That's been my point: it's always been possible to do that with the multiplayer engine.

But if the first peer becomes a host, who checks that peer?

The question is identical to asking "who checks the server in an authoritative server game?". Nobody. The authoritative server (or host peer) has by definition *the* global game state, and everyone else is doing their best to display that state with minimal latency.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,625

Post » Mon Oct 06, 2014 1:18 pm

@DatapawWolf

Here you go, i've made the repo public, anybody is allowed to download and play with this plugin;

http://git.machina.hr/c2-socketio/socket-io


Few things to keep in mind:

- Needs a custom version of a socket.io client library (one-liner change).
- MIT license.
- Want to contribute? Email me and i'll open up an account.

edit: i've just saw this thread. Some good stuff is mentioned here!
Last edited by JohnnySheffield on Sun Oct 19, 2014 11:18 am, edited 2 times in total.
Be nice until it's time to not be nice
B
36
S
10
G
9
Posts: 293
Reputation: 6,712

Post » Mon Oct 06, 2014 3:37 pm

@JohnnySheffield That's neat, but my deal-breaker right off the bat is commercial use. The reason I'm considering/requesting Socket.IO is mainly because it's free, otherwise there's a convincing argument for Scirra's multiplayer plugin. Also - and I don't know if I'm just picky (probably picky) or what - why would you invite contributors to work on a project for which you hold all rights to?

Like I said, not trying to pull apart your efforts. I'm glad to see an extension of C2 that supports the newest Socket.IO functionality. Just a bit skeptical. ;)
Last edited by DatapawWolf on Mon Oct 06, 2014 4:13 pm, edited 1 time in total.
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,826

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: mihirolover, Slice and 15 guests