I'm a software engineer who works on game development part time. I teach game development (on gamedev.stackexchange.com and lynda.com). I'm always working on something, and I'll post updates here. Let me know if there's a game development topic you want to know more about, I probably know the answer, or at least where to get one.

Saturday, June 2, 2012

Time circles

How does Age of Goblins track time? First some terminology.

The goblins use a different system than ours for tracking to progress of time. They use a base 10 system. Each cycle of the star around the little flat world the goblins have settled on is called a dak. For those trying to keep track, basically a dak is the equivalent of a day, that is, the entire day/night cycle that we’re so used to here on earth. Each dak is broken up into 10 adrs. Each adr has 10 decadrs, and each decadr has 10 centadrs. Still following? It I were to compare it to standard earth time it would be something like:

Dak = day
Adr (10 per dak) = hour (24 per day)
Decadr (10 per adr) = minute (60 per hour)
Centadr (10 per decadr) = second (60 per second)

Then of course there’s the longer spans, like a decadak (week/month) and centadak (year). And just like our days of the week they have daks of the decadak and weeks of the year are decadaks of the centadak. It all rolls of the tongue pretty nicely, at least the goblin tongue and that’s all their really worried about.

The system was actually adopted only 143 centadaks ago when the paper crisis of centadak 0 nearly drove the goblin economy into the ground (what exactly caused the paper crisis is unclear as the the goblins didn’t have anything to write on to record the events). The goblins decided on this system because it produced nice square calendars. Thus paper waste was reduced nearly 23%. But I digress.

This star that’s circling has some interesting properties. First off, it orbits in such a way that the days are longer than the nights. That’s pretty good for these goblins, since they adopted diurnal activity long ago. Additionally, the star grows and shrinks with perfect regularity, as if a sine wave were controlling its size. The entire cycle of grow->shrink lasts exactly 100 daks. Or one Centadak. How convenient. The produces some nice seasonal changes across the surface of the flat world.

Things I’ve been working on lately:
  • Entity definitions using scripts. This means that you and I can easily create entities using an external data file. The script defines everything from the layout the the entity’s body (organic or mechanical OR BOTH), to what items it produces for harvesting, to how it gets rendered. Pretty neat. It’s been fun working on that because I’ve been generating content for the game and it’s been sparking a bunch of ideas for improvements and additions.
  • The time system. The system as described above has been semi in place for a while. A few weeks ago my wife and I sat down and made up names for all the daks in a decadak, for the decadaks in a centadak and the seasons. I implemented those changes and tied everything in to the various update loops. So now all the update logic uses in game time and the various aspects of entities from production times to movement speeds are defined using AoG time units. Currently the real world time of a single dak is 10 minutes. That means an entire centadak takes about 17 straight hours of game play to get through. I don’t know of any other games that take that long to get through an in-game year, so I don’t know how it’ll work yet. It’s something I’ll have to tweak as I go. But I think it could make for some pretty epic games. Surviving your first year would be a significant achievement. But then again with 4 hours per season, it may get dismal in the coldest months. I may implement a fast forward if I see the need for that.
  • Harvest producing entities. I posted an image a while back of a tree producing way too many apples. While that was a funny mistake, it was the beginning of some really fun coding for harvest producing entities. Now using the entity scripts I can define a good number of aspects about production. So items can have production restrictions such as: time of dak, season of the centadak, minimum condition of the producer and a maximum per centadak. In addition to the expected required time to produce there’s also output options like dropping or storing in inventory to be collected by another entity later.
  • The Lexicon.This is used to store all the parsed entities from the scripts into a one stop shop for producing entities. I can ask the lexicon to give me a goblin and it will produce a goblin that has it’s properties randomized and weighted based on the ranges defined in the script. The randomization ranges from body size to gender to what skills the goblin is proficient with.
Well that’s all from me for now. Thanks for your interest!

No comments:

Post a Comment