Page 1 of 3

PCMistress 3 redux (for developers)

Posted: Fri May 20, 2011 2:14 am
by solipsist
Hi all,

For the last year or so, milovana has been hosting the source code for PCMistress 3, my re-implementation of the very popular PCMistress program. As plans for a new (re-)release of pcm3 fell foul of my real life commitments, it has been somewhat in limbo.

So for anyone wanting to take a look at the latest reincarnation of this program, you can access the subversion repository at

http://mv.openmoon.org/svn/pcm/pcm3/trunk

At the moment it isn't ready for a new release, so if you're not familiar with developing in Java, it won't be much use to you. Hopefully I will find some time in the next couple of months to push this version over the wall and do a full-fledged release.

For those who want to take a look, you will need to do:

Code: Select all

 # Check out the source codesvn checkout http://mv.openmoon.org/svn/pcm/pcm3/trunk pcm3# Download the external dependenciesant download# Build the distributionsant# Run the version for your platformjava -jar dist/linux-x86_64/pcm3.jar 
If anyone can pick it up and make some improvements, feel free to send me a patch and I'll apply it. After a few patches I'll be happy to talk about commit access.

Regards,
solipsist

Re: PCMistress 3 redux (for developers)

Posted: Fri May 20, 2011 6:11 am
by Holdingout1
I wish I had Java skills to help out here I don't. What I can say is that I have used PCM2 for many years and its my go to tool for creating all sorts of mini teases with sound, video, and other features. My hope for PCM3 is that it is as easy to program as PCM2 but that it brings more options, and more functionality. Keep up the good work . . .we all appreciate it :-)

Re: PCMistress 3 redux (for developers)

Posted: Fri May 20, 2011 8:05 am
by MistressAlexa
Hello,

Thank you for posting the source, it is very interesting, and I will look into it. Under what is it licensed?

Re: PCMistress 3 redux (for developers)

Posted: Fri May 20, 2011 11:53 am
by Human
Hmm, I'm interested..I'll take a look.

Re: PCMistress 3 redux (for developers)

Posted: Fri May 20, 2011 12:41 pm
by thedane
Hi, I have trouble with compiling the source.

Do you have a further hint for the javacc home directory than this:

<!-- Override this on the command line if not running on linux -->
<!-- <property name="javacchome" value="/usr/share/java"/> -->

I get the following error when trying to build:
BUILD FAILED
C:\Temp\pcm\build.xml:69: JavaCC home must be a valid directory.

Re: PCMistress 3 redux (for developers)

Posted: Fri May 20, 2011 6:57 pm
by slaveashish
not sure i am good enough but will take a look

Re: PCMistress 3 redux (for developers)

Posted: Fri May 20, 2011 7:54 pm
by dtspam
@thedane
You need JavaCC (Java Compiler Compiler), a parser generator. It's not part of the JDK: http://javacc.java.net/
I couldn't really figure out, what to set the path to, though. So I just commented out the call to javacc, and started it from the command line. There is only one JavaCC file in the project.

I took a quick look at the source code.
The most interesting part to me seems to be the parser for the old PCM 2 scripts. There is quite a bit of content for PCM 2.

The script interpreter for PCM 2 scripts seems to be more of a crude hack, so that's not that useful.
It looks like most of the work went into a new programming language called IMP. I don't really see the point in that. While it is always fun to invent new programming languages, there are really a lot scripting languages out there that could be used for that. And IMP seems to be a quite complex language (from a look at the AST and the examples). There even seems to be a compiler and stuff. That's far too much unnecessary complexity for a program like PCM. A script language and a really well designed API should do the job.

There is a bit of GUI-Code covering the typical PCM features. Since there isn't much GUI in PCM (some buttons, checkboxes, pictures and sounds sums it up), that's not so complicated. And since it uses SWT instead of Swing, I wouldn't like to touch it anyway ;-)

A interesting project could be to just take the PCM2 parser code, rewrite the interpreter and the GUI and create a new PCM2 script viewer. I would be willing to help with that, but it would need some people, willing to figure out all the nasty details of the pcm2 script semantics.

Re: PCMistress 3 redux (for developers)

Posted: Sat May 21, 2011 3:37 am
by gizmo686
How should we submit changes?

Re: PCMistress 3 redux (for developers)

Posted: Sun May 22, 2011 12:06 am
by MistressAlexa
I agree about the complexity of the language. That's why I am writing a new CyberMistress-type program, which uses a much simpler "language". In fact, the parser is built in to Python, as the ConfigParser module.

Re: PCMistress 3 redux (for developers)

Posted: Sun May 22, 2011 1:45 am
by dtspam
You're using python as a scripting language? Any plans of developing your CyberMistress clone as an open source project?

Re: PCMistress 3 redux (for developers)

Posted: Sun May 22, 2011 8:10 am
by MistressAlexa
Yes, definitely. That was my intention. Also, using Python would allow it to run on all major operating systems, and possibly the web.

I have also found some Creative Commons-licensed images to use for a default script.

Re: PCMistress 3 redux (for developers)

Posted: Sun May 22, 2011 11:51 am
by dtspam
Any chance taking a glimpse at the current project state? ;-)

Re: PCMistress 3 redux (for developers)

Posted: Sun May 22, 2011 6:22 pm
by MistressAlexa
It's still in a very early stage; I'm just struggling with the GUI currently. The runtime and parsing is very easy to do. Essentially, I set up a recursive structure that reads blocks in routines as follows:

Code: Select all

 #!/usr/bin/env pythonimport ConfigParserimport sysimport time config = ConfigParser.RawConfigParser()config.read('CMOriginal/routines/IntroductionKala.CM')routine = 'Introduction' if 'start' not in config.options('General'):    print 'Error: No "General" block defined in routine %s.'%routine    sys.exit(1)if 'end' not in config.options('General'):    print 'Error: No "start" or "end" options defined in "General" block in routine %s'%routine    sys.exit(1)first = config.get('General', 'start')last = config.get('General', 'end') def run_block(block):    '''A recursive function that calls itself to advance to the next block.'''    if block!=last:        print(config.get(block, 'message').replace('\\n','\n')+'\n')         if 'askyn' in config.options(block):            dialog_message = config.get(block, 'askyn').replace('\\n', '\n').split('|')            YNDialog(None, 'Question', message=dialog_message[0], nlabel=dialog_message[1], ylabel=dialog_message[2]).ShowModal()            if answer == ID_YES:                run_block(config.get(block, 'yes'))            elif answer == ID_NO:                run_block(config.get(block, 'no'))         else:            delay = config.get(block, 'delay')            try:                time.sleep(float(delay))            except ValueError:                raw_input(delay[delay.index('|')+1:])            run_block(config.get(block, 'next'))    else:        return run_block(first) 
As you can see, parsing is made very easy with Python's ConfigParser module. I wrote a regex parser before noticing this existed. :rant:

YNDialog is inherited from the WxPython dialog. I have not included any of the GUI aspects here because they are not usable in their current state. WxPython seems to be the best choice for GUI since it adopts the native widget style.

If I'm not too busy I hope to have the basic program ready in a few months.

Re: PCMistress 3 redux (for developers)

Posted: Sun May 22, 2011 9:52 pm
by neo36
wow keep us updated MisstressAlexa,

I would be more than happy to write scripts or help in anyway I can.

I toyed with PCM and cybermistress quite a bit but since they both got removed from the net I feel some kind of void and there is a "need" somewhere I m sure.''

Re: PCMistress 3 redux (for developers)

Posted: Mon May 23, 2011 12:16 am
by MistressAlexa
Actually, writing scripts would be a great help, especially the default script. I plan on making an all new one, since the old seems to not be open source.

Basically, the majority of the work in writing the default script would involve making a list of punishments and assignments, in the same format as assignments.CM and punishments.CM. The only requirement would be that you would have to release it under an open-source license compatible with the LGPL, because that is what I think the application should be licensed under.

If anyone is interested, please tell me. It could be a great cooperative effort.