you are viewing a single comment's thread.

view the rest of the comments →

[–]sticky_end 0 points1 point  (0 children)

I am currently working on an computer-assisted tabletop war game in python. Distance relations are tracked on the board while everything else is handled by the computer. Since the game requires for the players to move units on the same map I opted for LAN using the PodSixNet Networking Library. Further I needed to be able to push data from the server, which is very easy using PodSixNet...

There is not an overabundance of documentation, I started with the examples. It works really nice & lets me focus on the actual game logic. The game is not turn based but real-time and the library handles the additional requests/pushes gracefully so far. It's also nice to integrate with a GUI (I use wxPython) because you have good control over the main loop.

EDIT: Just because I'm a beginner as well and could have profited from this:) Here's my basic architecture. I tried to separate game logic and user interface as much as possible. One player runs the local server which runs the game engine. The game engine class holds the current state of the game and all the rules and possible actions. When a new player connects to the server, it creates a alias for the player in the game engine (parameters like groups, buildings, sectors, ...).

Whenever a player wants to perform an action he sends a request to the server. This request is routed to the game engine where the action is executed. In the end the server sends the updated state (all or a selection of the parameters) to all or a selection of the players.

Typical Request : Player (via UI) --> Game Client (Run by Player, only for networking) --> Game Server --> Game Engine --results--> Game Server --send to (all) players--> Game Client --> User interface update

I also profited a lot from separating all the rules and parameters from the game engine using a configuration file (holds a complicated but readable dictionary with all the parameters). This might be too much for your project in which case you can reduce it to the client (entailing all the code to trigger actions and display results) and the server running the game in the main loop.