Monday, 22 February 2010

HS: clock and events

One more short snippet on the variable-rate clock: if you're interested in implementing a priority queue in C#, in my case for use as an events queue, then you want a SortedList . I use long as the key since I am trying to operate everything based on "ticks", since that's what MS seems to use as the finest-grained time measurement available in DateTime. A tick is 100 nanoseconds, which led to an out-by-1000 conversion error in my code that took an hour or so to pin down.

The upshot of implementing that was that I was able to create an AI "AlienPlayer" class that, on construction inserts an event to trigger 10 minutes into the game. That event is an "InvestigationZone". Not to talk about the game design too much, but I want to incorporate X-Files-esque "investigations" into the game as an alternative to pure tactical combat to give more variety. They'll just run in a Neoforce window and every so often prompt the player for a new action. I'm unsure as to the mini-game design as yet.

Here's a picture of an InvestigationZone on the world view- marvel at my graphic design skills:


My source image actually has a black border around the question mark - I have yet to figure out how to get XNA to render compound alpha blending rather than additive blending. More fiddling with the effects file required, I suspect.

No comments:

Post a Comment