Blade Edge

Computer software | Video production | My life in general

Blade Edge main header

Scheduling Goodness

February 23rd, 2008 · No Comments · Software

Transposed from Gaiiden’s Scroll

So I finally got my damn schedule manager done – after two days *grump*. Mainly because I didn’t have much time to work on it, but also because of stupid bugs that were a bitch to uncover. I finally admitted to myself that I needed a schedule manager as the number of schedule() calls continued to pile up from various places in the game. When I go to pause the game, the main pause function was getting cluttered with having to cancel and store the remaining time of every scheduled event in the game. Ugh. So here’s what I have to manage it all.

Weighs in at 160 lines (with spaces and comments), so I’m pretty happy with it. Here’s an example of it in use

Schedule.addObject(false, %this, 1000, "takeSpecialAction", %type SPC %position);

this would be the same as saying

%this.schedule(1000, "takeSpecialAction", %type, %position);

In addition, you can also set the first argument to ‘true’ and the schedule manager will automatically loop that schedule call for you until you remove it.

Oh and just so I can reference it later (and for anyone else interested), this is a bad way to define a ScriptObject

new ScriptObject(Schedule) { appointments = new ScriptGroup(); };

I had that at the top of the file and it compiled fine but for some reason TGB then refused to recognize Schedule as a valid object. It took me a while to think that having it defined that way was causing problems. I have no clue why but TGB doesn’t seem to like it *shrug*

So yea, I converted all my schedule() calls to use the manager and now all I have to do in the main game pause function is say


And all the scheduled events are paused until the game is resumed. Whoo hoo!

Anyways besides that I added two more special block actions, the Drag Block, which slows down the rate at which your opponent’s blocks fall, and the Speed Block, which increases the rate at which your own blocks fall. Now I just have to fix this collision layering bug so that faster blocks can pass slower blocks while dropping towards the same spot without bumping each other until they reach the bottom – at which the block lowest ends up beneath the higher-up block.

I’d add more special blocks but I have to get up early to coach. Blargh. I’ll finish em up tomorrow.

Feel free to use my source code to help build your own schedule manager, I only ask for credit someplace.

Tags: ·

No Comments so far ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment