Archive for October, 2007

Fire!

We have projectiles! :) Well.. You can shoot a human missile anyway, and lots of them :O

Right now they don’t have any collision and I’m still getting the missile to track the enemy correctly.

Its proving a little difficult because my space coordinates follows the display coordinates. It is inverted along the Y axis, so up is negative and down is positive. More cleaning up would probably be a good idea. :P It will probably eat up a bunch of time tho, so I might not have that much new to report next week :I

Rockets away!

Almost there

This week I wanted to figure out why my ships weren’t flying like in SC2 and I found it :)

Got rid of  a couple bugs in my code and now the physics are ALOT better, much more SC2-like.  I spent a couple days trying to figure out this one procedure from the original SC2 code:

void SetVelocityComponents (VELOCITYPTR velocityptr, SIZE dx, SIZE dy)
{
 COUNT angle;

 if ((angle = ARCTAN (dx, dy)) == FULL_CIRCLE)
 {
  ZeroVelocityComponents (velocityptr);
 }
 else
 {
  if (dx >= 0)
  {
   velocityptr->vector.width = VELOCITY_TO_WORLD (dx);
   velocityptr->incr.width = MAKE_WORD ((BYTE)1, (BYTE)0);
  }
  else
  {
   dx = -dx;
   velocityptr->vector.width = -VELOCITY_TO_WORLD (dx);
   velocityptr->incr.width =
     MAKE_WORD ((BYTE)0xFF, (BYTE)(VELOCITY_REMAINDER (dx) << 1));
  }
  if (dy >= 0)
  {
   velocityptr->vector.height = VELOCITY_TO_WORLD (dy);
   velocityptr->incr.height = MAKE_WORD ((BYTE)1, (BYTE)0);
  }
  else
  {
   dy = -dy;
   velocityptr->vector.height = -VELOCITY_TO_WORLD (dy);
   velocityptr->incr.height =
     MAKE_WORD ((BYTE)0xFF, (BYTE)(VELOCITY_REMAINDER (dy) << 1));
  }

  velocityptr->fract.width = VELOCITY_REMAINDER (dx);
  velocityptr->fract.height = VELOCITY_REMAINDER (dy);
  velocityptr->error.width = velocityptr->error.height = 0;
 }

 velocityptr->TravelAngle = angle;
}

I just can’t wrap my head around what the fract, incr, and error variables are used for. Man, all that bitshifting confuses me, and I see it in the code EVERYWHERE :O :O  Thankfully, my own code seems to get the job done.

So now that the ships seem pretty good, i think i can move onto some projectiles?  Wow, i guess the ships will be able to do more than fly and crash.   Amazing  :)Â

Still going

Well, so far I’d say this blog success at keeping me inspired to work on the game.  I wouldn’t want a Sunday roll by without anything new to post.  :)

New stuff working:  Ship spawn trails, controller class that buffers input, fixed the camera zooming on victorious ship, and some minor HUD additions.

I was gonna cap another video but it would look pretty similar to the last one, so I will hold off on that for now.  .

Happy Thanksgiving

Yup thats right,  its Thanksgiving here in Canada.  Woohoo long weekend!

I’m still workin on the ships teleporting in here.  After looking at the original code and I see what they’re doin, the ship trails when a ship teleports in are like the thrust particles, just in the shape of a ship.  It doesn’t look like the ship actually moves, the particles are spawned away from the starting point instead.      

So its not working just yet, but shouldn’t be too long now.   

After the teleporting I think I’ll try figuring out why the game seems sluggish compared to the original SC2.  :I

Damn you Halo

Another week of mostly rewriting old ugly code.  Not too far from having the game loop from a ship dying then getting a new ship.  However I want to do it in a nice and tidy way, so I gotta keep rewriting the old crappy code first.  I would’ve gotten farther but well Halo 3 kindof came out this week so I was playing through that a lot  :p   Hmm maybe after the game/menu loop I can work on the ships teleporting in..