Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44292 > unrolled thread

how to: multiplayer game connecting to central server effectively?

Started bywebmaster@terradon.nl
First post2013-04-24 13:59 -0700
Last post2013-04-24 23:02 -0700
Articles 5 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  how to: multiplayer game connecting to central server effectively? webmaster@terradon.nl - 2013-04-24 13:59 -0700
    Re: how to: multiplayer game connecting to central server effectively? John Gordon <gordon@panix.com> - 2013-04-24 21:48 +0000
      Re: how to: multiplayer game connecting to central server effectively? Fábio Santos <fabiosantosart@gmail.com> - 2013-04-24 23:06 +0100
    Re: how to: multiplayer game connecting to central server effectively? Chris Angelico <rosuav@gmail.com> - 2013-04-25 12:55 +1000
      Re: how to: multiplayer game connecting to central server effectively? webmaster@terradon.nl - 2013-04-24 23:02 -0700

#44292 — how to: multiplayer game connecting to central server effectively?

Fromwebmaster@terradon.nl
Date2013-04-24 13:59 -0700
Subjecthow to: multiplayer game connecting to central server effectively?
Message-ID<c6c26882-ec2e-41f9-a4c3-d403976c7729@googlegroups.com>
hi,
I struggle for some days about a "model" for a multiplayer game application.
I read so much from my enemy Google, i got lost by all that info and dont know which path i should chose.

a multiplayer game application, sending/receiving  instantly every change in the game to a central webserver, http://www.xxxxx.com, probably via socket connection?

which system/module should i use for this contineous connection and where can i find a good tutorial, which a beginner like me can understand a bit? (i have read too many too complicated/technical artickles, but no nice tutorials).

i have tried and accompished an urllib connection, with get and post variabels, but that will be polling, with all the http-overhead for every poll. I think this is also to slow and no "real" updating of the game status.

Thanks in advance for any hint/tutorial i get:)

[toc] | [next] | [standalone]


#44293

FromJohn Gordon <gordon@panix.com>
Date2013-04-24 21:48 +0000
Message-ID<kl9jvn$mfb$1@reader1.panix.com>
In reply to#44292
In <c6c26882-ec2e-41f9-a4c3-d403976c7729@googlegroups.com> webmaster@terradon.nl writes:

> i have tried and accompished an urllib connection, with get and post
> variabels, but that will be polling, with all the http-overhead for every
> poll. I think this is also to slow and no "real" updating of the game status.

Http can still work, depending on what kind of game it is.  For example
a game where only the current player can make decisions and the other
players just sit and watch (like Risk), or a game where each player submits
a move and the server applies the game rules to resolve the outcome (like
Rock-Scissors-Paper).

But a truly interactive game would probably require something more, like
an active socket connection.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

[toc] | [prev] | [next] | [standalone]


#44294

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-04-24 23:06 +0100
Message-ID<mailman.1033.1366841219.3114.python-list@python.org>
In reply to#44293
This series of articles is flash-based, and the examples apparently
don't run, but it is a great read on all the problems you face when
coding several kinds of multiplayer games, and the variety of things
you can do to fix it:

http://playerio.com/documentation/tutorials/building-flash-multiplayer-games-tutorial/

Did you know that Age of Empires was actually internally turn-based,
in order to avoid syncing problems?


On Wed, Apr 24, 2013 at 10:48 PM, John Gordon <gordon@panix.com> wrote:
> In <c6c26882-ec2e-41f9-a4c3-d403976c7729@googlegroups.com> webmaster@terradon.nl writes:
>
>> i have tried and accompished an urllib connection, with get and post
>> variabels, but that will be polling, with all the http-overhead for every
>> poll. I think this is also to slow and no "real" updating of the game status.
>
> Http can still work, depending on what kind of game it is.  For example
> a game where only the current player can make decisions and the other
> players just sit and watch (like Risk), or a game where each player submits
> a move and the server applies the game rules to resolve the outcome (like
> Rock-Scissors-Paper).
>
> But a truly interactive game would probably require something more, like
> an active socket connection.
>
> --
> John Gordon                   A is for Amy, who fell down the stairs
> gordon@panix.com              B is for Basil, assaulted by bears
>                                 -- Edward Gorey, "The Gashlycrumb Tinies"
>
> --
> http://mail.python.org/mailman/listinfo/python-list



-- 
Fábio Santos

[toc] | [prev] | [next] | [standalone]


#44315

FromChris Angelico <rosuav@gmail.com>
Date2013-04-25 12:55 +1000
Message-ID<mailman.1048.1366858555.3114.python-list@python.org>
In reply to#44292
On Thu, Apr 25, 2013 at 6:59 AM,  <webmaster@terradon.nl> wrote:
> hi,
> I struggle for some days about a "model" for a multiplayer game application.
> I read so much from my enemy Google, i got lost by all that info and dont know which path i should chose.
>
> a multiplayer game application, sending/receiving  instantly every change in the game to a central webserver, http://www.xxxxx.com, probably via socket connection?
>
> which system/module should i use for this contineous connection and where can i find a good tutorial, which a beginner like me can understand a bit? (i have read too many too complicated/technical artickles, but no nice tutorials).
>
> i have tried and accompished an urllib connection, with get and post variabels, but that will be polling, with all the http-overhead for every poll. I think this is also to slow and no "real" updating of the game status.
>
> Thanks in advance for any hint/tutorial i get:)

The easiest way to start would be a MUD or chat server. Establish a
TCP socket, then whenever anything happens, report the change to all
connected sockets. In its simplest form:

* Accept connection
* Wait for login (or, for a simple test, just "Enter your name: " would do)
* Add connection to pool
* Whenever a line of text is received, prepend the name and send it to
every connection in the pool.

That's a basic chat server. A MUD adds only a small bit of
complication: you need some form of command parser, and not everything
will announce to all connected clients. I can walk you through a lot
of this, but I haven't done most of it in Python; there's another
language, very similar in semantics, which is better suited to MUD
building: Pike. But it's all similar enough that you'll be able to do
it in either.

The project you're looking at sounds to me like it'd be well
implemented as a MUD-style connection with a fancy client in front of
it. Debug your system using the MUD connection, and make sure you
don't have any security holes that can be exploited by someone
switching out your client for a custom one; because, believe you me,
someone will figure out how to do it. (If you're concerned about
privacy, you can easily switch in SSL/TLS, while not fundamentally
changing any of your code.) Start with something as simple as you
possibly can, and then add complication only as you find you need it.

Here's the module you'll be wanting:
http://docs.python.org/3.3/library/socket.html

(By the way, you won't be connecting to a *web* server. Your central
server will be quite separate from that system. It might happen to be
the same computer, but there's no real connection.)

ChrisA

[toc] | [prev] | [next] | [standalone]


#44324

Fromwebmaster@terradon.nl
Date2013-04-24 23:02 -0700
Message-ID<180e5688-33ba-4a27-b86d-e3f273f793cc@googlegroups.com>
In reply to#44315
The idea is a risk game application and data collected and controlled by a gameserver, which happens to be a webserver too.
But for learning the principles, i want to start with tic-tac-toe multiplayer.


Thanks for your answers, I will read all your advices first now. 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web