It is currently Fri Nov 24, 2017 9:45 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Nov 09, 2017 1:09 pm 
Offline

Joined: Tue Apr 11, 2006 4:08 am
Posts: 250
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



Attachments:
demo4_001.jpg
demo4_001.jpg [ 166.65 KiB | Viewed 359 times ]
demo4.nes [64.02 KiB]
Downloaded 24 times


Last edited by sdm on Fri Nov 10, 2017 2:28 am, edited 1 time in total.
Top
 Profile  
 
PostPosted: Thu Nov 09, 2017 2:01 pm 
Offline
User avatar

Joined: Sat Aug 15, 2015 3:42 pm
Posts: 108
Location: France
Hi, I think I answered you over Nintendo age.

Edit : well at least about the code you posted


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 12:32 am 
Offline
User avatar

Joined: Wed Mar 16, 2016 2:08 pm
Posts: 27
Location: World 9 - Warp Zone
I think the beginning is very promising. Do you plan to continue with the development of this dynablaster clone?

_________________
Projects:
My HomeBrew Stuff (8bits/16bits/32bits)
J_GB Emulator (GB / GBC / SGB Emulator written in Java)
NES4J Emulator (NES / FAMICOM / FDS Emulator written in JAVA)


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 2:35 am 
Offline

Joined: Tue Apr 11, 2006 4:08 am
Posts: 250
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).

Nie potrafie kompresować nametable, są w całości w ROM, dlatego chciałbym zostać przy UNROM. Dodatkowo każda mapa to osobna nametable (w UNROM-256 to nie jest problemem, jest ogrom miejsca).

Najważniejsze to optymalizacja i sposób na animację bomby i wybuchu w UNROM.


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 3:44 am 
Offline
User avatar

Joined: Sat Aug 15, 2015 3:42 pm
Posts: 108
Location: France
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.


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 4:02 am 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1022
Location: Gothenburg, Sweden
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.

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 4:48 am 
Offline

Joined: Tue Apr 11, 2006 4:08 am
Posts: 250
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:


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.


Attachments:
File comment: added wall explosion animation
demo6b.nes [64.02 KiB]
Not downloaded yet
File comment: + improved the random movement of enemy.
demo5c.nes [64.02 KiB]
Downloaded 11 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group