User scripting in Galaxia Reborn

June 9, 2005 by Oliver · 1 Comment
Filed under: Galaxia, Games, MPOGs, PHP 

Something I’ve wanted to put into Galaxia for a long time is user scripting. i.e. allowing users to attach scripts to objects that are triggered by certain events. Ultimately this could lead to interesting computer players (but that’s a long way off).

Well I’ve been playing around with it a little and the easiest complex data to parse seems to be XML. So the scripting engine will be XML based. The following is how a script will (hopefully) look:

<onFleetEnterSector>
  <IsEnemy target="$fleet">
    <ExectureOrder order="attack" target="$fleet" />
  </IsEnemy>
</onFleetEnterSector>

Just in case you can’t tell what it does, when a fleet enters the same sector as your own it checks to see if is an enemy and if is, attacks it.

Firstly a bunch of variables the script can read are passed to it. After that all the processing works using callbacks. When each tag is encountered, it just calls some specified function with the attributes passed as arguments (probably as an associative array to easily handle a variable number). If it’s a conditional (like “IsEnemy”) the function must return true or false. If it’s an action (like “ExecuteOrder”) then it returns nothing. There is also another type – one that returns an arbitrary value (i.e. a function – but I’ve used the word function too much already).

I’ll put the code up once it’s tested a bit more.

Dancing in Trafalgar Square

June 9, 2005 by Oliver · Comments Off
Filed under: Personal 

As anyone who saw the local London BBC News yesterday (and possibly others) will know, there was a large open air teadance in Trafalgar Square yesterday! One possible highlight was setting the world record record for the most couples involved in a open air teadance – 195.

I also got sunburnt on an unluckily sunny day…

Google SiteMap

June 5, 2005 by Oliver · Comments Off
Filed under: Google, Technology 

If you don’t know about it already, checkout Google SiteMap.

Proof of the existence of Albinaaaaaaaghs

June 5, 2005 by Oliver · Comments Off
Filed under: Personal 

For some reason we were talking about albinos and specifically whether albino polar bears exist. Imagine someone on expedition to look at polar bears. The only way you could tell it was albino would be to look at it’s eyes. And by that time it would be too late for you.

“So is it a polar bear?”
“Actually I think it’s an albinaaaaaaagh!”