Jump to content
IGNORED

Uncancelled: Fruit Fly Fun (Atari 2600)


Recommended Posts

I guess I should have posted about the game here. I had a thread in the Homebrew Games subforum, but I guess many people missed it. So here it is again.

 

Fruit Fly Fun is a game where you swat flies that are trying to eat your banana, and avoid hornets and bees which come after you. I would like to keep this at 2k. I have six bytes left, so not much else can be done unless I would change something I already have.

 

fly17_dbg_483b8bef.png.9186d59958010317a38b445cb32c41f5.png

Please play the game and let me know what you think.

fly20.bin

  • Like 1
Link to comment
Share on other sites

Just tried it, very satisfying to swat the flies. I really like those fly animations and I like seeing a 2K game with lots of color.

I really want a way to fight the hornets and bees.. or maybe an enemy like an ant that crawls on the ground... or even a double size fly I have to swat twice..

...but those 6 bytes in a 2k game... so much easier to go 4k but would be so much cooler to stay 2k...

I don't mean to pry but my "scan for ways to get more bytes" OCD is triggered because I just went through one of my own projects that is running into the 4k barrier... way easier than 2k..

  • The font looks like it might be big. But it's really good looking. But it's big...
  • I see maybe a few places where there *might* be chance for simple code size optimization - things like, if I did a load, I know it sets comparison registers so i can avoid a cmp #0 and get a couple bytes back - but if the changes I want to make need that to be a cmp #1...
  • These jsr sequences differ by one jsr... if you were willing to intermix the two routines you could put the label for F959 at F943 and they'd act the same... 22 bytes isn't a ton but maybe enough to make a double size fly?
    • and then there's... depending on if they aren't called more than once... if you can just inline the code being jsr'ed you save a few bytes + not having to jsr and rts back... 


image.thumb.png.c68111740ca0d0b4aa3499378f8b5996.png

 

Link to comment
Share on other sites

Just went through the code and there really isn't much I could do for optimization. I really don't want to break what I have. I did fix a small bug pertaining to the bee's speed. He went a little faster when he was moving right as opposed to left. I think I fixed that. I also fixed the number "8" in the score because I hated the way it looked. 11 bytes free.

I removed the obscenities from the code (when I get angry with the way things go, I swear like a drunken sailor) cleaned it up, and posted it here for viewing.

fly21_dbg_5d2e4065.png.9b7811611bee16e5e9a8e7481ff4fb12.png

fly21.bin fly21.asm

Link to comment
Share on other sites

There are actually TONS of optimizations possible.  I bet I could re-structure and optimize this code and save at least 256 bytes, probably more.  But I don't have the spare time to work on it.  @Dave C mentioned some of them above.  Things like:

 

SoundEffect        
    lda SFXTimer
    cmp #0                        ; this is completely unneeded, LDA affects Z flag
    beq Silent_Channel_00

 

New_fly_Angerer_22
    lda #10
    sta FlyBonusTimerSec
    
    lda #10                      ; unneeded, ACC already contains #10 from right above
    sta OverscanValue 

 

And so many more.  Optimizing 6502 to save every single bit and byte is like a "hobby" of mine, LOL.  But you have to know them to implement them.  Might be a good topic for a post of it's own really.  

 

It would probably serve you well to study some disassembles of other games to see some different approaches / design patterns.  Or do a disassembly from scratch.  It's a really good way to learn the machine better.  I've disassembled about 10 different games, some of them for my 8-bit ports, and I learned more from doing that than I have from anything I've ever read...

 

  • Like 2
Link to comment
Share on other sites

cool I definitely like the addition.

I do have a few more thoughts - just my 2c 

  • most important - I think the game should always start with flies (or at least the first game).
  • less important - big flies sooner - maybe every 100? and take lots of hits kind of like fighting a boss, then a speed jump. but that might just be me being bad at the game and having a hard time getting to 200. 
  • bonus - if hornet/bee just flies in and tries to keep me from banana - that would actually be a way to be extra aggravating (harder to get to the next flies)
Link to comment
Share on other sites

ZeroPage Homebrew is playing Fruit Fly Fun on tomorrow's ZPH stream LIVE on Twitch, hope you can join us!

 

Games:

 WATCH AT 1080P60 FOR BEST QUALITY

 

 

  • Like 1
Link to comment
Share on other sites

On 7/21/2023 at 12:00 AM, atari2600land said:

I give up. Here is the code for the game. Feel free to ask questions about it if you have any.

 

fly29.asm 29.52 kB · 16 downloads

I wasn't able to reproduce the frame jump when I tried, even when swatting near the banana. Is there a reliable way to reproduce this issue? 

Link to comment
Share on other sites

18 hours ago, Karl G said:

I wasn't able to reproduce the frame jump when I tried, even when swatting near the banana. Is there a reliable way to reproduce this issue? 

 

I did notice it at least once during my stream of the game. I remember one of them occurred with a big fly on the right hand side of the screen. It happened very seldom so it's possible you may play for quite a while without seeing it.

 

- James

 

EDIT: FOUND THE FRAME JUMP, it's at 1:55:46 and I even mention it during the stream. It just as I remembered, it's when the big fly comes in on the right hand side and takes a bite of the banana.

 

 

  • Like 2
Link to comment
Share on other sites

7 hours ago, Karl G said:

I wasn't able to reproduce the frame jump when I tried, even when swatting near the banana. Is there a reliable way to reproduce this issue? 

I didn't notice it either. A tip I learned from the forums, Stella (maybe other emulators) lets you set a trap on number of scanlines, makes this kind of thing way easier to debug.

Link to comment
Share on other sites

On 7/23/2023 at 6:14 PM, ZeroPage Homebrew said:

EDIT: FOUND THE FRAME JUMP, it's at 1:55:46 and I even mention it during the stream. It just as I remembered, it's when the big fly comes in on the right hand side and takes a bite of the banana.


First off - I can't tell if this whole quitting thing is just normal frustration - which - we all have, or hyperbole, or something darker. If this is something other than just normal coding frustration - honestly take a break.

But when it's time to pick things back up..

On fly27.bin, I was able to repro after hacking the score (to speed up the process)

  • There is variable for $82 = OverscanValue that controls a loop that waits through the overscan period. It normally has the value 10, gets written with a value of 15 for just one frame and that causes the wait to take one more scan line (using the timer)
  • I haven't read enough of the code to know what different overscan values compensate for - and counting the cycles is not fun (I do it though...). I also can't repro on fly29.asm. 

Tbh I'm not sure about the advice I'd give here. As far as I can tell the overscan loop gets hit in exactly the same scan line at the same cycle every frame - correction: the overscan loop appears to be hit on the same scanline every frame +/- a few cycles. If it's always the same scanline the good news would be the overscan doesn't need the variable timer, it can just skip a constant number of lines - which would save on modifying the overscan var and checking the timer. 

Edited by Dave C
  • Like 4
Link to comment
Share on other sites

On 7/23/2023 at 10:52 PM, Dave C said:

I didn't notice it either. A tip I learned from the forums, Stella (maybe other emulators) lets you set a trap on number of scanlines, makes this kind of thing way easier to debug.

Just wanna offer up, this is what I use to catch some errors. You can key this in to Stella or put it into a file like ~/Grizzards.NTSC.script (or ~/fly29.script or so) to have it auto-loaded.

 

The first line, stops whenever the frame finishes with less than 262 lines (NTSC) — which can only be detected when the first line of the new frame is produced, but then you can use the "rewind" feature in Stella to walk through the offending frame (or set a breakpoint, or whatever)

The second catches overruns when they occur.

The third, catches if the stack pointer falls below your top of ZP — so, if you have vars at $80 … $ef you can set it to $f0 like this to catch stack overflows/overwriting actual values.

The fourth, I use $f000 as my base address, catches any time that the program jumps into another area of memory, since my code will never do that intentionally.

 

breakIf { _scanEnd < #262 && _scan == 0 && _fCount > 1 }
breakIf { _scan > #262 }
breakIf { sp < $f0 }
breakIf { pc < $f000 }

 

Hope that helps a bit.

  • Like 3
Link to comment
Share on other sites

  • 3 months later...

I'm back. I decided to attempt to do this in batari Basic in the hopes that it would help with the scanline issue I was having. I had to get rid of the banana since I have no way of drawing it this way, so I think I'll just call the game Flies! if this goes anywhere.

fly1.bin

  • Like 3
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...