Sign in to follow this  
  • entries
    72
  • comments
    51
  • views
    59841

DOS Pong! and OS Development Series - Next tutoria

Sign in to follow this  
Crypter

137 views

A couple of small things...

DOS Mode 13h Graphical Pong!

I added palette code to the Pong! game, along with player 2 AI and basic game state management.

The AI for player 2 (Computer controlled) is very simple. It modifies player 2's s velocity vector based on the current position of the ball. I'm still kind of playing with it, but it works pretty well. Player 2 tries it's best to track the ball, and does pretty good with that. However, it is possible to beat player 2 and score a point.

The code right now really is simple:

/* if ball is below us */
if (_ball->m_y > _Player2->m_y) {

/* Increase velocity--watch for going to fast */
if (_Player2->m_yv <= 4)
_Player2->m_yv++;

}

/* if ball is higher then us */
if (_ball->m_y < _Player2->m_y) {

/* Increase velocity--watch for going to fast */
if (_Player2->m_yv >= -4)
_Player2->m_yv--;

}



This works--for now. The ball's velocity is faster then the players, which is why it is possible to beat player 2.

Its 1056 lines of code so far, and I am adding the finishing touches--On to the splash screen!

Jees..The actual game code is only 300 lines of code so far. The rest of the code includes routines to print characters, draw strings, video mode and graphics routines, bitmap loader, palette routines and mouse/timing interrupt handlers.

I still need to write a bitmap saving routine though to save an image of the game. It should not be too hard though.

OS Development Series--next tutorial coming soon!
--------

I also started work on the upcoming OS Development Series tutorial. Because most of the new code uses modified routines from the bootloader code, I decided that this will be a review--it puts everything together in both context and code. It will not go into as much detail as the bootloaders tutorial, but instead, focuses on putting all of those concepts discussed into work in the context of the new code.

This tutorial goes over the new code, that will traverse the FAT12 filesystem (similar to the Bootloaders 4 tutorial...kind of) and loads and executes the Kernel at 1 MB. A basic Kernel, but a kernel nonetheless.

-------

I guess thats all for now...[smile]


Sign in to follow this  


1 Comment


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now