Jump to content
IGNORED

My 7800 Vertical Shooter - Heofonfīr


Recommended Posts

Time for another update, but this time, I have implemented @mksmith's Read Controller routines. However, I still need to rewrite my shooting routine.

The current one:

    if joy0up && joyposup=-2 then gosub SetBulletHome
    if joy0down && joyposdown=-2 then gosub SetBulletHome
    if joy0up && joyposleft=-2 then gosub SetBulletHome
    if joy0down && joyposright=-2 then gosub SetBulletHome
    if joy0up && joyposup=-2 then gosub SetLaserHome
    if joy0down && joyposdown=-2 then gosub SetLaserHome
    if joy0up && joyposleft=-2 then gosub SetLaserHome
    if joy0down && joyposright=-2 then gosub SetLaserHome
    if joy0up then playerY=playerY-1:joyposup=1:joyposdown=0:joyposleft=0:joyposright=0
    if joy0down then playerY=playerY+1:joyposup=0:joyposdown=1:joyposleft=0:joyposright=0
    if joy0left then playerX=playerX-1:joyposup=0:joyposdown=0:joyposleft=1:joyposright=0
    if joy0right then playerX=playerX+1:joyposup=0:joyposdown=0:joyposleft=0:joyposright=1
    if joy0fire && joyposup=1 then bulletY=bulletY-5 : playsfx sfx_pulsecannon
    if joy0fire && joyposdown=1 then bulletY=bulletY-5 : playsfx sfx_pulsecannon
    if joy0fire && joyposleft=1 then bulletY=bulletY-5 : playsfx sfx_pulsecannon
    if joy0fire && joyposright=1 then bulletY=bulletY-5 : playsfx sfx_pulsecannon
    if !joy0fire then bulletX=playerX+2:bulletY=playerY-8 

As it currently stands, upon pressing the button, it heads back to the front of the ship. When held, it loops across the screen. I have also run into a sound effect bug.

New_VerticalShooter_Test_controller_check.78b.a78 New_VerticalShooter_Test_controller_check.78b.bin Vertical Shooter 1-23-2021.zip

Update: Now I get a ROM that crashes when I use the current code, and errors when I switch to the new routines.

To be succinct, I am baffled as to how to fix it.

New_VerticalShooter_Test_controller_check.78b

Edited by SlidellMan
Bug problem.
  • Like 3
Link to comment
Share on other sites

I'm currently rewriting my source file. In case anyone is wondering, I based the firing routine off of the one in the 7800Basic manual.

 

Update: Now I'm getting an assembly error.

--- Unresolved Symbol List
BREAKPROTECTOFF          0000 ????         (R )
player                   0000 ????         (R )
 
   stack allowance: 30 nested subroutines.
   the canary is situated at: $1c1
   28631 bytes of ROM space left in the main area.
             514 bytes of ROM space left in DMA hole 0.
             581 bytes of ROM space left in DMA hole 1.
             395 bytes of ROM space left in DMA hole 2.
     $1880 to $1fff used as zone memory, allowing 15 display objects per zone.
     2310 bytes left in the 7800basic reserved area.
 
Fatal assembly error: Source is not resolvable.
Edited by SlidellMan
Assembly Error.
Link to comment
Share on other sites

Your title screen loop doesn't have a gosub ReadController, which prevents it from actually checking to see if the player presses a button to start the game. After adding that (To the Rewrite source) the game would at least advance and start - but then it immediately freezes after making a sound. Not entirely sure where it's freezing although you'll probably recognize the sound that's played - use that as a hint to which lines the code is reaching and freezing at some point after it.  Could help you trace the code's logic. :)

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

Well gave it try, things kind of bunch up into the bottom right corner but I guess it's still early coding at this stage. Keep at it, been thinking of trying some Basic myself this year. ?

 

I like the shapes and different sizes in the sprites. Heard of Baroque but didn't know there was a shooter based on it, cool.

  • Thanks 1
Link to comment
Share on other sites

Just to let people know that I am implementing Mord's aiming routine in my engine. Truth be told, that random bullet movement that was based off what was in the 7800basic manual was way too simplistic and erratic for this. Expect the source and binary to be posted when I am done writing and compiling. I also switched the ROM size from 48k to 128k.

Vertical Shooter 2-15-2021.zip New_Vertical_Shooter_Rewrite2.78b

Edited by SlidellMan
Now with source.
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I decided to do another rewrite of the engine again, and now running into space overflow. In case anyone is wondering, I went with 128k this time in the hopes that would fix it.

 

Update: It didn't, and I have included the source file for anyone can figure out what I am doing wrong.

Vertical Shooter 3-2-2021.zip

Edited by SlidellMan
Now with source.
Link to comment
Share on other sites

2 hours ago, SlidellMan said:

I decided to do another rewrite of the engine again, and now running into space overflow. In case anyone is wondering, I went with 128k this time in the hopes that would fix it.

 

Update: It didn't, and I have included the source file for anyone can figure out what I am doing wrong.

Vertical Shooter 3-2-2021.zip 20.68 kB · 0 downloads

I took a quick look, some observations :

 

Moving to a 128kb format means you have 8 x 16kb banks not a single block of 128k so you have to work within the banking structure. Right now you are trying to stuff everything into bank 1.

 

You are setting your rom to 128KBankRam. You don't need that unless you are planning to use multiple banks of additional RAM. Try using 128kRAM

 

Part of the problem that I see here is that you are using "newblock" too much. Every time you use "newblock" you are telling 7800basic to shut the current graphics block off and start a new one. That means it tries to reserve more rom for graphics and there is only so much rom in each bank (16kb).

 

By removing all of the newblock entries, you are no longer running out of space but there are other compile issues :

 

You are dimming " playerFlag twice (line 17 and line 28). That's causing a conflict as you are trying to give two separate variables the same name.

 

Beyond that I'd need to look at the code in more detail as it still doesn't compile.

 

 

  • Like 1
Link to comment
Share on other sites

I disabled the newblock commands and the DMA holes for the time being, and here's the proof. Next course of action: how to fix the sound effect problems, rewrite the shooting, and what else needs to be done. Oh, and Muddy, thanks for help pointing out what I didn't even notice.

New_Vertical_Shooter_Rewrite3.78b.a78 New_Vertical_Shooter_Rewrite3.78b.bin New_Vertical_Shooter_Rewrite3.78b.list.txt

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
On 3/6/2021 at 3:30 PM, SlidellMan said:

Now, with @SmittyB's random enemy generator. As always, you guys are free to look at the code and point out any mistakes that I have made.New_Vertical_Shooter_Rewrite3.78b.a78

I tried this on JS7800 - your ship seems to move and shoot okay but not sure what else is going on.  The "X" ships just flash all over, and there's a letter R (or P - powerup?) floating around. Taking a screen snip, it seems like there's only one X at a time but hard to tell.  The enemy ship moving horizontally seems to work.  Not sure if that's the expected state while you figure out the player ship movement, but figured I'd mention it.

Edited by BydoEmpire
  • Thanks 1
Link to comment
Share on other sites

At a glance you might want to look at the enemy shot code - the code was originally developed to allow up to 15 shots to be fired at the same time - enemyShotX and enemyShotY for instance are suppose to be arrays.  However it's only declared as one variable/byte so when you run through the aiming code it's looking at and rewriting the variables next to it and likely causing a lot of havoc. That might be why things are running all over the place.

 

If there's only going to be one enemy shot at a time ever and it's always going to use those same variables, you can rewrite the aim code to get rid of the Z loop and change all the references of enemyShotX[Z] into just enemyShotX, for example. (As well as any other references to [Z] of course!)  If Z is also declared as an actual variable in your code elsewhere, then that code is definitely overwriting that as it uses the Z variable for it's own countdown.

 

Typically when I code I end up leaving the last few variables of the alphabet (w, x, y, and z) to be used in localized loops like this.

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...
1 hour ago, SlidellMan said:

Some observations :

 

It's flickering like crazy and your logo is being cut short.

 

You can fix this a couple of ways.

 

Firstly the flickering, you have a restore screen call followed immediately by a drawscreen, but you aren't restoring anything. You also have your sprite plots after the drawscreen.

 

Change your main loop to this gets rid of the flickering.

_mainloop
    clearscreen
    plotsprite heofonfir_logo_h 0 9 2
    plotsprite heofonfir_logo_e 0 26 2
    plotsprite heofonfir_logo_o 0 42 2
    plotsprite heofonfir_logo_f 0 58 2
    plotsprite heofonfir_logo_o 0 74 2
    plotsprite heofonfir_logo_n 0 90 2
    plotsprite heofonfir_logo_f 0 107 2
    plotsprite heofonfir_logo_i 0 123 2
    plotsprite heofonfir_logo_r 0 137 2
    drawscreen
;   if joy0fire then clearscreen : savescreen : goto main
    goto _mainloop

A better way would be to plot the sprites and then savescreen with a restorescreen in the main loop to draw everything. I've added your file with that structure edited in as well as the sprites moved from Y pos 2 to Y pos 0

 

Second problem is your graphics are being cut off.

 

There are a bunch of ways you can adjust things here to fix the cut off.

 

First way I think the fundamental problem is that you are running out of display ram as you are plotting a lot of big sprites. If you add :set extradlmemory on, at the start where you set the rom size etc, it will give you a little more DL RAM from the $2200 location. (linky) This means your graphics will be fully drawn.

 

The second way to try and fix this is to plot fewer sprites. instead of plotting 9 sprites, with a sprite for each letter, maybe combine them in to groups 3 letters. They you are making 3 plots instead of 9. - I haven't tested this in your code as you would need to re-do your sprites/banners, but this should work.

 

Third way is to look at your sprite positions, right now you are plotting a 16 pixel high sprite on Y axis position of 2. That means each sprite is straddling 3 zones (your zones are 8 px high). Change the Y position to a multiple of your zone height and it draws fine without needing the fix #1

 

Fourth way is to change your zone height to 16, this maybe the least desirable fix, especially if the rest of your game is built around a zone height of 8. Changing to 16 fixes it.

 

 

Title_Screen_demo2.78b

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...