Blogs

Oh yeah, I'm going to Vancouver

Having never been to North America before, it now seems I'm going twice in the space of a month;

  • June 2008 - Relic Open House in Vancouver, BC, Canada
  • July 2008 - Google Highly Open Participation Contest Prizegiving in Mountain View, California

The latter I've posted on before, but the former is new. It seems I won Relic's Biggest Fan Contest 2008 (for those of you who don't know, Relic is a video game developer). Apparently I wrote ~50,000 lines of C++ for this program called Mod Studio for modding Relic games. I'm not totally sure; the details are a bit fuzzy ;)

Anyway, in a few weeks time I'll be flying off to Vancouver for 4 days and enjoying the company of some Relic people and RelicNews people. Should be fun.

Generating Lua Inheritance Trees Quickly

Relic games store their entity/building/squad/etc. attributes in Lua files. They have alot of Lua files, all of which look something like this:
-- Some comment about copyright and editing the file by hand
GameData = Inherit([[sbps\races\chaos\chaos_squad.nil]])
GameData["squad_cap_ext"]["support_cap_usage"] = 2.00000
GameData["squad_combat_stance_ext"] = Reference([[sbpextensions\squad_combat_stance_ext.lua]])
-- more changes to GameData...

If you want to create an editor like their official Lua Attribute Editor, then you need to build an inheritance tree out of all those Inherit calls in all those files. The official editor is known for being slow, but I believe I've found a nice fast way to build it.

Of Lua, Quines and mod_wombat

I've been playing around with Lua (my current favourite dynamic language) in two areas of late: Quines (programs who print their own source code when run), and mod_wombat - a Lua module for Apache2.

First off, a quine:
s="s=%qprint(s:format(s))"print(s:format(s))

That one is a port of a classic C quine from Wikipedia over to Lua:
main() { char *s="main() { char *s=%c%s%c; printf(s,34,s,34); }"; printf(s,34,s,34); }

Anti-Spam Test

I'm currently trying the Drupal-6-dev branch of the Askimet module to try and block the comment spam which has been building up lately. If you have any problems posting legitimate comments, drop me an email (myname@myname.org, myname=corsix).


Edit 1: Nope, had to disable askimet as it was generating fatal errors when trying to post a comment (although the comments do get posted).
Edit 2: Changed to reCAPTCHA to help fight spam and digitise books. This seems to be working, although I'll test askimet again once the Drupal 6 branch is stable, as I would prefer not to force users into completing a CAPTCHA in order to post.

I discovered a bug in Lua

The following line of code, entered into a Lua 5.1.x (<= 5.1.3) interpreter, can cause the interpreter to crash/segfault:

loadstring(string.dump(function()return;end):gsub("\30%z\128",'"\0\0',1))()

Note that this only works on standard builds of Lua where virtual machine instructions are expressed in 32 bit little endian integers. So, for example, you can make Company of Heroes crash by entering equivalent code into its console. Read on for a description of why this causes a crash.


Edit: Another related, albeit different crash-causing line: (Which makes it two bugs I've found)

loadstring(string.dump(function(...)a,b,c,d=...;a=1;end):gsub("e%z\128\2.....",'\2@\128\0"\0\128\0$'))()

Company of Heroes Patch 2.300 and Modding

If you've gone online with CoH in the past two days, you'll have been required to download the new 2.300 patch.

The good news: lots of balance fixes, team automatch, hopefully better RO server, other niceties
The bad news: "-dev" mode no longer works, making it difficult to develop and run mods and custom maps

Apparently, Relic are working on a fix for this, but in the meantime I have a temporary solution:
Download http://www.corsix.org/misc/COH2300dev.rar and extract it to your Company of Heroes folder (probably something like C:\Program Files\THQ\Company of Heroes). RelicCOH.exe has -dev permanently turned off in 2.300, and the RelicCOHUnblocked.exe you just placed in your folder has -dev permanently turned on. Set your shortcuts to use the unblocked EXE if you want dev mode. For convenience, the included batch file can be used to swap the two files over - simply double click RelicCOHSwap(.bat) to swap -dev mode between permanently off and permanently on. Before applying any future patches, remember to swap things back to how they were originally and then delete the custom EXE.

If you're interested in how the altered EXE is different, and why it works then read on. Otherwise be glad that there is a workaround for CoH 2.300. As always, donations via paypal are always appreciated:

Europe in Ruins Ingame UI?


Above: Company of Heroes: Opposing Fronts running with a prototype overlay rendered on top.
Download video of the overlay in action.

The Europe in Ruins mod for Company of Heroes always presents interesting challenges. At the moment, I'm prototyping an in-game UI for the mod, as administering your army inside the game should be alot more user friendly than doing it on a website. If you're interested in how it's done then carry on reading, otherwise be happy that EiR might one day use an in-game UI.

Winning GHOP

I've been chosen as Drupal's grand prize winner for the Google Highly Open Participation Contest. So on top of the $500 I get for completing 15 tasks, I also receive an all-expenses paid trip to the Googleplex in Mountain View, CA for myself and a parent. When I spotted an announcement for GHOP on slashdot back in November, the grand prize looked extremely nice but at the same time, out of reach. I want to say thankyou to the Drupal GHOP admins, mentors and members of the community who helped me from zero Drupal knowledge up to where I am now. Although I'm in the limelight, the real winner here is Drupal itself, with exactly 130 tasks completed by students, all of whom are now more involved in open source.

GHOP Review

For the last few months, I've been participating in the Google Highly Open Participation Contest, performing programming and documentation related tasks for the Drupal project. Now that the work is done, let's take a look at the tasks I've done: (links provided to the Google page and the Drupal page for each task)

New corsix.org

If you're a regular visitor, you'll have noticed a bit of a change. The site backend has changed from a poor little CMS I wrote for IT coursework, to the wonderful Drupal CMS. The site theme has also changed from a Dark Crusade styled theme, to a blue Drupal theme.

Blog posts and their associated comments have been converted to the new system, however information pages and their comments have not been converted yet. Spam comments (of which there were some 23 thousand) were deleted rather than converted.

Syndicate content