BomberMan / Dynablaster style game

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
BomberMan / Dynablaster style game
by on (#207673)
Some time ago I tried to do a game similar to Bomber Man. The main reason was the curiosity I could do with my low programming capabilities ... I had some problems, but I could almost copy the basics of this game. Of course, still a long way to go and I have some things I can not solve.

The first thing to do is to calculate / extract ATTRIBUTE TABLE so that it accurately matches the location of the bomb. The bomberman bomb has a different palette than its explosion (changing the palette in the attribute table). In my demo of the game, the place of the bomb is also copied to RAM variables BombY_Temp and BombX_Temp. Maybe their position would be good to calculate the position of this place on the screen in the Attribute Table? The problem is that one byte (two bits per single 16x16 field) in this array corresponds to four 16x16 pix fields on the screen, I do not know how to calculate it.

I would like some tips on how to make randomly moving opponents. The one I did in this demo came out pretty weak.

Another thing is the best way of animating a background in UNROM (it is not possible to animate the background using CHR bank switching). Originally the code I have under UNROM, but the demo I have now moved to the CNROM where animating the bomb is by switching CHR banks. However, I would prefer UNROM.

Link to an earlier topic where I asked for help with the bomb code.
https://forums.nesdev.com/viewtopic.php?f=10&t=16256

Sample code I used to animate the bomb and its explosion in UNROM:
Unfortunately it overloads the NMI (VBLANK), which crashes in NTSC (in the PAL barely). I have no idea how to do this as efficiently as possible.

Code:
Bomb_Anim_no:
   RTS
Bomb_Anim:      ;in NMI loop

   INC Bomb_Anim_Timer   ;timer
   INC Bomb_Anim_Timer
   INC Bomb_Anim_Timer
   INC Bomb_Anim_Timer

   LDA Bomb_Anim_Timer
   CMP #$00
   BCC BA_no1

   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE1_AddrLO
   STA $2006
   lda #$10         ;pattern table bgr tile1 nr.
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE2_AddrLO
   STA $2006
   lda #$11         ;pattern table bgr tile2 nr.
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE3_AddrLO
   STA $2006
   lda #$20         ;pattern table bgr tile3 nr.
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE4_AddrLO
   STA $2006
   lda #$21         ;pattern table bgr tile4 nr.
   sta $2007
;   LDA #$00   ;reset screen (Not needed, there is one at the end of the NMI loop.)
;   STA $2006
;   LDA #$00
;   STA $2006

BA_no1:

   LDA Bomb_Anim_Timer
   CMP #$40
   BCC BA_no2

   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE1_AddrLO
   STA $2006
   lda #$12
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE2_AddrLO
   STA $2006
   lda #$13
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE3_AddrLO
   STA $2006
   lda #$22
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE4_AddrLO
   STA $2006
   lda #$23
   sta $2007
;   LDA #$00
;   STA $2006
;   LDA #$00
;   STA $2006

BA_no2:

   LDA Bomb_Anim_Timer
   CMP #$80
   BCC BA_no3

   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE1_AddrLO
   STA $2006
   lda #$14
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE2_AddrLO
   STA $2006
   lda #$15
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE3_AddrLO
   STA $2006
   lda #$24
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE4_AddrLO
   STA $2006
   lda #$25
   sta $2007
;   LDA #$00
;   STA $2006
;   LDA #$00
;   STA $2006

BA_no3:

   LDA Bomb_Anim_Timer
   CMP #$C0
   BCC BA_no4

   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE1_AddrLO
   STA $2006
   lda #$12
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE2_AddrLO
   STA $2006
   lda #$13
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE3_AddrLO
   STA $2006
   lda #$22
   sta $2007
   LDA BOMB_PPU_TILE1_AddrHI
   STA $2006
   LDA BOMB_PPU_TILE4_AddrLO
   STA $2006
   lda #$23
   sta $2007
;   LDA #$00
;   STA $2006
;   LDA #$00
;   STA $2006

BA_no4:
   RTS

Re: BomberMan / Dynablaster style game
by on (#207678)
Hi, I think I answered you over Nintendo age.

Edit : well at least about the code you posted
Re: BomberMan / Dynablaster style game
by on (#207697)
I think the beginning is very promising. Do you plan to continue with the development of this dynablaster clone?
Re: BomberMan / Dynablaster style game
by on (#207701)
Thanks. I noticed post on nintendoage. However, moving the BOMB_PPU_TILEx_Addrxx variables to the PPUs is a lot of code, and it takes NMI time - I do not know if this can be simplified with UNROM. However, in Bomberman there are no CHR banks switching, and there are many bombs and each has its own animated explorations (which had to be in VBLANK time).
Re: BomberMan / Dynablaster style game
by on (#207703)
When updating the NT you don't need to update the address if the next tile you update is right after the previous one.

Code:
;|---|---|
;| A | B |
;|---|---|
;| C | D |
;|---|---|


lda BOMB_PPU_TILE1_AddrHI
sta $2006
lda BOMB_PPU_TILE1_AddrLO
sta $2006

lda #$10 ; tile A index
sta $2007
lda #$11 ; tile B index
sta $2007

lda BOMB_PPU_TILE3_AddrHI
sta $2006
lda BOMB_PPU_TILE3_AddrLO
sta $2006

lda #$20 ; tile C index
sta $2007
lda #$21 ; tile D index
sta $2007



Updating 4 tiles in a frame shouldn't be a problem.

Also, in your code, you should use BEQ instead of BCC to avoid updating the NT on each NMI.

You can read this topic about attributes : http://forums.nesdev.com/viewtopic.php?f=10&t=7253.
Re: BomberMan / Dynablaster style game
by on (#207704)
The fact that you can walk freely in all directions where you're free to do so sets it apart from Bomberman/Dynablaster, which could be a nice change - especially if enemies could take advantage of it too!

I'd probably speed them up a bit.

One way to make them more "clever" without adding constantly running where-is-the-player-checks is have them decide on moving randomly or targeting the player every tile, ie move 16 pixels, done? check for a new target, move 16 pixels, done? repeat.

You can also read up on how the ghosts in pacman have different "personalites" which adds up to a sensation of them using tactics together.

If you keep it that way, i'd recommend that the game helps out the player a bit rounding corners as it is easy "getting stuck" on edges if your aim/timing isn't 100% accurate.
Re: BomberMan / Dynablaster style game
by on (#207708)
glutock wrote:
When updating the NT you don't need to update the address if the next tile you update is right after the previous one.


You're right, I did not think about it ... it changed a lot, thanks! :)
I totally forgot that every write to 2007 registry increases the PPU's address by one... :oops:

And actually the BCC change on BEQ / BNE has changed quite a bit. I forgot that using BCC, writing to PPU was done in every frame unnecessarily many times with the same value. Now the code works fine in UNROM.

I also had a problem with the method of collecting items on the screen, which are also elements of the background. But I did it and it works just fine. The most important code itself checks the BGR tile number on the screen and resets its place to the empty background.
Re: BomberMan / Dynablaster style game
by on (#209755)
Some changes in the code. There are hidden things and doors in the walls. Not tested on the hardware - I am curious if everything works ok on NTSC consoles.


EDIT: (Ryoga question)

The size / length of the fire will not be increased (at least for now, because I have a problem with this in UNROM - in the mapper with switching CHR banks it will be easy). Things to collect will have some functions, but for now I do not know what.
One person wrote to me that the code hangs on Everdrive running on the NTSC console - is that true? : /
Graphics / Music are temporary. I have no idea for them.

I tested the code that "helped" in entering the side passages (as in BomberMan). Unfortunately, it is problematic. Even in the original game as you go and want to turn sideways, for example by holding DOWN + RIGHT, the character is blocked. So, probably leave it as it is.

EDIT 2018.05.24 - new controls
Re: BomberMan / Dynablaster style game
by on (#209804)
I have tried the new demo, including the two test levels after the main level. I like the sprite of the protagonist although it is difficult to overcome the design of the character in the original game.

Playing the demo I have seen that an item appears with a monger wrapped in flames or something similar. Is that item supposed to increase the power of the bomb? If so, after taking it the power of the bomb remains the same.
Re: BomberMan / Dynablaster style game
by on (#209805)
beautiful game.
bomberman moves sprite by sprite, not to remain in the middle of corridor.