Python network library for a simple card game

I am trying to implement a fairly simple card game in Python so that two players can play together on another Internet. I have no problems with the GUI, but I don’t know how to make the network part. A few libraries that I have found so far:

  • PyRO : seems nice and seems to be well suited for this task, as it has common Map objects in different states.

  • Twisted with pyglet-twisted : it looks powerful but complex; I used to use Pyglet, although perhaps that would not be so bad.

Can someone recommend the most suitable for my game (not necessarily on this list, I probably missed a lot of good ones)?

+3
source share
3 answers

Both of these libraries are very good and great for your card game.

Pyro may be easier to learn and use, but Twisted will scale better if you ever want to move to a very large number of players.

Twisted can be difficult at first, but there are some books that will help you overcome the hump.

Some of the other libraries are selected, but you find that they are mature and widely used in the Python community, so you will have a better chance of finding answers to any questions.

My personal recommendation would be to use Pyro if you just want to play online, but go with Twisted if you have grandiose plans for a large number of players on the Internet.

+8

, , asynchat module . / .

+5

Twisted is better than two libraries, but the time spent on learning, but studying network connectivity will take you so much time (at least for me).

If I were you, I would rather learn to create networks, it will be much more useful for you in the future. The concepts are the same for most languages, so they are more portable. If you are going to use this approach, look at http://www.amk.ca/python/howto/sockets/ , it will guide you through everything.

+3
source

Source: https://habr.com/ru/post/1712826/


All Articles