Flight Minigames (canceled)

Moderator: Moderators

JRoatch
Formerly 43110
Posts: 388
Joined: Wed Feb 05, 2014 7:01 am
Location: us-east
Contact:

Flight Minigames (canceled)

Post by JRoatch » Mon Mar 31, 2014 1:11 pm

Update: Unfortunately I've stopped working on this game. Attached is the last version of the source.

Looking for a NES version of Flappy Bird?
Flappy Block from Sly Dog Studios
Family Bird from sayonari
"flappy.nes" from Nioreh

----
Flight Minigames is intended to be a collection of 8 6 similar "one button games" for the multicart project where you control the vertical movement of the sprite to avoid obstacles approaching horizontally. Planned modes include clones of the mechanics of The Helicopter Game, Balloon Fight and Flappy Bird.

The most important lesson I learned during competition period is that gradual air resistance feels much better then speed caps. Also fixed point numbers with more then Q16.16 precision is overkill.

I'm not sure what lesson I learned for v0.2, maybe that system stack can be used for saving bytes in ROM.

List of things needed to be done has been moved into a TODO.txt file.
Attachments
2014-05-29_flight-minigames-v0.2.zip
Flight Minigames v0.2 source
(70.6 KiB) Downloaded 745 times
Last edited by JRoatch on Wed Aug 06, 2014 1:36 pm, edited 5 times in total.

tepples
Posts: 21750
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Flight Minigames

Post by tepples » Mon Mar 31, 2014 2:06 pm

Balloon Fight uses a denominator of 256 (8 subpixel bits) for positions and velocities.

JRoatch
Formerly 43110
Posts: 388
Joined: Wed Feb 05, 2014 7:01 am
Location: us-east
Contact:

Re: Flight Minigames

Post by JRoatch » Mon Mar 31, 2014 2:41 pm

Right, G in Balloon Fight is $00.06 per ntsc frame (about 84.7px/s^2) with a speed cap of about 75.1px/s.

I'm not sure exactly what's going on with the upward thrust, but looks like it either adds (on top of G) $00.12 per frame or $00.78 for a single flap.

If only I was able to watch ram values for flappy bird.

JRoatch
Formerly 43110
Posts: 388
Joined: Wed Feb 05, 2014 7:01 am
Location: us-east
Contact:

Re: Flight Minigames

Post by JRoatch » Fri Apr 18, 2014 8:35 pm

It's been awhile since I last posted but I got somebody with a copy of flappy bird on a rooted tablet to let me screen record some gameplay.

After a bit of video frame slicing and counting pixels I came up with these numbers. Unlike other prior work by Frank Noschese, I'm setting the width of the bird (from tail to beak) to 1 meter.

Bird width: 1 m (reference meter)
Field height: 10.7872 m
Gravity: 29.9426 m/s^2
Speed after flap: 8.6320 m/s
Speed cap: 14.0957 m/s
Horizontal scroll: 3.5493 m/s

Reading the linked article again, I somehow totally missed the video downloads before doing the experiments myself.

User avatar
NESHomebrew
Formerly WhatULive4
Posts: 393
Joined: Fri Oct 30, 2009 4:43 am
Contact:

Re: Flight Minigames

Post by NESHomebrew » Sat Apr 26, 2014 8:50 am

Do you have the most recent build? I think the one you linked too might be an older version.

JRoatch
Formerly 43110
Posts: 388
Joined: Wed Feb 05, 2014 7:01 am
Location: us-east
Contact:

Re: Flight Minigames

Post by JRoatch » Sat Apr 26, 2014 12:11 pm

The most recent published build is v0.1. Sorry if being under "Older versions" and with a label of "incomplete" is confusing. It should match the version I sent you last in email as they both should have a md5sum of 3f0d3ca924f8c1e2bcd20d1c7a2ca144.

The progress of v0.2 (with 2 complete games) has been slow.

User avatar
NESHomebrew
Formerly WhatULive4
Posts: 393
Joined: Fri Oct 30, 2009 4:43 am
Contact:

Re: Flight Minigames

Post by NESHomebrew » Sat Apr 26, 2014 2:55 pm

Ok, I just can't get to a menu like it shows in your screenshot at the top. I'm just trying to get some screenshots for the website.

JRoatch
Formerly 43110
Posts: 388
Joined: Wed Feb 05, 2014 7:01 am
Location: us-east
Contact:

Re: Flight Minigames

Post by JRoatch » Thu May 08, 2014 9:09 am

I pretty much did nothing in the month of April, and it seems like the only thing I did this week was rewrite the core adder and converted all fixed point numbers from a 6 byte 16.32 format to a 4 byte 9.23 format.

I want to ask for help, but it's hard to formulate how or what one can help with.

Also this is probably the one piece of code that the cpu will spend a good bulk of it's time on.

Code: Select all

;;
; multi purpose multi byte operation
; [API sniped but will be described in full source]
bignum_op:
-
  lda (temp+0), y
  eor temp+5    ; a value of $ff will make this a subtraction
  adc (temp+2), y
  sta (temp+0), y
  iny
  dec temp+4
  bne -
  rts

User avatar
Movax12
Posts: 522
Joined: Sun Jan 02, 2011 11:50 am

Re: Flight Minigames

Post by Movax12 » Thu May 08, 2014 10:40 am

I think I am understanding your code. Maybe a bit faster, assuming temp+5 is either 0 or FFh

Code: Select all

  
  ; is it negative?
  bit temp+5
  bpl positive
  ; negative:
  sec 
  ldx temp+4
-
  lda (temp+0), y
  sbc (temp+2), y
  sta (temp+0), y
  iny
  dex
  bne -
  beq exit
positive:
  clc
  ldx temp+4
-
  lda (temp+0), y
  adc  (temp+2), y
  sta (temp+0), y
  iny
  dex
  bne -
exit:
  rts
Store x back to temp+4 if needed.

JRoatch
Formerly 43110
Posts: 388
Joined: Wed Feb 05, 2014 7:01 am
Location: us-east
Contact:

Re: Flight Minigames

Post by JRoatch » Thu May 08, 2014 10:52 am

I attempting to go the extreme side of the size/speed trade off, aiming for small size. So I thought it was cool when I saw a way to pack addition and subtraction in the same subroutine loop, and with the same loop I'm clearing bytes of memory, which would allow for copying bytes and negating.

Maybe I just need to stop spending all my time on size optimization...

User avatar
Movax12
Posts: 522
Joined: Sun Jan 02, 2011 11:50 am

Re: Flight Minigames

Post by Movax12 » Thu May 08, 2014 11:26 am

Unless you are approaching the limits of your chosen mapper, personally wouldn't worry too much about size, unless that is part of the challenge. Even if you need some simple bankswitching, it's 2014; memory is relatively cheap. Also, regarding that routine - if your values are going to be multiples of two bytes always, you could partially unroll it into two lda/adc/sta steps.

Edit: Maybe ignore that last part about unrolling more, may not work with this code.

JRoatch
Formerly 43110
Posts: 388
Joined: Wed Feb 05, 2014 7:01 am
Location: us-east
Contact:

Re: Flight Minigames

Post by JRoatch » Thu May 08, 2014 1:59 pm

One thing I know I will have difficulty with, and have yet to address, is sound engine and musical composition.

My first thought was to use famitone2 and place the entire famitone page in zeropage to reduce the opcode size (my target ROM size is 4 or 8 KiB). I also though about somehow using temple's sound engine, but I'm not clear about the pros and cons of each. In any-case I've got 128 zeropage bytes reserved for sound, and I hope I can get the music code and data to fit in the 2.5KiB ROM space left.

Then of course I believe I lack the musical composition skills anyway.

tepples
Posts: 21750
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Flight Minigames

Post by tepples » Thu May 08, 2014 4:27 pm

My sound engine should comfortably fit into your ZP budget, and as for ROM, this 3.8K NSF containing the entire soundtrack of Concentration Room, Thwaite, Zap Ruder, and an old falling block game should show how ROM-efficient it can get while delivering competent triangle drums and semi-pitched hi-hats. If you want, I can package it with a manual, and I might even have time to compose some happy flappy tunes for you.

JRoatch
Formerly 43110
Posts: 388
Joined: Wed Feb 05, 2014 7:01 am
Location: us-east
Contact:

Re: Flight Minigames

Post by JRoatch » Thu May 08, 2014 5:28 pm

A package with a manual would be nice, even if I ultimately don't use it. Just don't end up using up too much time meant for RHDE.

JRoatch
Formerly 43110
Posts: 388
Joined: Wed Feb 05, 2014 7:01 am
Location: us-east
Contact:

Re: Flight Minigames

Post by JRoatch » Wed May 21, 2014 2:04 pm

So famitone2 may not be ideal to stuff entirely into zeropage. I just counted, according to the var definitions, the number of RAM bytes used for music and one sound effect stream. It's 140 bytes.
I don't know how the sound effect data is formated, but I think it's like a raw list of APU commands or something.

I think should start looking into tepples sound engine. I believe it's pretty much music.s sound.s and musicseq.* in RHDE.

I do like the 64 note range of famitone2 and my edit that allows different tempo and pitch setups. I'm hoping that would be easy to port over those features.

Post Reply