.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Scenarios, Maps and Mods (http://forum.shrapnelgames.com/forumdisplay.php?f=146)
-   -   Dom-III PBEM manager (http://forum.shrapnelgames.com/showthread.php?t=31098)

WraithLord October 18th, 2006 06:43 AM

Dom-III PBEM manager
 
1 Attachment(s)
Its written in Python, its cross platform (though I've only tested it for cygwin and win-2k/XP).

It can perform various mundane tasks related to PBEM hosting.

Please note that it works only if the host has a gmail account!

It can do the following:
1. Retrieve game turn files from gmail (so long as the game's name is in the subject field)
2. Verify that the turns are valid and report invalid ones.
3. Backup (on request and automatically prior to hosting)
4. Restore (reload specific turn from backup)
5. Broadcast messages to players.
6. Send status notifications that include automatically generated report of invalid/missing turns reports to players.
7. Host
8. Distribute turn files to players.

The interface is CLI.

Usage:
1. Install python. whatever platform you're using doesn't matter, the utility doesn't contain platform specific code.

2. Extract the zip file attached, it contains a configuration file and the utility.

3. Dl and install Libgmail.
Install is usually as simple as extracting the lib then running: python setup.py install.

4. Edit the file .domIII_PBEM_conf for the configuration values. It's a text file that contains explanations.

5. Run domIII_PBEM_utils.py.

6. Follow the CLI instructions.

I already use this utility for hosting, and it saves me plenty of "dirty" work.

PDF October 18th, 2006 06:53 AM

Re: Dom-III PBEM manager
 
Looks nice, thanks !
But I don't use gmail, and neither do my friends ...Any possibility to have standard (pop/smtp) mails retrieved/sent ?

WraithLord October 18th, 2006 07:54 AM

Re: Dom-III PBEM manager
 
Quote:

PDF said:
Looks nice, thanks !
But I don't use gmail, and neither do my friends ...Any possibility to have standard (pop/smtp) mails retrieved/sent ?

It was a "design" decision not to go for pop/smtp, mainly because I don't have access to a POP server and as for smtp, I was to lazy to setup a server. I wanted to take advantage of free web mail services such as yahoo and gmail. The thing is that those services have an additional layer wrapping the pop/smtp layer so I had to decide specifically which one I wanted to support. Having found a python lib that wrapps gmail my decision was clear http://forum.shrapnelgames.com/images/smilies/happy.gif

I can add pop/smtp support but it will take some time before I can really put my mind to it.

Its actually quite convenient to have a gmail account. If you don't have one and would like to try it I can send you an invitation (PM me with your email).

WraithLord October 18th, 2006 07:55 AM

Re: Dom-III PBEM manager
 
Oh and please bear in mind that *only* the host needs to have a gmail account!

PDF October 18th, 2006 08:47 AM

Re: Dom-III PBEM manager
 
Wraithlord,
There are some simple free tools allowing to send/retrieve pop/smtp mail via command line , no need to setup a server.
I can't really recommend one but it's easy to find.

As for gmail indeed it's not a problem usually, but I don't have access to webmail at work so prefers to use my own address ... http://forum.shrapnelgames.com/images/smilies/wink.gif

Agrajag October 18th, 2006 09:34 AM

Re: Dom-III PBEM manager
 
I have Gmail http://forum.shrapnelgames.com/images/smilies/happy.gif
Maybe I'll give your program a try if I get a chance to, but I don't think I'm about to host any PBEM games soon.
Good work either way http://forum.shrapnelgames.com/images/smilies/cool.gif

WraithLord October 18th, 2006 11:58 AM

Re: Dom-III PBEM manager
 
Thanks for the encouragement guys http://forum.shrapnelgames.com/images/smilies/happy.gif

@PDF, if you know a good, free, cross-platform, CLI enabled mail tool please tell me, I will test it and add it to the utility.

I am aware of similar tools but they are solaris/unix/linux tools and I want this utility to be cross platform (Also, if you are working on a linux server a couple of bash scripts will also do the trick -> my tool is not aimed for sys admins/devs).

Gandalf Parker October 18th, 2006 12:51 PM

Re: Dom-III PBEM manager
 
Its too involved for me but it looks like some people will find it very useful.

I was going to try and work something out on my linux server (which of course makes everything simpler). Such as, I can create an email address just for the game, and directly process the email directory as the emails come in. And I can send turn files wiothut having to access another server to send them.

Nerfix October 19th, 2006 02:15 PM

Re: Dom-III PBEM manager
 
Mmmm, interesting, very interesting. Is Python hard to learn?

Endoperez October 19th, 2006 03:22 PM

Re: Dom-III PBEM manager
 
Quote:

Nerfix said:
Mmmm, interesting, very interesting. Is Python hard to learn?

You should be asking whether or not it would be worth it to learn Python. To answer that, the ones in the know would need to know what you'd use it for.

Gandalf Parker October 19th, 2006 03:24 PM

Re: Dom-III PBEM manager
 
Python is one of the more "english" of programming languages. So I would rank it as one of the easiest to learn. But its also very full featured.

Of couse just about any language could have done this. If you want to compare programming languages here is a really fun site to look at. I love looking at this site. http://forum.shrapnelgames.com/images/smilies/happy.gif
http://www.99-bottles-of-beer.net/
It has 1019 different programming versions of simple programs to work thru the 99 bottles song. http://forum.shrapnelgames.com/images/smilies/happy.gif

Gandalf Parker

Nerfix October 19th, 2006 03:49 PM

Re: Dom-III PBEM manager
 
Quote:

Endoperez said:You should be asking whether or not it would be worth it to learn Python. To answer that, the ones in the know would need to know what you'd use it for.

But Python leads to Ruby and Ruby and Java (Java I can handle somewhat) lead to Groovy and Groovy...Groovy is the future! And will lead to something else in future. http://forum.shrapnelgames.com/images/smilies/happy.gif

Endoperez October 19th, 2006 04:12 PM

Re: Dom-III PBEM manager
 
Quote:

Nerfix said:
But Python leads to Ruby and Ruby and Java (Java I can handle somewhat) lead to Groovy and Groovy...Groovy is the future! And will lead to something else in future. http://forum.shrapnelgames.com/images/smilies/happy.gif

Java is in the past. http://forum.shrapnelgames.com/images/smilies/frown.gif My personal work with Java, that is.

I haven't touched my map randomizer for a year or so. It was supposed to randomize poptypes/defenders/sites etc in totally new ways. A random .map generator instead of a random map graphics generator. It's written in Java, but probably only works in Windows.

WraithLord October 19th, 2006 07:09 PM

Re: Dom-III PBEM manager
 
Quote:

Gandalf Parker said:
Python is one of the more "english" of programming languages. So I would rank it as one of the easiest to learn. But its also very full featured.

Of couse just about any language could have done this. If you want to compare programming languages here is a really fun site to look at. I love looking at this site. http://forum.shrapnelgames.com/images/smilies/happy.gif
http://www.99-bottles-of-beer.net/
It has 1019 different programming versions of simple programs to work thru the 99 bottles song. http://forum.shrapnelgames.com/images/smilies/happy.gif

Gandalf Parker

Wow, this site is spectacular. I think I'll need to spend some time there, to get all the strange languages.

WraithLord October 19th, 2006 07:16 PM

Re: Dom-III PBEM manager
 
I have worked with C, CPP, Perl and Java (for RT, not J2EE).
Python, I've heard a lot about and decided to check it recently. I think its a superb language, elegant and consice and with a giant code base on the web.

So Nerfix, It all boils down to what you need done. C is best for performance, Java for web, Perl for information mining and Python for prototypes I use them all depends on what I need done, Oh and don't forgot to use VIM as your text editor http://forum.shrapnelgames.com/images/smilies/wink.gif

Nerfix October 20th, 2006 08:39 AM

Re: Dom-III PBEM manager
 
I think I should learn Java properly first. We had a longish course about it in the BC but we barely reached the objects. http://forum.shrapnelgames.com/images/smilies/frown.gif I studied it a bit in home but then schools started and work piled up on me. D: I did manage to program some sort of store software using objects & all with it though... http://forum.shrapnelgames.com/images/smilies/happy.gif

We'll have a course about PHP though and it's supposedly a lot like Java.

But studying a smitter of some easy to learn language that's still useful would be helpful in the future. i'm bizarrely interested in coding though I have recently heavily shifted toward HTML, CSS & all. Learning Javascript would propably be the next logical step.

Ahhhhh, so many choices....

Gandalf Parker October 20th, 2006 09:49 AM

Re: Dom-III PBEM manager
 
It depends.
JavaScript is good if you are interested in doing more with what the user sees on their screen.
PHP is good if you want to do more with what goes on at the server end for providing services.

On a Dom3 website JavaScript would be good for making a god-creation tool people could play with.
PHP would be good for making a web-based game managment system

IMHO

Cheezeninja October 21st, 2006 08:17 PM

Re: Dom-III PBEM manager
 
Could you post a block of text showing what the PBEM_conf file would look like correctly filled out? Do you enter the information within the < >'s or just replace that whole part with the correct information. You leave the < >'s out completely right?

Also what does the /cygdrive/ in the path signify? Should I remove that since it is not part of the path on my computer, or is that something Python related?

edit: Also thanks a bunch!!!!!!!

Edit2: Also when I try running the module with Python (2.5) I get an indentation error of some sort. Any and all help would be appreciated, I really don't know what I'm doing.

WraithLord October 22nd, 2006 08:28 AM

Re: Dom-III PBEM manager
 
1. Full config file:
[GENERAL]
# Windows values:
dom_path = D:\Program Files\dominions3
temp_turns_path = D:\temp
backup_path = D:\temp\domIII

host_email = name@gmail.com
host_pwd = 1234
sig_msg = Thanks, name
active_game = test

[GAMES]
games= test

[test1]
players = player1@gmail.com:mid_oceania, player2@yahoo.com:mid_pythium, player3@whocares.com:mid_vanheim

sent_turns_msg = have fun http://forum.shrapnelgames.com/images/smilies/happy.gif

2. /cygdrive, is for cygwin - a Linux flavour OS on top of MS windows. Just ignore it if you work on windows, use windows path instead.

3. Thanks for your interest http://forum.shrapnelgames.com/images/smilies/happy.gif

4. You should seriously consider upgrading to python 2.6. Also python is white space sensitive. The script was tested on windows and cygwin and should work ok. Could it be that the file was edited by mistake?- Maybe try to DL it again. If that fails please post here or PM me with the exact error you get and I'll look into it.

Cheezeninja October 22nd, 2006 07:04 PM

Re: Dom-III PBEM manager
 
Okay. I think I've done everything right, I don't have libgmail in the python folder if that matters, which it doesn't seem like it should(?), or your module either. I open up the Python gui, open your file, and select run module. It gives me this error:

Error: Inconsistent indentation detected!

1) Your indentation is outright incorrect (easy to fix), OR

2) Your indentation mixed tabs and spaces.

To fix case 2, change all tabs to spaces by using edit->Select All followed by Format->Untabify Region and specify the number of columns used by each tab.

It also takes me to a line in the middle of your module and highlights the line that says "self.ga.login()"

WraithLord October 22nd, 2006 07:37 PM

Re: Dom-III PBEM manager
 
Oh, I think I may have a hunch what's causing your issue.
Please make sure you follow step 3. of my first post.
After which libgmail should be correctly installed, please verify it as follows: open a shell (start->run->cmd in windows, or xterm in linux), run python (IDLE works as well), run import libgmail.
This should work w/o errors, if you hit an error this means libgmail isn't installed correctly. It should be fairly easy to install what with one command that installs it and up until now worked smoothly for me. Tell me if this helps.

Cheezeninja October 22nd, 2006 07:58 PM

Re: Dom-III PBEM manager
 
I installed libgmail, I even managed to access the gmail account to make sure it worked, but I'm unsure what you mean by "run import libgmail" I don't see any import options, and doing a index search of the help documentation brings up a whole bunch of stuff I don't understand.

WraithLord October 22nd, 2006 08:34 PM

Re: Dom-III PBEM manager
 
I mean do the following.

1. start->run->cmd, should open up dos shell.

2. print:
python
and press enter, this should start python, you should see the prompt as >>>.

3. print:
import libgmail.

This should work with no messages. If you do get messages it means that installation of the lib has failed.

Cheezeninja October 22nd, 2006 09:57 PM

Re: Dom-III PBEM manager
 
Yea, I get an error message that says there is no module named libgmail. I ran the setup.py file though, is there a specific folder I should put the libgmail files in?

Edit: I got it to not give me an error message by putting the libgmail files in the "libs" folder, but the pbem manager module still gives me the same error message.

WraithLord October 23rd, 2006 05:12 AM

Re: Dom-III PBEM manager
 
you should run:
$ python setup.py install

You shouldn't do anything manually with the lib. Install takes care of everything. After that you should be able to get the "import libgmail" to work. If you are there and still get errors when running the PBEM manager please give me the exact error.

Beorne October 25th, 2006 06:38 PM

Re: Dom-III PBEM manager
 
I've had this error:

------------------------------------------------------------
Dom III PBEM Manager Interactive mode.
initing class...
Loading class configuration
section found: test1
section items: [('sent_turns_msg', '<message that will be added to the turn dis
tribution email>'), ('players', '<list of players in the following format: playe
r1_email:player1_nation, player2_email:player2_nation etc.\nExample: player@gmai
l.com:mid_oceania, 2nd_player@yahoo.com:mid_pythium, etc>')]
section found: GAMES
section items: [('games', '<list of games seperated by ,>')]
section found: GENERAL
section items: [('backup_path', 'D:\\temp\\domIII'), ('host_pwd', '<your passwo
rd>'), ('host_email', '<your gmail address>'), ('dom_path', 'D:\\Program Files\\
dominions3'), ('temp_turns_path', 'D:\\temp'), ('sig_msg', 'Thanks, <your name>'
), ('active_game', '<default for currently active game>')]
item in general: backup_path value: D:\temp\domIII
setting value of backup turns path to: D:\temp\domIII
item in general: host_pwd value: <your password>
setting value of host password
item in general: host_email value: <your gmail address>
setting value of host email to: <your gmail address>
item in general: dom_path value: D:\Program Files\dominions3
setting value of dominions path to: D:\Program Files\dominions3
item in general: temp_turns_path value: D:\temp
setting value of temporary turns path to: D:\temp
item in general: sig_msg value: Thanks, <your name>
setting value of signature to: Thanks, <your name>
item in general: active_game value: <default for currently active game>
setting value of active game to: [ <default for currently active game> ]
item in games: games value: <list of games seperated by ,>
loaded game name list: ['<list of games seperated by ', '>']
Traceback (most recent call last):
File "C:\Program Files\459268-PBEM_Util\domIII_PBEM_utils.py", line 784, in <m
odule>
ineractive_mode()
File "C:\Program Files\459268-PBEM_Util\domIII_PBEM_utils.py", line 756, in in
eractive_mode
mgr = DomIIPbemMgr()
File "C:\Program Files\459268-PBEM_Util\domIII_PBEM_utils.py", line 116, in __
init__
self.loadConf()
File "C:\Program Files\459268-PBEM_Util\domIII_PBEM_utils.py", line 250, in lo
adConf
game_item = self.config.items(game_name.strip())
File "C:\Program Files\Python25\lib\ConfigParser.py", line 544, in items
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: '<list of games seperated by'
------------------------------------------------------------

WraithLord October 25th, 2006 07:05 PM

Re: Dom-III PBEM manager
 
@Beorne, first nice to see that you've switched the debug on http://forum.shrapnelgames.com/images/smilies/happy.gif
The error stems for the fact that the configuration file is an example and not a working configuration file. A value that you should fill is indicated by <> braces, you should replace this including the braces with your values.

Try it yourself, create a new game with, say, two or more players, fill in the blanks in the configuration file and check if this works for you.

Beorne October 26th, 2006 04:37 AM

Re: Dom-III PBEM manager
 
And I'm a professonal programmer ... what a pity.
Thank you, I'll try.

I'd liked very much to learn Python, but now for me at work is the time of C#, a very good prog language even if is M$. The dark side is Visual studio, a thin layer of complexity and mess covering all.

WraithLord October 26th, 2006 11:04 AM

Re: Dom-III PBEM manager
 
I recommend learning Python, as it embodies some very nice programming concepts. It is a cool language from the get go.

Beorne November 4th, 2006 09:29 AM

Re: Dom-III PBEM manager
 
For now I'm using this great utility to send new turns to players.
But when it sends the turn to marco.andreoni@aliceposta.it it raises this error.
What is it?
Thanks.

---------------------------------------------------
Sending turn to marco.andreoni@aliceposta.it nation early_vanheim
turn path: C:\Giochi\dominions3\savedgames\Elevento\early_van heim.trn
Traceback (most recent call last):
File "C:\Program Files\459268-PBEM_Util\domIII_PBEM_utils.py", line 784, in <module>
ineractive_mode()
File "C:\Program Files\459268-PBEM_Util\domIII_PBEM_utils.py", line 780, in in eractive_mode
switchAction.get(opt, help)()
File "C:\Program Files\459268-PBEM_Util\domIII_PBEM_utils.py", line 152, in mngGame
switchMngAction.get(opt, help)()
File "C:\Program Files\459268-PBEM_Util\domIII_PBEM_utils.py", line 389, in send_turns
self.send_turn(turn_path, to, 'New '+self.active_game+' turn, number '+turn_
number+', for '+nation, body)
File "C:\Program Files\459268-PBEM_Util\domIII_PBEM_utils.py", line 374, in send_turn
self.ga.sendMessage(msg)
File "C:\Program Files\Python25\lib\site-packages\libgmail.py", line 592, in sendMessage
items = self._parsePage(req)
File "C:\Program Files\Python25\lib\site-packages\libgmail.py", line 352, in _
parsePage
items = _parsePage(self._retrievePage(urlOrRequest))
File "C:\Program Files\Python25\lib\site-packages\libgmail.py", line 333, in _
retrievePage
resp = urllib2.urlopen(req)
File "C:\Program Files\Python25\lib\urllib2.py", line 121, in urlopen
return _opener.open(url, data)
File "C:\Program Files\Python25\lib\urllib2.py", line 374, in open
response = self._open(req, data)
File "C:\Program Files\Python25\lib\urllib2.py", line 392, in _open
'_open', req)
File "C:\Program Files\Python25\lib\urllib2.py", line 353, in _call_chain
result = func(*args)
File "C:\Program Files\Python25\lib\urllib2.py", line 1109, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "C:\Program Files\Python25\lib\urllib2.py", line 1076, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (10053, 'Software caused connection abort')>
---------------------------------------------------

WraithLord November 4th, 2006 11:42 AM

Re: Dom-III PBEM manager
 
My first hunch is that gmail doesn't like this address. Have you tried to send a mail from gmail to that address?

Other then that it may have something to do with HTTPS alert returned from the mail server when trying to setup the session. In that case it will take a more thorough digging to troubleshoot.

Methel March 21st, 2007 06:00 PM

Re: Dom-III PBEM manager
 
This might be more of a general windows question, its related to the manager though.

When I run it the command window breaks up wrong. I get parts of the same line on the next one.

Seems like it might be a matter of the size of the command window.

Is there a way to change this and what size is the manager made for?

WraithLord March 21st, 2007 08:41 PM

Re: Dom-III PBEM manager
 
yeap, its a windows issue. In linux\cygwin it works alright.
As for windows, when the dos window opens up you can right click the title bar, choose properties, choose layout tab, modify window size Width and Height values to your liking, choose the "save properties for future..." and click ok.


All times are GMT -4. The time now is 01:22 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.