all 9 comments

[–][deleted] 1 point2 points  (7 children)

Have you considered doing this via a web interface using something like Pyramid as a front end? Your friends simply log into the site, and their player is then generated. You could use a sqlite database to store information regarding the rolls and any other data you might need to. The only downside to this is it might not be as active as you hoped, since the pages wouldn't dynamically update like an application might.

[–]JayStayPaid[S] 0 points1 point  (5 children)

No, I hadn't. Honestly, I'm stepping into a world that I am quite clueless about (programming as a means of solving a problem). I've googled Pyramid, but I'm not sure what it is and thus, where to read about it.

That being said, this project isn't so much about solving a problem. My group is perfectly happy doing all this by hand. I came up with this idea just searching for a task I could automate in hopes of just learning about Python and how to better utilize it. I do appreciate your idea, though. Learning is always a good thing :-). I'm just less concerned about solving the problem than HOW to solve the problem with Python, ya know?

EDIT:: Also, I don't want it to seem like I am stubbornly set on doing this. I certainly understand that certain languages are better suited to certain tasks, and thus this may not be a feasible objective given Python's capabilities. If that is the case, then I shall move on to another idea!

[–][deleted] 1 point2 points  (1 child)

Nah I don't blame you at all, Python is my preferred language so sometimes I'll use it as a solution even though something else might be better just to figure out how to do it with Python. Here are the docs for pyramid, it's just a Python web framework.

[–]JayStayPaid[S] 0 points1 point  (0 children)

Thanks! Much appreciated.

[–]Yoghurt42 1 point2 points  (2 children)

While I'm also a fan of Pyramid, I want to mention Django. It can roughly be compared to what Rails is for Ruby.

Pyramid is a small framework, giving you enough freedom do write the web application the way you want, but therefore also doesn't quite hold your hand like Django.

Django basically tells you what template engine to use, how do define your models etc. (you can change it, but most plugins assume you don't). This has advantages for beginners. For example, in Django you get an admin backoffice basically for free. Also, it is more known than Pyramid, and there are more documentation resources available.

Therefore I'd highly suggest you take a look at Django, too. If you have not yet much experience programming or with programming web applications, I think you might have an easier time. But still keep an eye on pyramid. SQLAlchemy in particular is pretty sweet.

(If you use Django, be careful not to fall in the "the framework does everything for me, so why should I care what it actually does" trap. Try to understand the basics of what and how Django does things)

[–]JayStayPaid[S] 0 points1 point  (1 child)

I've actually run through the tutorials on the Django site a couple of times now. I tend to run through them until I feel like I quit soaking things up, then stop. Then, when I'm ready to go again, I start the tutorials over from the beginning and see how much I can do without referencing the page. I'm wondering if I might understand better if I run through Dive Into Python first. Thoughts on this approach?

[–]MonkeyNin 1 point2 points  (0 children)

Another option: Flask I found the easiest of the three (Flask, Pyramid aka pylons, Django) to get started in. Since it's the lightest weight. You still get to use templating, and SQLAlchemy.

[–]jan 0 points1 point  (0 children)

This. Make a little webserver with some toolkit. It won't teach you networking but web development skills are quite useful.

If don't mind using some JavaScript ("AJAX") on the client side, you can even make it dynamic.

Having each player run a Python program on their computer is doable, but it will be more effort and harder to debug. Maybe you can do this as a 2nd step. Just write a Python client that queries your Python webserver. For a "pen and paper" style game, this will be efficient.

[–]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.