Monday, June 4, 2012

Achievement Tracker / PHP-cronjob

Hiho!

Well, currently the achievement tracker is under development, so here comes some information on that:

The tracker is used to evaluate a character's progress with the achievements. Basically this is done using a cronjob. Ok, actually it's not a real cronjob. We need a cronjob though to handle our tracker and monitor it. The tracker script is set to call itself before terminating. So we have a powerful way to handle load on the server.

There are three core components of the tracker: the DataHandler, DataSources and Atoms

DataHandler:
The DataHandler is set up to provide access to actual game data. This allows us to query for things like "a characer's dappers" without knowing where the data is stored or how it is returned to us. DataHandler does that for us.

DataSource:
DataSources are created by the DataHandler. They are defined in the config file, so you may add as many DataSources as you like. By default there will be three DataSources: XMLapi, ValueCache and RingOpen. Each datasource reports to the DataHandler which data they can provide and also offer a function to retrieve and even write (if possifle) data. The DataHandler does the rest.

Atoms:
Atoms define our triggers, so the script will know when an achievement is triggered. Like their name suggests, Atoms are the most atomic bricks. The can be granted or denied. This is still work in progress, so here is just a short preview how Atoms might be scripted:
VALUE dappers = c_money
IF(dappers >= 5000) {
    GRANT
}

VALUE tmp = c_fame[scorchers]
IF(tmp == 0) {
    DENY:3600
}

VALUE x = c_pos_x
VALUE y = c_pos_y
SCRIPT inside(x,y) {
    IF(MSG == "Majestic Garden") {
        GRANT
    }
}

EVENT player_death
ON player_death {
    UNLOCK
}

EVENT region_changed
ON region_changed {
    IF(MSG == "Majestic Garden") {
        GRANT
    }
}
Ok, that's all for the moment. I'll be posting more information on this topic a soon as I make progress.

Yours Cotare

No comments:

Post a Comment