Multiplayer is coming!

Discussion and feedback on Construct 2

Post » Wed Jan 29, 2014 3:42 am

Fimbul, I beg to differ. Im not a game developer, I work with servers and datacenters for a living so I actually know when I tell you that most people want servers for their games and p2p has all type of troubles for data connections unless your requirement is just for 2 persons and packets are low on bandwidth.

Not only I see people asking this all day but like I explained before, even Microsoft switched Skype off from p2p. Most people using Voip which is going to be similar to game requirements, also use a middle server, usually a voip provider, and do not usually call from machine to machine.

On the Google presentation they even explain for WebRTC, you will need a server to handle multiple connections because its just the nature of it once its scales.

This may work wonderful for someone playing chess with another party, but not if you want to connect 100 players together playing the same game at the same time. The network will start to drag the slowest link of all.

Its not correct than p2p is the shortest path either because that is not how networks are deployed worldwide.

Example, a player in Chile connecting to someone playing in Brazil will not connect via the mainland continent, their connection will travel to the US and then back creating an increase of 2 times the latency as opposed to just finishing the connection in the US. One nice example is that almost all South America is connected via Miami as a central hub, and usually for most countries there their connection will travel to the US and then back to the destination country.

In this small example case if your target is Latin America or have players there you would have a server in the US and it will be faster for everyone vs players connecting with each other.

This is also the reason why Dallas in the US is so huge in terms of datacenters, because companies like to host their servers on a middle ground in terms of distance. Same latency to LA or New York.

If your market is locally then p2p will work great, but not if your players are connecting from all over the world.

Even if they are local players (same city, state, etc) you will not achieve high bandwidth outputs with p2p, it will work for a couple of players tops because each user needs to stream their connection up to the network, and even in countries with high Internet speeds this is usually very low. Example, last time I was in Germany on a residential ISP connection download speeds for a 25 MBPS connection, only had tops 1 Mbps upload, now try connecting all your players via 1 Mbps. For a small game that only sends positions this will work fine, but it will cause problems as players increase. Now most games only send a few details, like position, score, etc, but still if latency sucks in one user it will drag the whole game down, this means all players.

On real live games this means suffering connection drops, slow games, etc.

Is that all worth?

In particular because setting up a server is so cheap and you will need to host scores, registrations, and probably a website anyway for your game.

Im not against P2P but if P2P worked for most things we would not have datacenters and servers today. P2P like its name says is peer to peer, and is usually designed for person to person. I imagine someone developing a game will need more than just a couple of players, that is the idea of multi-player. If you are creating a big multiple player game there is no way P2P will ever work.

If you only need to test it with a coupe of people or are playing with friends, then this will work just fine.
B
4
Posts: 19
Reputation: 663

Post » Wed Jan 29, 2014 3:47 am

[QUOTE=Ashley] The size of Construct 2's runtime might actually work to its advantage here. Hacking small, custom-written games is often easy - there might just be global variables with your score or position or whatever in them, and once you've found them, game over. However C2 has tens of thousands of lines of JS, all making up a fairly large framework that tends to store things buried fairly deep in lists and tree structures. Even pretty printing the code and running it through dev tools is a pretty daunting task. It's also possible to "protect" variables by keeping multiple copies of them in different places, but modified in some way (e.g. converted to a string and reversed). Then you can check for modifications if the variable doesn't match up with the copies. Combine that with a large and complicated obfuscated engine and it would probably be tricky enough to keep out casual scripters. And then, only the host can mess around with things - and if you're playing with a cheating host, I guess you can just find someone else to play with.[/QUOTE]

If you are sending files to the user, something like ioncube will protect at least something.

But for open code like HTML5 games usually are, a server side is the only way to protect the game, just like no one would allow users to view your asp or php code that runs on the website. The server side option is the only realistic option that can potentially avoid some of this cheating problems.
B
4
Posts: 19
Reputation: 663

Post » Wed Jan 29, 2014 7:15 am

People who host their own servers are usually the biggest cheats.

Could do like Minecraft servers and charge a fee to let people cheat.
B
230
S
62
G
33
Posts: 902
Reputation: 40,319

Post » Wed Jan 29, 2014 7:27 am

I think the biggest step will be to produce a game, that's even worth to cheat in :-D
Image
Check out our start-up and configure your own helmet in true 3D.
B
44
S
11
G
11
Posts: 1,154
Reputation: 9,978

Post » Wed Jan 29, 2014 1:16 pm

[QUOTE=weiterer] Fimbul, I beg to differ. Im not a game developer, I work with servers and datacenters for a living so I actually know when I tell you that most people want servers for their games and p2p has all type of troubles for data connections unless your requirement is just for 2 persons and packets are low on bandwidth.[/QUOTE]I also work with servers, datacenters and clusters, and I can tell you it's looking more decentralized every day, because monolithic servers simply cannot scale.[QUOTE=weiterer]Not only I see people asking this all day but like I explained before, even Microsoft switched Skype off from p2p. Most people using Voip which is going to be similar to game requirements, also use a middle server, usually a voip provider, and do not usually call from machine to machine.[/QUOTE]Microsoft moved skype to the cloud. The p2p remains, but now the peers are microsoft's own servers. Even if Microsoft ends up completely centralizing the whole Skype infrastructure, so what? As if Microsoft were the king of good decisions - see Internet Explorer.[QUOTE=weiterer]On the Google presentation they even explain for WebRTC, you will need a server to handle multiple connections because its just the nature of it once its scales.[/QUOTE]You need a server for it to work at all, not just for scaling it.[QUOTE=weiterer]This may work wonderful for someone playing chess with another party, but not if you want to connect 100 players together playing the same game at the same time. The network will start to drag the slowest link of all.[/QUOTE]What? If that were the case, bittorrent would only download at the speed of the slowest peer, and that is clearly not the case.[QUOTE=weiterer]Its not correct than p2p is the shortest path either because that is not how networks are deployed worldwide.
...snip...
In this small example case if your target is Latin America or have players there you would have a server in the US and it will be faster for everyone vs players connecting with each other.[/QUOTE]Player A in Brazil connects to Player B also in Brazil via link C in the US (p2p-model)
vs
Player A in Brazil connects to server C in the US, which then transmits data to player B in Brazil (server model)
How is that any faster? Worst case scenario, they are exactly the same. In all other cases, the p2p model is faster.

Besides, like I said three times before, you can mix the models:
Player A in Brazil connects to Player B also in Brazil
Player A in Brazil connects to Server C in the US
Player A sends data to both B and C
Server C sends player A's data to player B
Player B receives the data from player A and, much later, the same data again from server C

In player B's perspective, data received directly from player A isn't trusted implicitly, but is used for interpolation. Data received from server C is authoritative, and is used to determine serious state changes, such as kills, health, etc., and also as a backup should the direct link from A to B fail.[QUOTE=weiterer]Even if they are local players (same city, state, etc) you will not achieve high bandwidth outputs with p2p, it will work for a couple of players tops because each user needs to stream their connection up to the network, and even in countries with high Internet speeds this is usually very low. Example, last time I was in Germany on a residential ISP connection download speeds for a 25 MBPS connection, only had tops 1 Mbps upload, now try connecting all your players via 1 Mbps. For a small game that only sends positions this will work fine, but it will cause problems as players increase. Now most games only send a few details, like position, score, etc, but still if latency sucks in one user it will drag the whole game down, this means all players.[/QUOTE]1Mbps uplink is more than enough: you could send 10kb packets every 10ms (that is, 100 frames per second) - 10Kb of UTF8 text allows for between 10240 and 40960 characters. Those are insanely high values for a packet, and you could probably get away with something like 128 kbps.[QUOTE=weiterer]On real live games this means suffering connection drops, slow games, etc.

Is that all worth?

In particular because setting up a server is so cheap and you will need to host scores, registrations, and probably a website anyway for your game.

Im not against P2P but if P2P worked for most things we would not have datacenters and servers today. P2P like its name says is peer to peer, and is usually designed for person to person. I imagine someone developing a game will need more than just a couple of players, that is the idea of multi-player. If you are creating a big multiple player game there is no way P2P will ever work.

If you only need to test it with a coupe of people or are playing with friends, then this will work just fine.[/QUOTE]P2P is not exclusively person to person, though, it's peer to peer. Must I repeat myself again? A server is just a special type of peer!

If you want to argue with me that you can't possibly program a server in construct 2 to handle thousands of players, then yes I agree, but no one said you had to do that. Fire up node.js, it can talk to c2 just fine.[QUOTE=weiterer]But for open code like HTML5 games usually are, a server side is the only way to protect the game, just like no one would allow users to view your asp or php code that runs on the website. The server side option is the only realistic option that can potentially avoid some of this cheating problems.[/QUOTE]Did you read what I posted? It makes no difference whether the game is made in HTML5 or C++, and it makes no difference if the game is hosted on a server or on a machine in the client, the architecture is all that matters. If starcraft 2 needed server-side security to prevent cheating, it wouldn't have become the e-sport it is today. If bitcoin needed a server to provide security, it wouldn't be worth over $800 each.
Besides, no one said you can't have a server.Fimbul2014-01-29 13:27:00
B
36
S
8
G
8
Posts: 532
Reputation: 6,903

Post » Wed Jan 29, 2014 10:57 pm

So,

@Fimbul From what you've said, am I correct in saying that I can design a peer that functions as a server using WebRTC?

Then,

@Ashely would a Construct 2 app be able to successfully/feasibly function as a server using its upcoming p2p features with WebRTC?

Matter of fact, I do have another question, can/will/does C2 have the ability to interact with MySQL? So say I create a peer server, could I then store/retrieve, say, user data using MySQL?

Would this all (peer server & MySQL) even be worthwhile?DatapawWolf2014-01-29 22:57:59
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,826

Post » Thu Jan 30, 2014 12:05 am

@DatapawWolf
the answer is yes.

Put in the IP address in the client version. You host or have a host for the server version. Nothing stops this version from anyone writing a server using C2 code. Once you achieve P2P, you can just set up one pear as a server.

The requirement for coding a server in another language has been the only hurdle for C2 online service. It could be done by anyone to do online. It's just that most C2 devs would rather use C2 to write a server. so we are a go now.

I'm looking forward to brain explosions people are going to have when it's releasef and find the complexity of network games :D
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Thu Jan 30, 2014 1:32 am

[QUOTE=DatapawWolf] So,

@Fimbul From what you've said, am I correct in saying that I can design a peer that functions as a server using WebRTC?[/QUOTE]Yes! We'll see what Ashley comes up with - in principle, there's nothing in WebRTC preventing you from doing it all within construct.[QUOTE=DatapawWolf]@Ashely would a Construct 2 app be able to successfully/feasibly function as a server using its upcoming p2p features with WebRTC?[/QUOTE]The only problem with that is whether you mean a normal server (one of the player is the host) or a dedicated server. Both are feasible with construct 2, but for a dedicated server you'll either have to pair it up with a tracker (that is, a non-construct server responsible for handling handshakes between peers), or Ashley will have to come up with a server-side exporter (maybe node.js?), which is a lot tougher (But I would pay a hefty sum of money for a node.js exporter that could handle application design instead of purely gamemaking - might be a way to expand into the corporate market @Ashley? *Wink*Nudge*)[QUOTE=DatapawWolf]Matter of fact, I do have another question, can/will/does C2 have the ability to interact with MySQL? So say I create a peer server, could I then store/retrieve, say, user data using MySQL?

Would this all (peer server & MySQL) even be worthwhile?[/QUOTE]Unless Ashley makes a node.js exporter (in which case you'd probably have plugin wrappers for the npm database drivers), the only way you'll be able to talk to MySQL is via the traditional method of calls to a webserver. If the "server" isn't publicly available and is just a construct app that you leave open in chrome (quite the flimsy architecture if I may say so), you could design a pretty simple PHP proxy to forward ajax calls to MySQL - it would probably need less than 20 lines of code total.

It would definitely be worthwhile! For more complex games, say MMOs, you'd probably want to ditch construct for the backend though (unless there's that node.js exporter)Fimbul2014-01-30 01:33:42
B
36
S
8
G
8
Posts: 532
Reputation: 6,903

Post » Thu Jan 30, 2014 4:51 am

@Fimbul

Well, you actually kinda have the node.js exporter, thanks to the great guys at node-webkit. Nothing stops you to create a C2 written nw app, that runs in background and acts as a server. Just ignore the webkit part of nw, and use just node.js part. Put that on a pc with a public ip and you're done.


It's not the usual way someone would host and run node.js servers, and i don't recommend to do that, but hey, you can write a fully pledged http (or udp or tcp or etc) server in C2, it just comes with a backpack filled with webkit.


Also, i'm kinda amused with this all fuss about multiplayer coming to C2. It's already here; there are 2 official and about 5-6 unofficial plugins for about a year now (or more?) for creating different kinds of C2 multiplayer games. They are just not called "Multiplayer" and one has to be resourceful in using them.


I'm really glad when anything gets official support in C2, so cheers to Scirra on this announcement.


WebRTC!
JohnnySheffield2014-01-30 04:53:25
Be nice until it's time to not be nice
B
36
S
10
G
9
Posts: 293
Reputation: 6,712

Post » Thu Jan 30, 2014 7:28 am

[[email protected]]can/will/does C2 have the ability to interact with MySQL? So say I create a peer server, could I then store/retrieve, say, user data using MySQL?

Would this all (peer server & MySQL) even be worthwhile?[/QUOTE]

A nodejs server can be extended with node-mysql.
Also, you can combine techniques.

I combined a socket.io server connectivity with php/mysql/ajax connectivity. (socket.io for player updates and ajax for room and channel control)




[[email protected]]
I'm looking forward to brain explosions people are going to have when it's releasef and find the complexity of network games :D[/QUOTE]


amen

Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests