How do I create a dedicated server?

0 favourites
  • 6 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • 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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • my script to run chrome in debian

    #!/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
    [/code:2easupit]
  • 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.

    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?

  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)