Jump to content
Karl G

Tiny Space Game

Recommended Posts

I'm not sure if this will be of interest to anyone besides myself, but I thought I'd post it just in case. This is my first completed stand-alone assembly game.

 

The original Space Game is a 32K game, and I filled almost all of that 32K. Because I was intrigued by the idea of making a game that would fit onto a standard QR code, and because I wanted to hone my assembly skills, I challenged myself to see what subset of Space Game I could fit into 2K. Since that's only 1/16th the original size, there was a lot that had to go off the bat: all of the cool music Maggie composed, special screens like the title screen, wave screens, etc., boss battles, mini-games between waves, etc.

 

Optimizing code and data to this level was an interesting exercise for me. I managed to fit in 9 of the 14 non-boss aliens along with all of their special abilities. Unfortunately, I wasn't able to fit in powerups!

 

I couldn't fit in a 6-digit score routine along with the graphics data for the digits, so I made a playfield-based scoring system where each alien group defeated scores one green bar, and if you get over 8 green bars they are exchanged for a red bar. If you have 8 green and red bars, then you win the game.

 

Anyway, here's the game along with the source in case anyone is interested in trying it / looking at it.

 

sg2k.bin

 

sg2k.asm

  • Like 13

Share this post


Link to post
Share on other sites

Hat off to you KarlG, that's damn impressive taking your 32k original (and rather good) Space Game and working a playable subset into 2k using assembly.

 

I'd love to have the time to learn assembly.

Edited by Muddyfunster
  • Like 1

Share this post


Link to post
Share on other sites

Fun! Having never playing the 32K version, I don't really have anything to compare it to. Not sure what the floaty dash thing is, but I've learned to not let it hit me. :-)

  • Like 1

Share this post


Link to post
Share on other sites

CONGRATULATIONS to Space Game 2K for being nominated in the 2019 Atari Homebrew Awards!

 

Be sure to vote for your favourite homebrew games of 2019 with the links below and watch the awards LIVE on February 1, 2020!

 

Awards Show: February 1, 2020 @ 12:00PM PT | 3PM ET | 8PM GMT LIVE on the ZeroPage Homebrew Twitch Channel!

 

Atari Homebrew Awards Categories (VOTE IN ALL!!):

image.png.bab6065e2177ab8f8f07a7ed7e19f9ac.pngimage.png.bc0c0cfa5f8102cfd389613df870d6c4.png

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

It has been brought to my attention that I had been miscalculating my free space, and I actually have 282 bytes free! I will have to decide how I want to fill that space, or I could be totally crazy and see if I can make a 1K version. 🙂

  • Like 2

Share this post


Link to post
Share on other sites

Now that voting is done, I wanted to share a minimalist title screen I was able to add.

 

 

sg2k.png

  • Like 7

Share this post


Link to post
Share on other sites
11 hours ago, Karl G said:

Now that voting is done, I wanted to share a minimalist title screen I was able to add.

 

 

sg2k.png

I reckon that would take about 200 bytes. You've still got plenty of room!
 

Edited by Andrew Davie
  • Haha 1

Share this post


Link to post
Share on other sites
18 minutes ago, Andrew Davie said:

I reckon that would take about 100 bytes. You've still got plenty of room!
6 distinct PF lines x 5 bytes/line = 30 bytes for the SG2K part. in a loop for multiple scanlines, so 2 for the index load + three colour loads @ 4 bytes/colour = 12 bytes = 42 bytes + a PF write for the top dot = 4 bytes, plus a few 0 writes to PF1 and 2, plus various timer/wsync code and screen on/off essentials and setup I'd say maybe 80 bytes would be possible. Giving you 100. So, you have nearly 200 free still. :) 

Uhh... I haven't done an optimizing pass on my new titlescreen yet, but I'm using more than twice that amount of space.

 

Karls-MBP:Downloads kdgarris$ assemble sg2k
 38 bytes free

 

Here's the titlescreen function. I use quad players for the letters for ease of positioning and color changes, and the playfield for the ship itself.  I reuse the 6-byte ship graphic from the game, and SG and 2K are new 6-byte graphics. Here's the titlescreen function in case you or anyone else wants to suggest more optimal code:

 

SubTitleScreen
    lda #$30
    sta CTRLPF
    lda #1
    sta GameState
    lda #7
    sta NUSIZ0
    sta NUSIZ1
    sta HMCLR
    ; position P0
    lda #32
    ldx #player0object
    jsr SetHorizPos
    ; position P1
    lda #64
    ldx #player1object
    jsr SetHorizPos
    ; position ballobject
    lda #109
    ldx #ballobject
    jsr SetHorizPos
    lda #$88
    sta COLUP0
    lda #$64
    sta COLUP1
    sta WSYNC
    sta HMOVE
TitleNextFrame
    VERTICAL_SYNC
    lda #44
    sta TIM64T
TitleWaitVBlank
    lda INTIM
    bne TitleWaitVBlank ; loop until timer expires
    sta WSYNC
    sta VBLANK
    ldx #54
    jsr SubBlankLines
    lda #2
    sta ENABL
    lda #$3F
    sta COLUPF
    ldx #8
    jsr SubBlankLines
    lda #0
    sta ENABL
    ldx #18
    jsr SubBlankLines
    lda #ship_color
    sta COLUPF
    ldx #ship_height-1
    lda #5
    sta Temp1
TitleLoop
    sta WSYNC               ; 3     (0)
    lda title_sg,x          ; 4     (4)
    sta GRP0                ; 3     (7)
    lda title_2k,x          ; 4     (11)
    sta GRP1                ; 3     (14)
    lda #0                  ; 2     (16)
    sta PF1                 ; 3     (19)
    lda ship_graphics,x     ; 4     (23*)
    sleep 12                ; 12    (35)
    sta PF1                 ; 3     (39)
    dec Temp1               ; 5     (44)
    bne TitleFiveLine       ; 3     (47)
    lda #5                  ; 2     (49)
    sta Temp1               ; 3     (52)
    dex                     ; 2     (54)
    bpl TitleLoop           ; 3     (57)
    jmp ____done_title
TitleFiveLine
    jmp TitleLoop   
    
____done_title
    ldy #0
    sty GRP0
    sty GRP1
    sty PF1
    
    ldx #80
    jsr SubBlankLines
    lda #36
    sta TIM64T
TitleWaitOS
    lda INTIM
    bne TitleWaitOS ; loop until timer expires
    lda #2
    sta VBLANK
    lda #bit0
    and SWCHB
    bne ____skip_title_reset
    jmp Reset
____skip_title_reset
    bit INPT4
    bmi ____skip_title_fire
    jmp Reset
____skip_title_fire
    jmp TitleNextFrame

 

I'll also attach the current source.

 

sg2k.asm

Share this post


Link to post
Share on other sites
11 hours ago, Karl G said:

Now that voting is done, I wanted to share a minimalist title screen I was able to add.

 

 

sg2k.png

I like it:thumbsup: I'd like to see this on cart and you could use the title screen for the cart label.

  • Like 1

Share this post


Link to post
Share on other sites
34 minutes ago, sramirez2008 said:

I like it:thumbsup: I'd like to see this on cart and you could use the title screen for the cart label.

Thanks. I'm unlikely to have carts made, but I'm okay if anyone else wants to for their own personal use. Wait a little bit, though, since I may well try to sneak a bit more into my remaining space.  🙂 

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites
8 hours ago, Karl G said:

Uhh... I haven't done an optimizing pass on my new titlescreen yet, but I'm using more than twice that amount of space.

 

Yeah, I got my comment/calcuations wrong and changed it within a minute or two, but you beat me and responded to the original :)

Still, the challenge is on!

 

  • Like 1

Share this post


Link to post
Share on other sites

76 free bytes after some modularization and looping. I am hoping to add a very short melody to the title screen (the new wave melody from regular Space Game). It's 56 bytes of music data, but the remaining 20 bytes isn't quite enough to implement a dual-channel music player. It seems within reach now, though.

 

sg2k.asm

  • Like 1

Share this post


Link to post
Share on other sites

Latest version displays the title screen, and plays the short opening melody. 1 byte left. I need to free up a bit more to be able to kill the sounds if the game is started when the music is playing in (or not start the game until the music is finished).

 

sg2k.asm

 

sg2k.bin

  • Like 2

Share this post


Link to post
Share on other sites

I spent some time clearing more space for code to clear sound channels upon game start or game over, only to realize that I already had this functionality built-into my function for updating sound channels. So, it looks like it's "done" with the title screen, opening melody, and 11 free bytes if I find I need them later.

 

Edit: 8 bytes left, but I eliminated the screen jump after title screen.

 

 

sg2k.asm

 

sg2k.bin

 

  • Like 6
  • Thanks 1

Share this post


Link to post
Share on other sites
Posted (edited)

We'll be checking out Space Game 2K on tomorrow's (Tue Aug 4) ZeroPage Homebrew stream LIVE on Twitch at 11AM PT | 2PM ET | 6PM GMT! Hope everyone can watch!

 

Games:

 

 (SET VIDEO TO 1080P60 FOR FULL QUALITY)

 

 

 

Edited by ZeroPage Homebrew
  • Like 2

Share this post


Link to post
Share on other sites

Really like this game. Look forward to seeing it.👍

 

@Karl G Heard it mentioned on ZPH that

  • You may add more to this game
  • Unlikely to release this on cart
  • Give your permission for others to make carts

 

Thank you for giving permission, as I would love to have this on an actual cart. I think this is a great, pick up and play, pure shooter and I prefer to pop-in a cart and play it on actual hardware if possible. Having just said all of this, please consider releasing a cart. IMO you've squeezed a great amount of gameplay out of 2K and deserve to be rewarded for your time/effort. Btw, I thought I would really miss the power-ups, but I don't and that speaks to the level of gameplay that is retained in this version. Love the ship and enemy sprites too.

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks @sramirez2008! I did this as a coding exercise, and I'm glad people like it, but I really don't want to make carts. Feel free to do so if you want one, and maybe put a pic of the cart in this topic! It would be cool to see one in use. 

  • Like 3

Share this post


Link to post
Share on other sites
On 8/7/2020 at 3:04 PM, Karl G said:

Thanks @sramirez2008! I did this as a coding exercise, and I'm glad people like it, but I really don't want to make carts. Feel free to do so if you want one, and maybe put a pic of the cart in this topic! It would be cool to see one in use. 

As promised, below are a few pics of my custom SG2K cart.

 

@Karl G thank you for providing your permission to make a cart and thanks to @Albert for manufacturing the cart. This will always remain in my collection.🙂

FT_SG2K.jpg

 

Main_SG2K.jpg

 

BegGame_SG2K.jpg

 

GameOver_SG2K.jpg

 

2600_SG2K.jpg

  • Like 6

Share this post


Link to post
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.

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...