Jump to content

PacManPlus

Members
  • Content Count

    5,644
  • Joined

  • Days Won

    28

Blog Comments posted by PacManPlus


  1. Very nice - this is coming along great...

     

    How are you going to handle the difference in the lethal walls / robots? (i.e. the robots in Frenzy just stop you from moving in that direction instead of killing you, as do the walls) ...or I should say *are* you going to handle it differently than the Berzerk-inspired version?

    I ask this because In the version I am doing for the 7800 I am having two separate collision routines for Frenzy and Berzerk... Because In Frenzy the objects stop moving just *before* there is a collision (i.e. there's a small gap between them), and in Berzerk you (or the robot) die when there *is* a collision.


  2. I don't think so, with the issue I'm having... it's actually Maria time I have the issue with. I'm 'reusing' 6 robots (up to) 4 times. That seems to be taking a toll on poor little Maria ;)

     

    I may go back to it, though. Wish the 7800 had hardware collision detection. That was where I started having problems.

     

    Bob


  3. Thanks Eric:

     

    I actually know the theory of how it should be handled, but I was trying to figure out programatically what I should do...

     

    But I finally had a breakthrough with how to handle the robots (I only have 6 robots per zone but you can have up to 22 per room). I have a variable, indexed by object number that indicates the 'robot slot' (1-6) the object takes up in each DL. I foresee the routine that moves the robots keeping track of what robot is in what slot, and whether or not they can move vertically.

     

    So I'll be working on that tonight, before I forget what I've started. :thumbsup:

     

    Another thing I've noticed while looking at the source code, is that the mazes aren't 'stored' like I thought - they are generated each time you go into a room. I have the section of code that does it, but I can't decipher it. I may ask opcode (being that he knows the Z80 so well) if he could look at it and just explain to me how it's generating the mazes.

     

    Bob


  4. Thanks, Eric. That sounds very do-able (huh huh... I said... do-able)

     

    In making this, there are two things that I am concerned (read:scared) about - 1) The vertical separation of the robots and how to handle it (you can have up to 25 robots in Frenzy), along with the 'moving one robot per frame' thing. and 2) the animations every 4 mazes (Big Otto, Robot factory, etc.)

     

    Bob


  5. I'm actually trying to base this on the arcade game as much as I can. Never even looked at the ColecoVision version. :thumbsup:

     

    I'm hoping there will only be three restrictions between mine and the arcade game:

     

    1) All of the walls will be the same color (as in the screenshot above), although that color will change from level to level as in the arcade (i.e. the reflective walls will not be white, etc.). I don't believe there is enough CPU time to attempt the 320B color mode needed to do that. Also, I have used all 256 characters in 'character mode'. If I use 320B I will lose half of them.

     

    2) I will have to vertically separate the robots - I can only have 5 robots per zone (but there are 23 zones on the screen - every two 'bubbles' that make up a maze wall vertically is a zone). This is again due to CPU time. I don't think this will be that noticeable though.

     

    3) I'm not sure how much of the speech I will be able to do in this. Once I get closer to completion, I will contact the very talented person who added speech to the 2600 version to see if we can work on this one.

     

    Thanks!

    Bob


  6. Thanks again, Eric :thumbsup:

    I will be looking more at the code for the arcade version of Frenzy as I get more into the game logic.

     

    I forgot to post this this morning:

     

    Regarding the maze collision detection, *I GOT IT!*

     

    I arranged the maze pieces like this:

    $80-$8F = full horizontal width section

    $90-$AF = "L" shaped sections

    $B0-$BF = full vertical height sections

    $C0-$CF = lower-left corner sections only

    $D0-$DF = upper-left corner sections only

    $E0-$EF = lower-right corner sections only

    $F0-$FF = full character (like the power plant sections)

     

    I then stripped the high bit and lower nybble, and shifted right twice. This leaves the two lower bits open for X and Y position within the character.

     

    I shifted the X coordinate and the Y coordinate of the sprite within the maze cell character until I got it down to quarters:

    It looks like this:

     

    00 | 10
    ---+---
    01 | 11
    

     

    So if a certain point of the sprite occupies the top-right corner, it will be the "10" value.

     

    That value got added in to the character cell above, and then it was just a table lookup for a $01 or $00 to see if it was valid or not.

     

    For the X positioning, I had to look at every third raster, otherwise there were some spots where the player could move horizontally through a horizontal maze edge. The same applies to vertical checking.

    I think I sill be ok, CPU Clock-Wise, as it looks like Frenzy/Berzerk only moves one robot per frame (that's why they start out slow and get faster as more are killed).

     

    Here is the code (it works!) Please let me know what you think, and if you think it could be made more efficient:

     

    ;  OBJECTPF - CHECK FOR OBJECT/PLAYFIELD COLLISION (ONLY APPLIES TO PLAYER / ROBOTS) SHOTS AND EVIL OTTO HAVE THEIR OWN
    ;  INPUT: X - OBJECT NUMBER, MXLIST - X OFFSET TO MOVE, MYLIST - Y OFFSET TO MOVE
    ;  OUTPUT: UPDATED MXLIST, MYLIST, A=0 OK TO MOVE IN DESIRED DIRECTION, A>0 NOT OK TO MOVE IN DESIRED DIRECTION
    ;  USES: A, Y, TEMP0, TEMP1, (TEMP2, TEMP3 USED IN GETCHAR), TEMP4, TEMP5, TEMP6, TEMP7, TEMP8, TEMP9, TEMP10, TEMP11, TEMP15
    OBJECTPF
             LDA     OTLIST,X
             CMP     #OTTOKILL              ;IF THE OBJECT TYPE IS OTTO OR GREATER, SKIP
             BMI     OPFCONT                ;LESS? CONTINUE ON
             RTS                            ;NOPE - EXIT
    OPFCONT
             LDA     #$00
             STA     TEMP4                  ;HORIZONTAL EDGE (LEFT OR RIGHT - DEPENDS ON DIRECTION OF MOVEMENT)
             STA     TEMP5                  ;VERTICAL EDGE (TOP OR BOTTOM - AGAIN, DEPENDS ON DIRECTION OF MOVEMENT)
             STA     TEMP6                  ;RETURN FLAG TO INDICATE A COLLISION (0 = NO COLLISION, >0 = COLLISION)
             LDA     MXLIST,X               ;CHECK FOR HORIZONTAL MOVEMENT
             BNE     OPFHORZ                ;MOVING HORIZONTALLY; GO ON
             JMP     OPFVERT                ;NOT MOVING HORIZONTALLY; SKIP TO VERTICAL
    OPFHORZ
             BMI     OPFHORZL               ;MOVING LEFT, SKIP THIS NEXT PART
             LDA     #$03                   ;MOVING RIGHT; USE RIGHT EDGE OF OBJECT (POSITIONING IS STILL DONE IN 2-PIXEL INCREMENTS)
             STA     TEMP4 
    OPFHORZL
             LDA     #$00
             STA     TEMP15                 ;THIS WILL BE USED TO CHECK EVERY TWO RASTERS TO SEE IF THERE IS A COLLISION
             LDA     HPLIST,X               ;GET THE HORIZONTAL POSITION
             CLC
             ADC     TEMP4                  ;ADD IN LEFT OR RIGHT EDGE
             ADC     MXLIST,X               ;ADD IN MOVEMENT
             STA     TEMP8                  ;SAVE NEW X POSITION FOR LATER
             JSR     HTOC                   ;CONVERT TO COLUMN
             STA     TEMP1                  ;SET UP COLUMN VARIABLE FOR 'GETCHAR'
             LDA     TEMP8                  ;WE NEED THE HORIZONTAL OFFSET WITHIN THE CHARACTER
             AND     #$02                   ;THERE ARE 4 POSITIONS ACROSS (MOVES IN INCREMENTS OF 2), SO ONLY KEEP THE 2ND BIT
             STA     TEMP10                 ;THIS IS NOW THE HORIZONTAL POSITION OF THE OBJECT WITHIN THE SCREEN CHARACTER (LEFT = 00/RIGHT = 10)
    OPFLOOP
             LDA     VPLIST,X               ;GET VERTICAL POSITION
             CLC
             ADC     TEMP15                 ;ADD IN VERTICAL RASTER OFFSET
             STA     TEMP9                  ;SAVE NEW Y POSITION FOR LATER
             JSR     VTOZ                   ;CONVERT TO ZONE
             STA     TEMP0                  ;SET UP ZONE VARIABLE FOR 'GETCHAR'
             LDA     TEMP9                  ;WE NEED THE VERTICAL OFFSET WITHIN THE CHARACTER
             AND     #$04                   ;THERE ARE 8 POSITIONS VERTICALLY, WE ONLY WANT 'TOP' AND 'BOTTOM', SO ONLY KEEP THE 3RD BIT
             LSR                            ;SHIFT RIGHT TWICE
             LSR
             STA     TEMP11                 ;THIS IS NOW THE VERTICAL POSITION OF THE OBJECT WITHIN THE SCREEN CHARACTER (TOP = 00/BOTTOM = 01)
             JSR     GETCHAR                ;GET THE CHARACTER AT THIS POSITION
             BPL     OPFNEXT                ;MAZE PIECES ARE ONLY NEGATIVE (> $80)
             AND     #$70                   ;STRIP OUT HIGH BIT AND LAST FOUR BITS
             LSR                            ;SHIFT RIGHT TWICE TO LINE UP WITH 'X' AND 'Y', WHICH WILL BE 'ORA'D IN
             LSR
             ORA     TEMP10                 ;OR THE X POSITION IN
             ORA     TEMP11                 ;OR THE Y POSITION IN
             TAY
             LDA     OBJALLOW,Y             ;SEE IF THIS POINT IS ALLOWED TO OCCUPY THE SPACE IT IS IN
             BEQ     OPFNEXT                ;YEP, NO COLLISION
             LDA     #$00                   ;NO, NOT ALLOWED TO MOVE IN THIS DIRECTION
             STA     MXLIST,X
             INC     TEMP6                  ;INCREMENT COLLISION FLAG
             BNE     OPFVERT                ;WE CAN'T MOVE, NO NEED TO CHECK THE REST
    OPFNEXT
             INC     TEMP15                 ;ADD 3 TO TEMP15
             INC     TEMP15
             INC     TEMP15
             LDY     OTLIST,X               ;GET OBJECT TYPE
             LDA     OBJBE,Y                ;GET OBJECT HEIGHT
             CMP     TEMP15                 ;ARE WE PAST IT?
             BPL     OPFLOOP                ;NO, CONTINUE
    OPFVERT
             LDA     MYLIST,X               ;CHECK FOR VERTICAL MOVEMENT
             BNE     OPFVERT2               ;MOVING VERTICALLY; GO ON
             JMP     OPFEXIT                ;NOT MOVING VERTICALLY; EXIT
    OPFVERT2
             BMI     OPFVERTU               ;MOVING UP, SKIP THIS NEXT PART
             LDY     OTLIST,X               ;MOVING DOWN; USE BOTTOM EDGE OF OBJECT
             LDA     OBJBE,Y
             STA     TEMP5 
    OPFVERTU
             LDA     #$00
             STA     TEMP15                 ;THIS WILL BE USED TO CHECK THE LEFT AND RIGHT SIDE OF THE OBJECT MOVING VERTICALLY
             LDA     VPLIST,X               ;GET THE VERTICAL POSITION
             CLC
             ADC     TEMP5                  ;ADD IN TOP OR BOTTOM EDGE
             ADC     MYLIST,X               ;ADD IN MOVEMENT
             STA     TEMP9                  ;SAVE NEW Y POSITION FOR LATER
             JSR     VTOZ                   ;CONVERT TO ZONE
             STA     TEMP0                  ;SET UP ZONE VARIABLE FOR 'GETCHAR'
             LDA     TEMP9
             AND     #$04                   ;THERE ARE 8 POSITIONS VERTICALLY, WE ONLY WANT 'TOP' AND 'BOTTOM', SO ONLY KEEP THE 3RD BIT
             LSR                            ;SHIFT RIGHT TWICE
             LSR
             STA     TEMP11                 ;THIS IS NOW THE VERTICAL POSITION OF THE OBJECT WITHIN THE SCREEN CHARACTER (TOP = 00/BOTTOM = 01)
    OPFLOOP2
             LDA     HPLIST,X               ;GET THE HORIZONTAL POSITION
             CLC
             ADC     TEMP15                 ;ADD IN HORIZONTAL EDGE
             STA     TEMP8                  ;SAVE NEW X POSITION FOR LATER
             JSR     HTOC                   ;CONVERT TO COLUMN
             STA     TEMP1                  ;SET UP COLUMN VARIABLE FOR 'GETCHAR'
             LDA     TEMP8                  ;WE NEED THE HORIZONTAL OFFSET WITHIN THE CHARACTER
             AND     #$02                   ;THERE ARE 4 POSITIONS ACROSS (MOVES IN INCREMENTS OF 2), SO ONLY KEEP THE 2ND BIT
             STA     TEMP10                 ;THIS IS NOW THE HORIZONTAL POSITION OF THE OBJECT WITHIN THE SCREEN CHARACTER (LEFT = 00/RIGHT = 10)		  
             JSR     GETCHAR                ;GET THE CHARACTER AT THIS POSITION
             BPL     OPFNEXT2               ;MAZE PIECES ARE ONLY NEGATIVE (> $80)
             AND     #$70                   ;STRIP OUT HIGH BIT AND LAST FOUR BITS
             LSR                            ;SHIFT RIGHT TWICE TO LINE UP WITH 'X' AND 'Y', WHICH WILL BE 'ORA'D IN
             LSR
             ORA     TEMP10                 ;OR THE X POSITION IN
             ORA     TEMP11                 ;OR THE Y POSITION IN
             TAY
             LDA     OBJALLOW,Y             ;SEE IF THIS POINT IS ALLOWED TO OCCUPY THE SPACE IT IS IN
             BEQ     OPFNEXT2               ;YEP, NO COLLISION
             LDA     #$00                   ;NO, NOT ALLOWED TO MOVE IN THIS DIRECTION
             STA     MYLIST,X
             INC     TEMP6                  ;INCREMENT COLLISION FLAG
             BNE     OPFEXIT                ;WE CAN'T MOVE, NO NEED TO CHECK THE REST
    OPFNEXT2
             INC     TEMP15                 ;ADD 1 TO TEMP15
             LDA     #$03                   ;RIGHT EDGE OF OBJECT
             CMP     TEMP15                 ;ARE WE PAST IT?
             BPL     OPFLOOP2               ;NO, CONTINUE
    OPFEXIT
             LDA     HPLIST,X               ;SAVE HORIZONTAL POSITION AND COLUMN
             CLC
             ADC     MXLIST,X               ;OBJECT MOVEMENT
             STA     HPLIST,X               ;UPDATE HORIZONTAL POSITION
             LDA     VPLIST,X               ;SAVE VERTICAL POSITION, ZONE AND OFFSET
             CLC
             ADC     MYLIST,X               ;OBJECT MOVEMENT
             STA     VPLIST,X               ;UPDATE VERTICAL POSITION
             LDA     TEMP6                  ;LOAD 'A' WITH THE COLLISION FLAG
             RTS
    
    OBJBE
            .byte    $0F,$0F,$0C,$0C,$01,$06,$06,$06,$0F,$0F,$06
    OBJALLOW
            .byte    $01,$01,$00,$00,$01,$01,$00,$01
            .byte    $01,$01,$00,$01,$00,$01,$00,$01
            .byte    $00,$01,$00,$00,$01,$00,$00,$00
            .byte    $00,$00,$00,$01,$01,$01,$01,$01
    

     

    I will post a WIP bin soon.

     

    Thanks!

    Bob

×
×
  • Create New...