Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Defenderoids - Playing with bitmaps
#1
I've been mucking about with bitmaps - obviously, the poor old NGPC was never really built for this, but I'm having fun trying to actually do something that isn't purely cosmetic with the old bitmap functions.

There's no actual game yet - just a playground with a bunch of asteroids, a Qix and a rotating "sprite" that moves in a classic turn-left/right and thrust kind of fashion, but thought that you lot might enjoy seeing it.

I'm not really sure where I'm going with it - I think I could probably turn this into a reasonable Asteroids clone relatively quickly but for now I'm just playing with different bitmap effects.

   

Source: https://github.com/Ahchay/Defenderoids.ngp

Rom Only: Defenderoids.ngp

edit: removed the velocity limiter on thrust as that wasn't working.
Reply
#2
Thanks, Ahchay!

By the way, I edited your URL for the ROM. I hope I did it properly. The iframe code wasn't working correctly.
Card Fighters' Clash 2 English Translation ( http://cfc2english.blogspot.com/ )
Neo Geo Pocket Flash Cart and Linker Project ( http://www.flashmasta.com/ )
Avatar art thanks to Trev-Mun ( http://trevmun.deviantart.com/ )
Reply
#3
Cheers Ed, yes, that looks great. Tried to attach it here, but came up against file type restrictions - probably could have zipped it but easier for me to link into the 1Drive. I'll keep the file updated as and when I make some kind of actual progress.
Reply
#4
Any project (indepent of the size) will be welcome. What is the status of the game actually?

Regards,
Reply
#5
At the moment, it's just me mucking about with some ideas.

The "player" ship is controllable, and I've got the whole Asteroids style rotate, drift and thrust thing working quite nicely - albeit at something like 9FPS. Which doesn't actually feel as bad as it sounds - it's amazing what your brain does to compensate.

Anyway, I've mainly been doing some of the project admin - adding a basic title screen and main title/game/gameover/repeat loop.

I want to bring in the Defender aspect next - so, essentially side scrolling over a height map "background" and then I'll try adding in some actual game elements. I guess the basic concept is "Asteroids style control in a Defender style gameplay" - a bit like the old 8 bit game Thrust I guess?

I think I'll throw some sprites in for the bad guys as they'll be less expensive to draw/move and then cut down on the Asteroids themselves - or have that as a bonus/witch-space stage maybe? Vector to vector collision feels like a problem that's simply too calculation intensive for the NGPC, but Centre-Centre intersections of two polygons should work well enough.

Anyway, latest WIP is up on the 1drive if you want to have a play, or the source is in Github if you'd like to spy on me as I go.
Reply
#6
   

So, that Defender style game world was easier than I thought. All I had to do was lock the "sprite" x position and update a horizontal offset on thrust.

Okay, none of the other in-game objects are (yet) bound to the horizontal position of the "world" but that should be relatively trivial - I'll need to separate some of the direct pixel accesses to get that to work properly though. But, for now, you can fly about and it sort of feels right.
Reply
#7
And now all the in-game objects are bound to the horizontal offset. This is still causing some problems at the wrap-around point, and I get the occasional hang when the engine attempts to draw objects outside of the bitmap area, so I'll need to be more careful with my bounds checking.

From a gameplay/control perspective though, it works quite nicely.
Reply
#8
   

Starting to come together as a playable thing now. I've got most of the game elements in there at least.
Reply
#9
Hi,

Maybe you could try my line drawing routine (it MAY be faster than the one you're using (or not)):

Code:
; ------------------------------------------------------
; Draw a line on screen (mainly optimized for size)
; Written by Franck "hitchhikr" Charlet
; ------------------------------------------------------

table_pixels_tiles:
                   db      0 + 1,  1 + 1,  2 + 1,  3 + 1,  4 + 1,  5 + 1,  6 + 1,  7 + 1
                   db      8 + 1,  9 + 1, 10 + 1, 11 + 1, 12 + 1, 13 + 1
                   db     14 + 1, 15 + 1, 16 + 1, 17 + 1, 18 + 1, 19 + 1
table_pixels_pos_nibble:
                   db      1, 1, 1, 1
                   db      0, 0, 0, 0
table_pixels:
                   db      0x80, 0x20, 0x8, 0x2

DX                  equ     0
SX                  equ     2
X1                  equ     8
Y1                  equ     10
X2                  equ     12
Y2                  equ     14
draw_line:
                   dec     4, XSP
                   ld      WA, (XSP + X2)
                   sub     WA, (XSP + X1)
                   j       ge, delta_x
                   neg     WA
delta_x:
                   ld      (XSP), WA
                   ld      BC, -1
                   ld      WA, (XSP + X1)
                   cp      WA, (XSP + X2)
                   j       ge, step_x
                   neg     BC
step_x:
                   ld      (XSP + SX), BC
                   ld      IZ, (XSP + Y1)
                   ld      HL, (XSP + Y2)
                   sub     HL, IZ
                   j       ge, delta_y
                   neg     HL
delta_y:
                   ld      DE, -1
                   cp      IZ, (XSP + Y2)
                   j       ge, step_y
                   neg     DE
step_y:
                   cp      (XSP), HL
                   j       le, neg_err
                   ld      IX, (XSP)
                   j       pos_err
neg_err:
                   ld      IX, HL
                   neg     IX
pos_err:
                   sra     1, IX
line_loop:
                   ld      IY, IZ
                   srl     3, IY
                   mul     IY, 20
                   ld      WA, (XSP + X1)
                   srl     3, WA
                   lda     XBC, table_pixels_tiles
                   ld      A, (XBC + WA)
                   extz    WA
                   add     WA, IY
                   ld      BC, WA
                   sll     4, BC
                   ld      IY, IZ
                   and     XIY, 0x7
                   add     XIY, XIY
                   add     IY, BC
                   ld      WA, (XSP + X1)
                   and     WA, 0x7
                   lda     XBC, table_pixels_pos_nibble
                   ld      A, (XBC + WA)
                   extz    WA
                   add     IY, WA
                   add     XIY, BACK_BUFFER
                   ld      WA, (XSP + X1)
                   and     WA, 0x3
                   lda     XBC, table_pixels
                   ld      A, (XBC + WA)
                   or      (XIY), A
                   ld      WA, (XSP + X1)
                   cp      WA, (XSP + X2)
                   j       ne, check_end_of_line
                   cp      IZ, (XSP + Y2)
                   j       eq, line_done
check_end_of_line:
                   ld      BC, IX
                   ld      WA, (XSP)
                   neg     WA
                   cp      IX, WA
                   j       le, inc_x
                   sub     IX, HL
                   ld      WA, (XSP + SX)
                   add     (XSP + X1), WA
inc_x:
                   cp      BC, HL
                   j       ge, line_loop
                   add     IX, (XSP)
                   add     IZ, DE
                   j       line_loop
line_done:
                   inc     4, XSP
                   ret

To be used like this:

Code:
                    pushw   100
                    pushw   10
                    pushw   50
                    pushw   120
                    calr    draw_line
                    inc     8, XSP

Have a nice day.
Reply
#10
There are definitely optimisations to be had in the line drawing, I'll have a look at some point.

I've got a basic check for purely horizontal and purely vertical lines at the moment, but am sure that there's more that can be done.

For now, I've still got some vectors that disappear when my wraparound point approaches - I'm spending my time checking my maths around those. Get it working first and all that...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)