How do I create a dedicated server?

Get help using Construct 2

Post » Sun Jul 06, 2014 12:02 am

So I would consider myself intermediate in my skills with the event system. I have a pretty decent understanding of the multiplayer object, but that aside, I was trying to create two different projects for our upcoming game Xbridge. One of these projects is the client which is the game itself. The second being, of course, the host project which the clients connect to. I was setting it up so if the clients accidentally became the "host" being the first to enter the room, the game would just tell them that the server was down for scheduled maintenance and they would get disconnected.

However, the client and server could only ever stay connected for a short amount of time and couldnt send or receive signals to each other, all they could do was see other player alias' in the player list. So my question is, is it possible to have 2 different projects interacting with one another for the sake of creating a dedicated server?

My current solution is to just make is so the host layout is accessible from the multiplayer layout, but can only be accessed via a secret key. not the best way to do it, and I still dont understand how to encrypt things like passwords or use hash tables. Im still kinda new to that aspect of security.

Any help would be super appreciated!
Thanks!

Austin Morgan
Varia Games
B
20
S
2
Posts: 70
Reputation: 1,466

Post » Sun Jul 06, 2014 1:28 pm

You can, and should, create both a server and a client in the same project. This guarantees the server and client logic is the same and can eliminate duplicate events. Then you can run a dedicated server simply by running a browser tab on a server.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Mon Jul 07, 2014 1:50 am

Okay that makes sense. I guess my thinking was it would be better to have a nearly blank project running the server code without having to load in any assets or things like that. I suppose it doesn't really matter, it was just that my server is designed to be the only host that can exist for Xbridge, since it's only being used to share people's custom level creations and also function as a social network.

My current solution for this is for my "server" to look up a specific file on clay.io that only my account has access to, and if it returns the right data, then it proceeds as the host. otherwise anyone else would just get disconnected immediately with a message stating "the server is currently down for maintenance" although in reality, it just won't let any other computer but mine Host.

My account management works in a similar way in that it checks the server to see if the user name exists in the dictionary object, and if not, adds it and tells the client's computer to upload that name to clay.io as their login. so technically, its not really possible for 2 people to have the same name, and this kinda gets around the whole duplicates thing where it adds a 2 or 3 etc to the player alias. it never allows two people with the same name to connect, and since their names are linked to their clay.io account, I don't believe it would be very easy to hack someone's Xbridge account without having to hack their clay.io account first.

I imagine there are far better ways to do this. I just don't really know any coding outside of C2 or python. I read something about mysql being an excellent way to store player accounts with encryption. I just haven't spent any time looking into that just yet.

A small group of us will be doing some more tests next weekend if you want to jump in and try it out. I'm sure you are a busy man, but if you're interested, feel free to PM me, and I'll send you a link.

Austin Morgan
Varia Games
B
20
S
2
Posts: 70
Reputation: 1,466

Post » Fri Jul 18, 2014 7:18 pm

my script to run chrome in debian
Code: Select all
#!/bin/bash
# start_xvfb.sh

user="chrome"
resolution="800x600x16"
command="google-chrome --disable-background-networking  --user-data-dir -homepage http://site.com/app/index.html  --disable-application-cache" 
start_command="/usr/bin/xvfb-run -f /tmp/${user}.xvfb.auth -s '-screen 0 ${resolution} -auth /tmp/${user}.xvfb.auth' $command"

killall -u chrome

if ( [ "$(whoami)" = "$user" ] ) then
        bash -c "$start_command"
else
        su -c "$start_command" -l $user
fi
B
13
S
2
Posts: 16
Reputation: 1,622

Post » Sat Aug 02, 2014 4:46 pm

suntank wrote:However, the client and server could only ever stay connected for a short amount of time and couldnt send or receive signals to each other, all they could do was see other player alias' in the player list. So my question is, is it possible to have 2 different projects interacting with one another for the sake of creating a dedicated server?

Hi @suntank, any updates on the test? I'm about to jump into multiplayer development, so after a lot of brainstorming on my game mechanic for multiplayer, I'm more or less jump into conclusion that I need 2 separate project,just like you, for the sake of getting my game win condition to be right.

I need the dedicated server to evaluate the game situation which upon forced disconnection of one peer, the winning prize will be given to the one who stay.

Because of this, I rather keep the project for the host in the most simplest form, to save processing power/ram whatnot and easier to debug/maintain, which I think we're having the same mindset about this. I was thinking of having the ability to hold a community event just by modifying the host (set up rule etc), well its going to be difficult to implement but its in my future plan. :D

I hope the test went well and I hope you can put up a tutorial if you ever get it to work.

Mind if I ask what type of game are you working on? Synchronous or Turn-Based or anything?
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Mon Aug 04, 2014 3:18 pm

I decided to hold off the multiplayer features until the game was more "complete" since it is'nt a realtime multiplayer game. I'm simply using multiplayer to send and receive player creations to the server and back to the players. So people can challenge each other to play the game against their "Armadas" which they create using the same tools we used to make the "Quick Play" levels. you can actually check the game out now if you wish at http://xbridge.clay.io

It's still in Beta and there are a few broken waves after level 30. The game randomly chooses levels from a list of 200 waves (currently) so it feels fresh every time you play it! You will need to login to clay.io to play. Be sure to click the how to play button.

Edit: I will be working on ReVeN's Multiplayer Beta after we finish up xbridge's conquest (Online creation mode). ReVeN has realtime multiplayer sidescroller shooter action and will be a more intense project to tackle. I'll let you know how it goes!
B
20
S
2
Posts: 70
Reputation: 1,466


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests