BBI Modules 2.1.0 - Updated Modules and BASE + Test Games (NESmaker 4.5.9)

baardbi

Well-known member
May have found a crash bug, @baardbi. When my monsters collide with a breakable tile, the game locks up. Any thoughts on what might be causing that?
It depends on what Solid reaction you have set for those monsters. I know I have a bug in the Explode reaction that could cause this. So you should probably do this anyway. In this file: \BASE_4_5_BBI\Game\MOD_MetroidVania\Subroutines\staticRoutines.asm make the following change:

Code:
explode:
    LDA Object_x_hi,x
    SEC
    SBC #4
    STA tempA
 
    LDA Object_y_hi,x
    SEC
    SBC #4
    STA tempB
 
    LDA Object_screen,x
    ADC #0
    STA tempC
 
    DestroyObject
 
    TXA ;;; ------------------------ Backup X register
    PHA ;;; ------------------------

    ;;; ------------------------ Change to OBJ_EXPLOSION
    CreateObjectOnScreen tempA, tempB, #OBJ_EXPLOSION, #0, tempC

    PLA ;;; ------------------------
    TAX ;;; ------------------------ Restore X register
 
    LDA #1
    STA shakeOn
 
    RTS

PS! I tried to color code the changes, but it didn't show up here, so I wrote comments with this instead ;;;------------------------- .
 

mileco

Active member
It depends on what Solid reaction you have set for those monsters. I know I have a bug in the Explode reaction that could cause this. So you should probably do this anyway. In this file: \BASE_4_5_BBI\Game\MOD_MetroidVania\Subroutines\staticRoutines.asm make the following change:

Code:
explode:
    LDA Object_x_hi,x
    SEC
    SBC #4
    STA tempA
 
    LDA Object_y_hi,x
    SEC
    SBC #4
    STA tempB
 
    LDA Object_screen,x
    ADC #0
    STA tempC
 
    DestroyObject
 
    TXA ;;; ------------------------ Backup X register
    PHA ;;; ------------------------

    ;;; ------------------------ Change to OBJ_EXPLOSION
    CreateObjectOnScreen tempA, tempB, #OBJ_EXPLOSION, #0, tempC

    PLA ;;; ------------------------
    TAX ;;; ------------------------ Restore X register
 
    LDA #1
    STA shakeOn
 
    RTS

PS! I tried to color code the changes, but it didn't show up here, so I wrote comments with this instead ;;;------------------------- .
Hi, dude! Will we have new updates in the near future?
 

baardbi

Well-known member
Hi, dude! Will we have new updates in the near future?
I actually thought about it yesterday. It's definitely time for an update. So yes, I will make an update in the near future. This will be bug fixes and improvements (not new features).
 

mileco

Active member
I actually thought about it yesterday. It's definitely time for an update. So yes, I will make an update in the near future. This will be bug fixes and improvements (not new features).
Good news, then. Though it's a pity there won't be new features.
 

baardbi

Well-known member
Good news, then. Though it's a pity there won't be new features.
Yeah. I know. But after all, the most important thing is a stable base system. However, there's so much great stuff here on the forum, so there will definitely be new features in future updates when I find stable ways of implementing them. In january this year I started working on a modified MetroVania module with a shop system, including a shop editor so people don't have to modify code. But I forgot about it when Byte Off started. That module will be included when it's done. But my main focus is on making stable and bug free code.
 
It depends on what Solid reaction you have set for those monsters. I know I have a bug in the Explode reaction that could cause this. So you should probably do this anyway. In this file: \BASE_4_5_BBI\Game\MOD_MetroidVania\Subroutines\staticRoutines.asm make the following change:

Code:
explode:
    LDA Object_x_hi,x
    SEC
    SBC #4
    STA tempA
 
    LDA Object_y_hi,x
    SEC
    SBC #4
    STA tempB
 
    LDA Object_screen,x
    ADC #0
    STA tempC
 
    DestroyObject
 
    TXA ;;; ------------------------ Backup X register
    PHA ;;; ------------------------

    ;;; ------------------------ Change to OBJ_EXPLOSION
    CreateObjectOnScreen tempA, tempB, #OBJ_EXPLOSION, #0, tempC

    PLA ;;; ------------------------
    TAX ;;; ------------------------ Restore X register
 
    LDA #1
    STA shakeOn
 
    RTS

PS! I tried to color code the changes, but it didn't show up here, so I wrote comments with this instead ;;;------------------------- .
This didn't fix it, but did improve performance with explosions. I'd noticed a brief slowdown with those.

Still, you've pointed me in (hopefully) the right direction :)
 
Further update, @baardbi : the crash happens with all of the On Solid reactions.

My best guess is the crash is happening somewhere in the DrawSprites script. When the crash occurs, all of the sprites disappear except the player, who looks all jumbled up (screenshot attached).
 

Attachments

  • game_002.png
    game_002.png
    1.2 KB · Views: 4
Last edited:

baardbi

Well-known member
Further update, @baardbi : the crash happens with all of the On Solid reactions.

My best guess is the crash is happening somewhere in the DrawSprites script. When the crash occurs, all of the sprites disappear except the player, who looks all jumbled up (screenshot attached).
Can you post the Breakable tile code here? If it only happens with that tile, then it's pretty likely that there's a problem in the tile code. I don't think (but who knows) there's a problem with the drawSprites script in this case. A lot of crazy stuff can happen with sprites even if there's a problem elsewhere.
 

baardbi

Well-known member
breakable.gif

I made a quick test game to test this. I can't replicate this problem. The red tile in the above video is a Breakable tile. Two questions:

- Which module are you using? (I assumed you were using the MetroVania module)
- Do you have some custom code in your project related to tile collisions, solid reactions, handle objects or something like that?
 
View attachment 8454

I made a quick test game to test this. I can't replicate this problem. The red tile in the above video is a Breakable tile. Two questions:

- Which module are you using? (I assumed you were using the MetroVania module)
- Do you have some custom code in your project related to tile collisions, solid reactions, handle objects or something like that?
I'm using MetroidVania, but it's certainly possible one of my customizations could have impacted things. I'll dive deeper and get back to you.
 

mileco

Active member
@baardbi I'd like to know if enemy projectiles are enabled and ready to be used. If so, just by adding an AI behavior to the monster would be enough? I'm using your MetroVania Module.

Your own script will work, I guess. I'll paste it so you guys can have a look. Thanks in advance


How would I go about adding the ability for an enemy to shoot a projectile using the MetroidVania module? I dont recall seeing any tutorials on making enemies shoot.
Here's an AI script you can use for an Enemy Shoot action:

Code:
;;; Monster shoot

CountObjects #%00010000
CMP #2 ;Limit projectiles
BCC +doEnemyShoot
JMP +skipEnemyShoot
+doEnemyShoot

LDA Object_x_hi,x
CLC
ADC #4 ;Offset
STA tempA

LDA Object_screen,x
STA tempC

LDA Object_y_hi,x
CLC
ADC #4 ;Offset
STA tempB

LDA Object_direction,x
AND #%00000111
STA tempD

TXA
PHA

CreateObjectOnScreen tempA, tempB, #10, #0, tempC ;;; #10 is the game object used
;;; as an enemy projectile in
;;; this example.
;;; x, y, object, starting action.
;;; and now with that object, copy the player's
;;; direction and start it moving that way.

LDA tempD
STA Object_direction,x
TAY
LDA DirectionTableOrdered,y
STA temp1
STX temp
StartMoving temp, temp1

PLA
TAX

+skipEnemyShoot
 
I'm using MetroidVania, but it's certainly possible one of my customizations could have impacted things. I'll dive deeper and get back to you.
If you're still running into trouble id honestly reboot your project by starting over... you can still reimport your screens/maps this way too... then slowly add the features, input scripts, & any other scripts back one by one... then you'll find where the bug is
 
If you're still running into trouble id honestly reboot your project by starting over... you can still reimport your screens/maps this way too... then slowly add the features, input scripts, & any other scripts back one by one... then you'll find where the bug is
With something like this, I can design around it. I've already had to reboot once, would prefer to avoid that if possible.
 

baardbi

Well-known member
@baardbi I'd like to know if enemy projectiles are enabled and ready to be used. If so, just by adding an AI behavior to the monster would be enough? I'm using your MetroVania Module.

Your own script will work, I guess. I'll paste it so you guys can have a look. Thanks in advance



Here's an AI script you can use for an Enemy Shoot action:

Code:
;;; Monster shoot

CountObjects #%00010000
CMP #2 ;Limit projectiles
BCC +doEnemyShoot
JMP +skipEnemyShoot
+doEnemyShoot

LDA Object_x_hi,x
CLC
ADC #4 ;Offset
STA tempA

LDA Object_screen,x
STA tempC

LDA Object_y_hi,x
CLC
ADC #4 ;Offset
STA tempB

LDA Object_direction,x
AND #%00000111
STA tempD

TXA
PHA

CreateObjectOnScreen tempA, tempB, #10, #0, tempC ;;; #10 is the game object used
;;; as an enemy projectile in
;;; this example.
;;; x, y, object, starting action.
;;; and now with that object, copy the player's
;;; direction and start it moving that way.

LDA tempD
STA Object_direction,x
TAY
LDA DirectionTableOrdered,y
STA temp1
STX temp
StartMoving temp, temp1

PLA
TAX

+skipEnemyShoot
If you are using the BBI Modules, then you don't have to add it in. There is already an action called "ShootMonsterProjectile".
 

baardbi

Well-known member
I just updated the BBI modules to version 2.0.2. It's mostly bug fixes and refinements.

- Fixed some uses of CreateObjectOnScreen with TXA PHA PLA TAX
(This should fix a few bugs)

- Fixed GoToContinue
(This will fix End Action - GoToContinue when used with Checkpoint tiles)

- Removed recoil in LR_Platformer

Arcade Platformer:
- stopOnSolid: Moved ARCADE_PRIZE from script to USER_CONSTANTS

Brawler:
- Moved constants from attack1 and attack2 (input scripts) to USER_CONSTANTS

MetroVania:
- Moved staticRoutines from LoadAllSubRoutines to Script Defines (SCR_STATIC_ROUTINES)
- Moved fading from LoadAllSubRoutines to Script Defines (SCR_FADING)
 

mileco

Active member
I just updated the BBI modules to version 2.0.2. It's mostly bug fixes and refinements.

- Fixed some uses of CreateObjectOnScreen with TXA PHA PLA TAX
(This should fix a few bugs)

- Fixed GoToContinue
(This will fix End Action - GoToContinue when used with Checkpoint tiles)

- Removed recoil in LR_Platformer

Arcade Platformer:
- stopOnSolid: Moved ARCADE_PRIZE from script to USER_CONSTANTS

Brawler:
- Moved constants from attack1 and attack2 (input scripts) to USER_CONSTANTS

MetroVania:
- Moved staticRoutines from LoadAllSubRoutines to Script Defines (SCR_STATIC_ROUTINES)
- Moved fading from LoadAllSubRoutines to Script Defines (SCR_FADING)
Awesome contribution! Thanks once again.
 

dale_coop

Moderator
Staff member
I just updated the BBI modules to version 2.0.2. It's mostly bug fixes and refinements.

- Fixed some uses of CreateObjectOnScreen with TXA PHA PLA TAX
(This should fix a few bugs)

- Fixed GoToContinue
(This will fix End Action - GoToContinue when used with Checkpoint tiles)

- Removed recoil in LR_Platformer

Arcade Platformer:
- stopOnSolid: Moved ARCADE_PRIZE from script to USER_CONSTANTS

Brawler:
- Moved constants from attack1 and attack2 (input scripts) to USER_CONSTANTS

MetroVania:
- Moved staticRoutines from LoadAllSubRoutines to Script Defines (SCR_STATIC_ROUTINES)
- Moved fading from LoadAllSubRoutines to Script Defines (SCR_FADING)
Nice!
 

baardbi

Well-known member
I updated yet another version today (2.1.0). I forgot to add something yesterday. This time it's actually new features.

SwimmingGuy-ezgif.com-video-to-gif-converter.gif

- Added swimming to the MetroVania module
(See below how this works)

- Added fall animation to the MetroVania module
(the player automatically changes to the jump state when he's falling)

The biggest feature of these two is the reduced gravity. It could be used for both moon physics and swimming. To make levels with reduced gravity you only need to do two things: Click the checkbox for Reduced Gravity on the screens you want it on and make sure that Action Step 4 is a reduced gravity jump (it can of course be the same animation as the normal jump). The rest is handled in the physics script and the jump script. If you don't want to use this feature, then you don't have to do anything (you can just ignore this).

ReducedGravity.PNG

Swimming.PNG

ReducedConstant.PNG
If you want to adjust the reduced gravity you just change the User Constant called REDUCED_GRAVITY.

To see how this works you can just load the included MetroVania demo game.
 
Top Bottom