Original Post

A work in progress. It’s mostly identical to the Virtual Boy version, except that all data is stored in a file rather than being hardcoded into the game, and the fact I had to write my own graphics code. Other than that it’s pretty much just translating C to BASIC.

It will probably have more levels, a level editor, sound effects, and maybe even music and multiplayer. These features may be later ported to the Virtual Boy, depending on how much bribe help and support I get.

Why am I developing for DOS? Because there’s a DOS emulator for just about every operating system, which makes it cross-platform 🙂

Attachments:
4 Replies

Cool! How much work was it to port your code to Basic? That wouldn’t have been my first choice, I would imagine it would have been easier to port it to DOS while staying in C. You might also consider writing it in Java. That way your code would be both cross-platform and web enabled.

I would also like to know “why BASIC?” but also: what dialect of BASIC are you using?

Another cross-platform game programming environment (optionally with yet another language) is the Gosu library (http://www.libgosu.org/). It’s written in/for C++, but it also has Ruby bindings. It’s basically an object-oriented, 2-D graphics API on top of OpenGL, along with KB/joystick input and sound/music playing.

I find Ruby much more fun to write than BASIC (or C, for that matter) and it’s quite powerful, especially if your video card is doing all the heavy lifting, graphics-wise.

How much work was it to port your code to Basic?

Not much (but I’m not finished yet). Compare

      while(Lives)  // Gameplay loop
      {
        if(!Cycle)
        {
          MoveShip();
          HeadsUpDisplay();
        }

        Cycle++;

        LowBatteryIcon();
        CollisionDetection();
        PlayerControl();
        ThingAI();           // Thing behavior
        ProjectileAI();      // Projectile behavior
        AutoRemoveThings();  // Removal of things outside the screen
        AutoCreateThing();   // Creation of new things
        Slowdown();          // Maintain a consistent game speed
        
        if(!(Cycle % 32)) UpdateBackground();
      }

with

    DO WHILE Lives > 0  'Gameplay loop
      IF Cycle = 32767 THEN Cycle = 0
      IF Cycle = 0 THEN HeadsUpDisplay
      
      Cycle = Cycle + 1

      RedrawStuff  'Graphics code
      CollisionDetection
      PlayerControl
      ThingAI           'Thing behavior
      ProjectileAI      'Projectile behavior
      AutoRemoveThings  'Removal of things outside the screen
      AutoCreateThing   'Creation of new things
      Slowdown          'Maintain a consistent game speed

      IF Cycle AND 32 <> 0 THEN UpdateBackground
    LOOP

or

int AutoRemoveThings ()
{
  // Checks each thing's Y and removes it if it's outside the screen.

  char i;  // Thing number.
  char j;  // Object number.

  for(i = 0; i <= kMaxThings; i++)
  {
    if(Thing[i].Used)
    {
      if(Thing[i].Y > 224)
      {
        Thing[i].Used = 0;  // The thing is officially no longer used.
        Thing[i].Direction = 0;

        // Make its OBJs invisible.
        for(j = 0; j <= 15; j++)
        {
          OBJ_SET_VIS(16 + j + (i << 4), 0);
        }
      }
    }
  }
}

with

SUB AutoRemoveThings
FOR i% = 0 TO kMaxThings
  IF Thing(i%).Used THEN
    IF Thing(i%).Y > 224 THEN  'Notice there's no need to hide OBJs - the thing simply won't be drawn if it's not used.
      Thing(i%).Used = FALSE
      Thing(i%).Direction = 0
    END IF
  END IF
NEXT i%
END SUB

That wouldn't have been my first choice, I would imagine it would have been easier to port it to DOS while staying in C.

Maybe. Maybe not. I'm much more skilled and productive in BASIC. Debugging with an interpreter is way easier. Both are procedural, imperative, structured languages anyway.

You might also consider writing it in Java. That way your code would be both cross-platform and web enabled.

I don't have an interest in Java (or any class-based object-oriented language) and I think the two advantages you mentioned are way overrated. It's like constructing a (human) language that only has features that exist in all languages and everybody can understand. You'd get nowhere.

what dialect of BASIC are you using?

QuickBASIC. In case I ever want to do a native Windows port I can easily do it in FreeBASIC.

It’s funny how such an obsolete language can still be relevant if all you want to do is make a simple game. It shows that you really don’t need much if the game is just that – simple.

Good luck with the port, hoping to play it on my real DOS machine some day. 😛

 

Write a reply

You must be logged in to reply to this topic.