• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Philip Borgstr

Matchmaking using Apache Webserver

11 posts in this topic

Is it possible with an unmodified version of Apache HTTP web server to make an complete matchmaking system or do I have to have an actual root access server which I can install my custom software onto? The matchmaker I want to make bases itself that a client connects and signs up to the matchmaker and then the server loops through the list checking for matches and updating information. Once the a match is made the server tells the clients to connect to each other. I am rather new to network programming so my bad if this is an obvious question.
0

Share this post


Link to post
Share on other sites
AFAIK, a 'naked' apache installation is basically just a file server. Usually you'll install some server-side modules that allow you to dynamically generate responses ([i]instead of only responding with static files[/i]), such as mod_php ([i]which lets you run PHP code[/i]) or mod_cgi ([i]which lets you run [url="http://en.wikipedia.org/wiki/Common_Gateway_Interface"]CGI scripts[/url][/i]).

Assuming your apache installation has some kind of server-side language installed ([i]which should be a standard feature with any web-hosting company[/i]), then yes you can implement loops/searches/matching/etc... Edited by Hodgman
2

Share this post


Link to post
Share on other sites
No, you need some plugin for serverside scripts. (I don't know of any webhost that doesn't provide atleast php support though)

Edit: Beaten :( Edited by SimonForsman
2

Share this post


Link to post
Share on other sites
Okey, miss information by me, it is not an raw installation of the apache server, it has CGI scripts and php support. Thanks for the information! Edited by philipborg
0

Share this post


Link to post
Share on other sites
[quote name='philipborg' timestamp='1343897154' post='4965447']
Okey, miss information by me, it is not an raw installation of the apache server, it has CGI scripts and php support. Thanks for the information!
[/quote]

the server can't initiate script execution on its own unless you can run a standalone application.

a fairly simple workaround is to have the users query the server at a fixed interval instead. , you could also let the scripts run for a few seconds before returning a wait message to the client (that way clients don't have to make as many queries), cheap webhosts most likely won't allow your scripts to run for very long before terminating though. (max runtime is a php.ini setting, default is 30 seconds but cheap hosts might reduce it to prevent customers from hogging too much server resources) Edited by SimonForsman
0

Share this post


Link to post
Share on other sites
[quote name='SimonForsman' timestamp='1343897415' post='4965450']
[quote name='philipborg' timestamp='1343897154' post='4965447']
Okey, miss information by me, it is not an raw installation of the apache server, it has CGI scripts and php support. Thanks for the information!
[/quote]

the server can't initiate script execution on its own unless you can run a standalone application.

a fairly simple workaround is to have the users query the server at a fixed interval instead. , you could also let the scripts run for a few seconds before returning a wait message to the client (that way clients don't have to make as many queries), cheap webhosts most likely won't allow your scripts to run for very long before terminating though. (max runtime is a php.ini setting, default is 30 seconds but cheap hosts might reduce it to prevent customers from hogging too much server resources)
[/quote]

This was one of my thought on how to do this... My webhost is pretty expensive so I think they have 30 seconds. Can't I make so that the clients sends an message to an php script which checks if it has gone more then 10 seconds since the last update. If it has gone more then 10 seconds it runs the script again. The script is then executed directly and maybe is executed in 2 seconds. Is this a good method or is it better to let the clients wait before they will restart the script? With my method overloading the server will be hard and it will always run as often as I like. Maybe the best method is a combined method, 2 parts of server and a wait system?
0

Share this post


Link to post
Share on other sites
[quote name='philipborg' timestamp='1343901058' post='4965464']
[quote name='SimonForsman' timestamp='1343897415' post='4965450']
[quote name='philipborg' timestamp='1343897154' post='4965447']
Okey, miss information by me, it is not an raw installation of the apache server, it has CGI scripts and php support. Thanks for the information!
[/quote]

the server can't initiate script execution on its own unless you can run a standalone application.

a fairly simple workaround is to have the users query the server at a fixed interval instead. , you could also let the scripts run for a few seconds before returning a wait message to the client (that way clients don't have to make as many queries), cheap webhosts most likely won't allow your scripts to run for very long before terminating though. (max runtime is a php.ini setting, default is 30 seconds but cheap hosts might reduce it to prevent customers from hogging too much server resources)
[/quote]

This was one of my thought on how to do this... My webhost is pretty expensive so I think they have 30 seconds. Can't I make so that the clients sends an message to an php script which checks if it has gone more then 10 seconds since the last update. If it has gone more then 10 seconds it runs the script again. The script is then executed directly and maybe is executed in 2 seconds. Is this a good method or is it better to let the clients wait before they will restart the script? With my method overloading the server will be hard and it will always run as often as I like. Maybe the best method is a combined method, 2 parts of server and a wait system?
[/quote]

You could do that, if the host allows scripts to run for a few second each script request could do a simple:
$matchResponse = false;
$startTime = $currentTime = getcurrenttimeinseconds();
$maxExecutionTime = max(ini_get("max_execution_time")/2,5); //set the scripts max runtime to whichever is highest of half the servers max time or 10
while ($currentTime-$startTime < $maxExecutionTime && !$matchResponse) {
$matchResponse = checkForMatch();
if ($matchResponse) {
echo $matchResponse;
}
usleep(100000); //sleep for atleast 100 ms
$currentTime = getcurrenttimeinseconds();
}

This would allow the script to constantly check for up to 10 seconds on a single request without using much CPU resources (fewer requests = less bandwidth used)
0

Share this post


Link to post
Share on other sites
Thanks for the response! I believe that is a solid way to handle it. Thanks to all of you for great ideas and tips [img]http://public.gamedev.net//public/style_emoticons/default/happy.png[/img]
0

Share this post


Link to post
Share on other sites
My question is, why do you need an HTTP server for you to do your matchmaking? Is your client a standard web browser?
0

Share this post


Link to post
Share on other sites
[quote name='Firestryke31' timestamp='1343958544' post='4965711']
My question is, why do you need an HTTP server for you to do your matchmaking? Is your client a standard web browser?
[/quote]

I'd guess its because it removes the need to pay for and run a proper server yourself. You can get a webhost with php support for pretty much nothing while a dedicated server that lets you run your own software cost alot more.
0

Share this post


Link to post
Share on other sites
The problem with that is that most of those hosts also have some odd, not always up front limits and worst case completely shut down the site with a "Bandwidth Exceeded" message until next month. You don't need dedicated hardware for a start up game, a VPS is a good mid way point with more control than a shared AMP server but less cost than a dedicated. In the other thread about shoehorning HTTP into a role it wasn't designed for I posted a link to a VPS company who's minimum plan was $4USD a month (albeit the stats are kind of piddly for a medium traffic server like matchmaking, the next one up's only $7). Usually by the time you've outgrown the stats for it you're making enough to upgrade to a more permanent solution, if not at very least the next tier plan.
0

Share this post


Link to post
Share on other sites
I do not have any bandwidth limits or memory limits so for me it is a easy choice even though I admit an VPS or dedicated server would be nice.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0