Blade Edge

Computer software | Video production | My life in general

Blade Edge main header

Yey blocks go boom!

December 18th, 2006 · No Comments · Software

Transposed from Gaiiden’s Scroll

Well this weekend was fun and relaxing. I chilled out all day Sat, slept till like 3:30 in the afternoon – but that was cause I was up till like 8am playing The Sims and SimCity. So I played games and chilled the rest of the day. I had workout at the gym on Sunday, made a cool $40 for 2 hours and went out to a huge mall up north and spent it all and then some on xmas presents. I figure I’m about 35% done with my shopping. Yep, right on sched, haha. I gotta have the ritual Xmas Eve mall run 😛 Yea I’m horrible…

So today I did some catching up on emails and stuff from over the weekend and started in on the block interaction code. I went through two revisions before I settled on a routine I like. At first I was going to set up a switch() statement and say something like:

    case $ATTACK_BLOCK:

            case $ATTACK_BLOCK:
            case $DEFENSE_BLOCK:
            case $NEUTRAL_BLOCK:

    case $DEFENSE_BLOCK:

To explain, I was taking the block that had just landed on the stack, checking its type and then seeing what the block next to it was, and proceeding to take action. As soon as I finished the first case (Attack vs Attack/Defense/Neutral) I realized that to do the second case (Defense vs Attack/Defense/Neutral) I would just be copying and pasting code and reversing some outcomes. Well that would be a big waste of time. So I identified that there are really only three types of block interactions in the game (Attack vs Attack, Attack vs Defense, and Attack vs Neutral) and replaced the whole thing with three if statements and saved myself a lot of code. Then I further modified it by separating the check for chain reactions and normal block interactions. I still found myself copying and pasting a lot of the block interactions, which is a very good sign that I can wrap 6-7 lines of code from each block interaction into a single function, further optimizing the code (not performance, just the code). I had some time to test it out a bit, uncovered some early mistakes withe the design that still need some rectifying, but they’re fixable without having to rewrite the system. So tomorrow I should be able to finish that up.

During testing under Blitz conditions (since that’s the only mode of gameplay I have coded in right now – and it’s hardcoded too ATM) I realized I was having a lot trouble finding blocks that had arrows pointing in a direction I could actually use. I found myself dropping lots of blocks just in random out-of-the-way places because I couldn’t think of anyplace else to put them. Looks like I’m going to have to seriously consider adding some logic to the clip-loading routine that scans the board, determines what types of blocks would be viable for the player to have at his disposal, and then randomly choose one. A game where most of the time you’re just dropping blocks with no purpose really isn’t all that fun.

Up early in the ‘morrow. So I bid you all goodnight…

Tags: ·

No Comments so far ↓

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

Leave a Comment