Perl and Command Line interface to the campaign server

Discussion of all aspects of the game engine, including development of new and existing features.

Moderators: Forum Moderators, Developers

Post Reply
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Perl and Command Line interface to the campaign server

Post by Dave »

There have been quite a few new feature requests for the campaign server. Among them, a web-based interface to it. Also, people want features such as rating of campaigns.

I figure that the simplest way to make a web-based interface to the campaign server is to use the same sockets interface that the Wesnoth client does. To facilitate this, I have written a Perl module which can communicate using WML, and an associated script which can access the campaign server -- it can get a list of the campaigns on the campaign server, and it can download campaigns from the campaign server.

I think that this should be enough to allow someone to make a basic web-based interface to the campaign server. Either by using the command line interface, or by writing it in Perl using the script as an example of how to access the Perl modules which implement WML.

I'm really hoping some Perl programmers will pick this up and run with it -- we could easily use the Perl modules to develop an interface to the Wesnoth multiplayer server, which could be useful for a number of reasons.

It'd also be a useful 'test bed' for adding new features to the campaign server: we could add a feature, such as rating of campaigns, and then start with a web based interface via Perl to rate campaigns. Once we have it working, we could easily add the functionality to the Wesnoth client.

We could even consider re-implementing the campaign server in Perl. The C++ implementation is only ~200 lines, and a Perl implementation should be even shorter. Then a Perl programmer could add things to both the server and Perl-based client; when features got acceptance they could be added to Wesnoth.

The files can be found in the CVS in the utils/ directory:

Code: Select all

utils/campaigns_client.pl
utils/wml.pm
utils/wml_net.pm
The script can be used like so:

Code: Select all

perl campaigns_client.pl ls
to list the campaigns on the server. And then like this to download a campaign ready for playing:

Code: Select all

perl campaigns_client.pl download Sceptre_of_Fire ~/.wesnoth/data/campaigns
I've made a start, but I don't have time to make this useful by myself. I'm looking for volunteers to make lots of improvements. :)

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming

Quensul
Art Contributor
Posts: 303
Joined: January 2nd, 2005, 1:06 am
Location: Pittsburgh, PA

Post by Quensul »

I'll take a look at this as soon as is feasible, but that may be a bit - I certainly don't want to give anyone the idea that I'm "claiming" it. I have a chunk of work to get done on Wercator before I can pop this to the top of my Wesnoth stack, but I'll start thinking about it.

So, just to make sure I'm on the same page here, about all we can do at the moment is write the web interface, correct? Any additional features will need to wait for support Wesnoth-server-side - it would seem rather silly to implement them on the server the Perl script is running on (via a database or whatnot), since all that could tell you is whether people might possibly use the feature.

Said web interface should include a listing of the campaigns (and any info available about them), and a link to allow the downloading of the campaign. Anything I'm missing?

Quensul
Author of Wercator

scott
Posts: 5242
Joined: May 12th, 2004, 12:35 am
Location: Alexandria, VA

Post by scott »

Here is a link for these files. Anyone working on this, by the way?

http://svn.gna.org/viewcvs/wesnoth/trunk/utils/
Hope springs eternal.
Wesnoth acronym guide.

Quensul
Art Contributor
Posts: 303
Joined: January 2nd, 2005, 1:06 am
Location: Pittsburgh, PA

Post by Quensul »

Not at the moment. I just finished a nightmarish two months of running human-subject experiments; I should be getting back into the swing of things Wesnoth-wise (and rest-of-life-wise) in the next week or two. My priority is getting Wercator to 1.0, tho, so it'll be a while before I take a stab at this (unless I get frustrated ;-)).
Author of Wercator

scott
Posts: 5242
Joined: May 12th, 2004, 12:35 am
Location: Alexandria, VA

Post by scott »

This might amuse you, but check this out:
http://www.cis.rit.edu/~slk8779/CampWeb/campweb.shtml

I think the next step, as someone who knows basically zero cgi programming and little web programming, would be to make a shell script that parses this garbage and generates clickable html, where the click executes the download command.

Just like with the scenario editor, I hope to plant some seeds until someone with skills (nunchuck skills, bow hunting skills, computer hacking skills) can take off with it.

I'm stoked it actually worked though.
Hope springs eternal.
Wesnoth acronym guide.

User avatar
allefant
Units Database Administrator
Posts: 516
Joined: May 6th, 2005, 3:04 pm

Post by allefant »

From #wesnoth-dev logs:

Sep 18 18:38:19 <Sirp> bruno is working on a web interface to the campaign server for us. :) http://wolff.to/wesnoth/list.html

scott
Posts: 5242
Joined: May 12th, 2004, 12:35 am
Location: Alexandria, VA

Post by scott »

Hey, his looks much better. Awesome.
Hope springs eternal.
Wesnoth acronym guide.

ott
Inactive Developer
Posts: 838
Joined: September 28th, 2004, 10:20 am

Post by ott »

In utils, Dave's campaigns_client.pl is a basic but fully functional client to talk to the campaign server.

My campsum script will parse the output of the campaigns_client.pl listing of campaigns and report any differences since the last time it was run:

Code: Select all

 cd utils; ./campaigns_client.pl | ./campsum
Note that you need to modify the file path in campsum to a location that makes sense on your machine. Sample output:

Code: Select all

Deleted:
The_Dark_Hordes|The_Dark_Hordes (updated)|0.0.4|394038
New:
MyUnitPack|My Awesome Unit Pack|1.0|393
Superheroes_MP_era|Superheroes MP Era|1.0rc1|4812
The_Dark_Hordes|The Dark Hordes (updated)|0.0.10|394485
Changed:
A_New_Order|A New Order|0.2.0|5847851|0.2.1|6709241
Eternal_Kingdom|Eternal Kingdom|0.4.3|23606|0.4.3|17484
Legend_of_Wesmere|Legend of Wesmere|0.8.6 (BFW9.2+; COMPLETE)|1301603|1.0 (BFW9.2+; COMPLETE)|1421859
Mage_Republic|The Mage Republic|v0.3.2|1265342|v0.3.3|1264818
Northern_Rebirth|Northern_Rebirth|1.3 Complete|3298178|1.4 Complete|3327691
Two_Brothers|Two Brothers|0.6.1|228431|0.6.1a|244226
Under_the_Burning_Suns|Under the Burning Suns|0.5.4 9/6|3714467|1.0.1 9/20|3976690
Someone could run campsum on a handy server to highlight each day's changes...
This quote is not attributable to Antoine de Saint-Exupéry.

ott
Inactive Developer
Posts: 838
Joined: September 28th, 2004, 10:20 am

Post by ott »

Here is my version of Dave's modules, wrapped in a perl-style archive that can be installed using the usual CPAN 'perl Makefile.PL; make test; make install' routine.
Attachments
Parse-Wesnoth-0.01.tar.gz
(4.41 KiB) Downloaded 776 times
This quote is not attributable to Antoine de Saint-Exupéry.

Post Reply