Networking and building

Discussion and feedback on Construct 2

Post » Tue Jan 06, 2015 5:56 pm

Hello,

first of all: WOW!!!! I've never seen an game engine where you can implement networking that easy! It's absolutely amazing work that you have done!

But: For my project I need dedicated servers. This works by starting the first instance on the server which will become the host. It's fine for now, but I don't want to distribute the servercode to the users. It's impossible and a "No-Go" for me. To solve this issue I've thought about putting all server code in one event sheet and remove it from the client distribution. But this means I need to manually remove it all the time I want to release a New version. Would it be possible in a future version that you implement some kind of a "build" system where I can create some environments (e.g. "Client", "Server") and configure the event sheets and export options I want to be Integrated in this environment? I think this will not only help in this case but also on multi platform distributions.

Best,

Benny
B
6
S
2
Posts: 19
Reputation: 1,038

Post » Tue Jan 06, 2015 6:02 pm

Hi,

one more! :-) Does someone know if it's possible to start a browser from the linux shell without the need of a graphical environment for the use of the dedicated servers? Something like adding the parameter --no-gui on starting chromium and thats all?

Best,

Benny
B
6
S
2
Posts: 19
Reputation: 1,038

Post » Tue Jan 06, 2015 10:28 pm

Can you create two separate projects? One is the client and the other is the server.
B
21
S
5
Posts: 196
Reputation: 1,974

Post » Wed Jan 07, 2015 5:43 pm

Hi there !

I've never seen an game engine where you can implement networking that easy!


I totally agree :D And it's really easy to understand as well, with the very detailed tutorials explaining the design of the multiplayer module. Coming from a background of low-level programming, that certainly is a change !

Anyway... I don't have much to contribute to the initial question, but I was wondering about the "dedicated server" idea. While I understand the principle (ensuring you're the host by being the first to join the room, etc.), and while I have some knowledge of general networking, I have little expertise of server-side technologies (the typical light-PHP and simple databases).

If I were to do something like you describe, there are some questions I'm not too sure how I would deal with... For example, I guess there's always a risk of the "server" (i.e. host here) crashing or losing connection. Does that mean you need some kind of a daemon process to monitor the session and spawn a new "host" if necessary ? Or maybe there are infrastructures that guarantees your server will always be up (e.g. using some black-voodoo-dark-magic stuff like the popular Amazon AWS) ?

If you have a few minutes, and don't mind sharing some infos of course, I would really appreciate a quick overview of the kinds of technologies / services you need to build something reliable to support this idea.

Regards
Image
Game Producer & Independent Developer - http://raphaelgervaise.com
B
24
S
9
Posts: 237
Reputation: 2,232

Post » Thu Jan 08, 2015 10:47 am

This biggest problem i can see is making sure your server remains the 'host'.

If it somehow gets disconnected from the signalling server, then one the players trying to connect to the game will become host, and you will have trouble getting back the 'host' position. You could try and have a condition that if player is host when connected, then disconnect from signalling and put a 5 second waiting period. The problem with this however if a lot of people are trying to connect, you will have a hard time connecting and becoming the host again.

My way around this:

I run windows server 2012 R2.
I have a my own copy and license of the signalling server running locally so if the server somehow crashes, it automatically detects it and runs a .bat file shutting down the physical server.
When i re-launch the server, i make sure the internet connection is disabled first, making sure all the game 'servers' are running, then i open up to the internet, allowing all the players to connect.

On the actual set up, again i run windows server 2012 R2.

All my game 'servers' are running via minimized nodewebkit, so very few resources are used. *though when changing something via graphical environment will kill any framerates unless the server has a dedicated GPU. So make you make any changes before you open the game up to the internet.

I use a modified version of the multiplayer plugin which allows the use of multiple multiplayer objects, allowing the creation of dedicated chat servers and various game instances, all whilst communicating to each other. (very handy)

Another thing you should note, if you start creating the server and the client separately, any objects that require syncing will not sync at all. This is because (even though you may have copy and pasted the object over), the object will be using different iid's. To fix this you need to go into the save file of each one, and change the iid of the object to that of the servers version, or the other way around.

I hope some of this answers your questions,

Best Regards,
Tom
B
10
S
2
G
1
Posts: 92
Reputation: 926

Post » Thu Jan 08, 2015 12:46 pm

Hello,

thanks a lot for the answers, that get things become more clear to me.

@tomsstudio: I know about the problem. At the moment I'm trying some different solutions to get a basic system done that I can use as the base for the project. At the moment I have the client and the server in the same project, defining a global variable defining if the instance is running as server or as client. If it says it's the client and the instance becomes the host I throw an error message saying that the servers are down at the moment and the user should reconnect in a couple of minutes. But that means that I have to export all the time two versions of the project (server and client), but after all everything can be done in one project which should be easier to make changes in bigger projects on a later stage (hopefully).

For the server I've done a special GUI which looks like this:

server.png


I hope that I can solve the performance problems with this solution, but I'm not sure if Construct2 automatically remove the rendering of non visible objects. I have to test this...

@Refeuh: The main two reasons why I want to use dedicated servers is that I want to prevent cheating and that I want to make sure the server has a great connection which is mainly because it's located in a datacenter and not at the internet line of a user. In general Construct2 follows the "never-trust-the-client" principle which is great because it's some kind of an authoritative server model. That means that the clients are only "displaying" what's going on on the server and don't include own "logic" which could confuse the gameflow. If you have a serious gameplay like a MMOG where users can buy items, handle their own char etc. it would be a big problem if the server is running on a client machine because this client can always cheat the game by manipulating the local variables of the javascripts (remember that the exported game is not really encrypted or something). Also he can use some speed hacks etc. If I run a dedicated server on my own machine located in a datacenter, the clients are only displaying what has been calculated on the server, no matter if they hack their local client. It will always be overwritten by the data the server is sending. Thats in my opinion the better model to handle serious games.

Best,

Benny
You do not have the required permissions to view the files attached to this post.
B
6
S
2
Posts: 19
Reputation: 1,038

Post » Thu Jan 08, 2015 12:57 pm

Hi,

UPDATE: Found a solution: https://www.scirra.com/forum/plugin-argv_t111372

@tomsstudio: Is it possible to start the nodewebkit with command line parameters? So for example that I can make something like this:

Code: Select all
./server --level=woodworld_1 --instance=1


At the moment I have to start an own server for every "map" I want to run. In my game the user can create his own char and after that he can choose different "maps" on a gameworld where he can join to play the game. For this I have to run a server for every map which is available for the users. If (for example) each server can handle a maximum of 64 players I have to start a new instance of each map where new players are connected to... some kind of a load balancing... I only wonder how I can get the info to the server which map should be loaded. Maybe I should create some kind of a configuration file and load it via ajax? But command line paramters are nicer in this case I think...

Best,

Benny
B
6
S
2
Posts: 19
Reputation: 1,038

Post » Thu Jan 15, 2015 5:12 pm

Thanks for considering my questions in the discussion ! I am aware of general multiplayer concepts (architecture, security, not trusting the clients, etc.) but I have little hands-on experience of the server-side technologies, and setting up servers in general. That was very informative :)
Image
Game Producer & Independent Developer - http://raphaelgervaise.com
B
24
S
9
Posts: 237
Reputation: 2,232

Post » Sat Oct 03, 2015 2:45 pm

@dryas i have a similar problem just my issue is how do i run the lobbyof a game on a Linux server... for example ...

if u take a look at the lobby tutorial i linked above the lobby capx doesn't require multiple instances or a client to run it u just need to host it or keep it on ur own machine opened... just .. i dont want to have my computer open 24/7 so i want the lobby capx opened on a Linux server wold that work?

and wold the plugin u said is a fix .... wold work with that? im kinda of a noob in networking area... i only need the lobby to be opened 24/7 without a gui .. or trough a server that has the gui interface opened and i can log off and forget about it.. its essential for my project... im doing a agar.io like clone... and requires a live lobby ... then the rooms(or as clients will see "servers" ) are easy to make and everything else is just client side..

@blackhornet i think you could answer it more accurate :)
B
77
S
23
G
69
Posts: 1,353
Reputation: 43,958


Return to Construct 2 General

Who is online

Users browsing this forum: Baidu [Spider], oozkaya and 10 guests