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

Can I use HTTP for a realtime multi-player server?

14 posts in this topic

I am building a multi-player server for a real-time strategy game.

The entire game-state is managed on a single machine ( No state negotiation ).
As such, a small lag is not a big problem. Where small ~= 1 sec .

Even though, the state is hefty, and ever-changing.

Would it be wise to build my multi-player server over HTTP?

For HTTP:
* Game runs on cell phones & HTTP is firewall friendly
* Easier to find hosting for HTTP ( PHP/Google )
* Game runs on cell phones no need to worry about connections being dropped
* Can consolidate several game packets into a single HTTP call

For TCP/IP:
* I am pretty proficient with TCP/IP (done many low-level communications).
* Making new connections over and over is really expensive on performance.
* Need to worry about reconnections after connection drops (cell-phone game)
* Cheap HTTP hosting might not be performant enough for my needs.
* If I ever want to make a peer 2 peer connection, I would need an HTTP server on one of the devices.

So what do you think is HTTP an option for a [u][b]real time[/b][/u] game?
Has any of you ever tried?
0

Share this post


Link to post
Share on other sites
I think u can use something like websockets using javascript through a webpage does that quality as using HTTP? See the most famous example of

http://browserquest.mozilla.org/
http://nodegames.blogspot.com/

The server is running node.js from what i understand.

-ddn
0

Share this post


Link to post
Share on other sites
[quote name='ddn3' timestamp='1343843814' post='4965262']
I think u can use something like websockets using javascript through a webpage does that quality as using HTTP? See the most famous example of

[url="http://browserquest.mozilla.org/"]http://browserquest.mozilla.org/[/url]
[url="http://nodegames.blogspot.com/"]http://nodegames.blogspot.com/[/url]

The server is running node.js from what i understand.

-ddn
[/quote]

Thanks, I am not writing a web-app. I am writing a java app. That app can either open a TCP socket and communicate over that, or make HTTP requests. I am wondering if HTTP requests are any good for my needs.

Regardless of this, I have used web-sockets on another project of mine, and they are quite neat and straight forward. They are not HTTP though.
0

Share this post


Link to post
Share on other sites
Why do you think that HTTP won't have dropped connection issues? You either use persistent connections (which might drop anyways) or you open a new connection per HTTP request.
0

Share this post


Link to post
Share on other sites
With I allways reconnect between messages. It is not a special case. So if a user switched between 3g and wifi I wouldn't even care. I wouldn't have to keep alive on open sockets... etc'.

But the question is a More general one. Is http even feesable or would a overhead kill me?
0

Share this post


Link to post
Share on other sites
HTTP is a protocol on top of TCP/IP that is able to transport different content types as found while constructing a web-page content in HTML.
The server is able to use several optimizations and to take care on the capabilities of the client to send content in a way that leads to an always right presentation of the content.
So. If you use a kind of web-browser as the front-end it is OK to use HTTP.
If you use a special client as front-end any other protocol on top of TCP/IP will be a good choice.

HTTP and TCP/IP are different layers and so they are hardly comparable.
0

Share this post


Link to post
Share on other sites
Data transport doesn't have to be a single thing. You could build a system that provides the same data using TCP/IP, web sockets, and HTTP long-poll, depending on the capabilities of the client.

HTTP is very inefficient, as it has the sender send lots of header data for each request, and has the server respond with lots of header data in each response, too. Additionally, it forces you to re-establish credentials in each request, re-establish the underlying HTTP connection occasionally, etc.
0

Share this post


Link to post
Share on other sites
Thanks, I know about the difference between Http and tcp/ip. The main reason I am asking is because I hypothesize that:
Http hosting (port 80 tcp/ip with headers) is more common and cheaper. I can use some cheap php/java servelet host. Maybe try out google app engine.For tcp/ip i need a full virtual machine, which seems much more expensive.


I wanted to know if my assumptions have any hold in reality. I am trying to aproach this on a cost for value approach.
0

Share this post


Link to post
Share on other sites
There are relatively cheap virtual hosts available that allow you to run various software, especially if you choose unmanaged since you're not paying for supporting staff (though typically they charge extra for support calls, at least it's a 'pay for it only if you need it' kind of thing). [url="http://www.urpad.net/linux-vps.shtml"]Here's[/url] the one I've been looking at for my game (it's cheaper than my current host, and gives me more control), though I've only had a quick look through on reviews for them. The key things to keep an eye on are RAM and bandwidth usage, you want to try and stay below the dedicated RAM for the entire system or the VPS monitor will start killing processes and most hosts charge extra for going over bandwidth usage.

9 times out of 10, if you're considering HTTP for a non browser game, you need to look in to other options.
0

Share this post


Link to post
Share on other sites
HTTP is fine for batch operations and turn based games. HTTP *can work* for platforms that have no other option.
However, planning the networking for a game around cheap HTTP-based hosting is not how to go about a successful project.
If you have any kind of success with your game, you will presumably be able to make enough money to pay for real dedicated hosting as needed.
0

Share this post


Link to post
Share on other sites
HTTP protocol can work for not often updated system. Simply in http, you find out distant data only by making request and getting answer. Http request and http answer are rather many bytes (file, text), and after request is made, it recieves the answer , and connection is close . unless you specify "Connection:Keep-Alive" header, so that client may use the connection for other requests it fires (src's of img , css. js. in link tag and all data it knows url for), nearly no server supports it and your browser allways recieve "Connection:Close" header in answer, so these are allways separate reqests. Do not even think of sending data to clients of the server. In http, client gets/asks data and server is suposed to respond only and do not invoke.Simply put, you can update clients only if they (the aplication) make request. If your aplication might find use of http ptrotocol, it might be very good, but http protocol is not designed for permanent frame data exchenge. But then,
what if your game, before it strats, makes a reqest for xml scene and elements data,so that it can bring player to game? Nice idea. Imagine you could wake up one morning, and to all the players bring new stuff, scene,. just by updating document and files in text of the document.
0

Share this post


Link to post
Share on other sites
[quote name='hplus0603' timestamp='1344106078' post='4966158']
planning the networking for a game around cheap HTTP-based hosting is not how to go about[/quote]
And I would stress that, you should provide your own aplication that serves your clients, but for that you will need a box, and that is not 2GB dedicated on a host machine, housing a box on a up link costs 80 euro. But if your aplication visits some http domains, it might be very benefitial for your aplication, though volatile data will have to be exchanged defintily not by http protocol, but by raw abstraction between udp link you established between your aplications and server. But games might find big use of http, but in other manners than constant interaction between players.
0

Share this post


Link to post
Share on other sites
[quote name='JohnnyCode' timestamp='1344132716' post='4966233']
HTTP protocol can work for not often updated system. Simply in http, you find out distant data only by making request and getting answer. Http request and http answer are rather many bytes (file, text), and after request is made, it recieves the answer , and connection is close . unless you specify "Connection:Keep-Alive" header, so that client may use the connection for other requests it fires (src's of img , css. js. in link tag and all data it knows url for), nearly no server supports it and your browser allways recieve "Connection:Close" header in answer, so these are allways separate reqests.
[/quote]
I wrote a web-server of my own and it always let the connections stay open for some time (normaly 60 seconds). A web-browser creates numerous connection in parallel if there are references to content is on the page. The number of connections vary. Some use google as a proxy service where you can get a dozen connections in parallel for the requested page content but every request comes from another IP. The only way to "see" that all requests are from the same client would be cookie with some session id.

It would be possible to create a stream connection to a browser. You can send a reply without giving a size information and afterwards send chunks of data on this stream.
This way you can stream a video to a client.
0

Share this post


Link to post
Share on other sites
[quote name='Tribad' timestamp='1344157479' post='4966307']
You can send a reply without giving a size information and afterwards send chunks of data on this stream.
This way you can stream a video to a client.
[/quote]
Yes, you could fake constant data update by streaming a dynamic file, but only in server-to-client direction, as it would be very monstrous to collect data from clients that server needs through http hammering requests .
0

Share this post


Link to post
Share on other sites
[quote name='JohnnyCode' timestamp='1344182485' post='4966385']
[quote name='Tribad' timestamp='1344157479' post='4966307']
You can send a reply without giving a size information and afterwards send chunks of data on this stream.
This way you can stream a video to a client.
[/quote]
Yes, you could fake constant data update by streaming a dynamic file, but only in server-to-client direction, as it would be very monstrous to collect data from clients that server needs through http hammering requests .
[/quote]

Not a problem for me, as I am buffering input. Whenever a client lags, it buffers pending requests. Then an http request with many messages is sent. I can also dynamically control the rate of requests, thereby forcing a buffer to minimize requests even if the client does not lag.
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