Friday, July 11, 2008

Am I done yet?

The GREEN bar is produced by a collision between the white/Black box, and the brown box.I have now added some basic gameplay keyboard routines and a sample collision detection routine. I stress these are samples and need to be adapted for whatever game you might end up writing.

So what do GAMEPLAY keyboard routines look like? Well it doesn't scan the full keyboard for a start - that takes ages. You basically list the keys you want and it'll scan for them and set a BIT somewhere for you to check in the gamecode. This means you do minimal keyboard reading and spend all your valuable CPU time doing game stuff.

And how about the collision code? Well it's basically the same as I had in Blood Money, and have in XeO3. If you imagine 2 spheres colliding, to work out if they've hit, you subtract the centers and get the distance between them, then add the radii together and if the total of the radii is larger than the distance between the centers, they've hit. I do basiaclly the same thing but with squares. Each sprite has a center point and I subtract them (one at a time - no Square roots here!), then I add the two X widths (from the center) and compare with the distances between the X centers. If the 2 widths are greater than the to centers subtracted, then we've hot on X, if so we do the same with Y. For a little more speed, the X centers are divided by 2 so we can get rid of the significant bit of X - one less thing to worry about. SO! The current setup consists of:

  • 16 sprite bouncing around with 3 compile time sorting options.
  • 1 player sprite being controlled by the joystick (in either port)
  • A gameplay keyboard routine
  • Some basic collision detection.

    And there you have it. If theres nothing else I'll start doing a little game of some sort or other and when thats done, I'll release it. Not that I really need to do a game though, but it'll give others time to ask for additions while I'm doing it...
  • 9 comments:

    Anonymous said...

    Hmm, a background SID player or some nice screen scrolling routines perhaps

    Mike said...

    LOL no no... If you want some music you can easily install one of the many MANY players out there. :)

    As to scrolling, again thats so game specific that I'm not going to do that either. Thats not to say myself or others couldn't start building up little librarys for themselves and have them available for download from a modules page or something - but not yet. A scrolling library also needs a map editor so its more than a little work.

    Vladimir Janković said...

    Something like N would be nice :)

    You just have to add that simple physics and you are done :)

    Mike said...

    eh? "N"???

    LOL... thats even MORE game specific :D

    Vladimir Janković said...

    N - Metanets platform game with ninja as a main character...

    http://www.harveycartel.org/metanet/n.html

    I found their tutorials inspirational for a game for c64...
    Simple physics for platform game... inertia.. gravity...

    Would be good for a simple engine like yours... multiplexed sprites leave enough time for calculating stuff....

    Anonymous said...

    Perhaps I can send you my outline for my dream game and you can incorporate it into this c64 framework? ;)


    I mean, N is cool and all, but the idea of turning this multiplexor + nifty extras into a full-on physics based game engine is kind of missing the point.

    Vladimir Janković said...

    It was ment to be a joke :(

    But I still think some simple platform game could be made out of this framework... nothing fancy just a lot of objects to avoid and simple left right jump collect stuff...

    Anonymous said...

    Whoops, sorry Vladimir. Looks like I missed the point instead... You even had the smilies there and everything.

    Mike said...

    Well, I'm playing with a simple platformer as it is, so thats probably enough. Althogh like I said before I dont expect to finish it, just to have somehting you can run around in....