Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:35 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : picoflap

     Page 2 of 4    
Author Message
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 04:02pm 17 Jan 2024
Copy link to clipboard 
Print this post

there was no Problem, transfering the nul.spr via xmodem, just when copying it direct to sd with Windows ..
Edited 2024-01-18 02:02 by Martin H.
'no comment
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 05:59pm 18 Jan 2024
Copy link to clipboard 
Print this post

Hi Harm,
Very nice, :-) the only thing I've found is the bird can collide with the top of the bottom pillar, leaving a chunk missing, I assume the collision detection is only working for the top of the bird and not the bottom?
Otherwise great, as I've never played the original, I can't comment on it's authenticity.
Regards, Kevin.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4223
Posted: 08:14pm 18 Jan 2024
Copy link to clipboard 
Print this post

Hi Kevin,

Attached is a bug fix for your bug.

But more, this is a significant re-write, to work with graphics in flash slot and memory copies (not using sprite writes and sprite show anymore). This is a transition code towards the LCD version, It still uses SPRITE SCROLL though.

It is a full working PicoMiteVGA game.
This version uses folders, so it may need adaptation to work on the A: drive.

Unzip to B:
RUN "Flappy11.bas"

flappy11.zip

Volhout
P.S. the game is slightly easier, so you can easier get a medal, or even high score.
Edited 2024-01-19 06:20 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4223
Posted: 08:23pm 23 Jan 2024
Copy link to clipboard 
Print this post

Dear Geoff, Tom,

Please find attached version of the FlappyBird game for Game*Mite/LCD.

You operate the game with the UP key.
In case you set OPTION PLATFORM "Game*Mite" it should run using the UP key.
In the basic code I set "path$" to the path where the game resides.
It is defaulted to "B:/flappy11/" but in Game*Mite (when integrated) you must remove this define.

Keyboard control <space> bar is also possible.

There are a few PAUSE statements that may be quite long, but on my setup I needed them to wait for the SPI bus to become available before I can load files from SD card. They may be "tuned" to your setup and SD card speed.

The game requires a minimum OPION MODBUFF ENABLE 128, but since I already have 180k on my system for PETSCII, that should not be a problem.

Happy Gaming, and let me know if something needs further bug fixing or tuning.

Volhout

flappy11_game_mite.zip
PicomiteVGA PETSCII ROBOTS
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 08:51pm 23 Jan 2024
Copy link to clipboard 
Print this post

[18] If MM.Info(platform)="Game*Mite" Then init_gpio
'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4223
Posted: 09:29pm 23 Jan 2024
Copy link to clipboard 
Print this post

Hi Martin,

It should say : Mm.info$(platform)="Game*Mite"
No idea why this is in the zip.

I confirmed that it is correct in this ZIP.

Unzip to SD card
run "flappy11_game_mite.bas"

flappy11_game_mite_bf.zip

Volhout
Edited 2024-01-24 17:37 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 11:06am 24 Jan 2024
Copy link to clipboard 
Print this post

Hi Harm,

Looks like MMBasic is removing the $ itself! I can put it in, save the file, but when I go to edit it again, the $ has gone, however it doesn't seem to care.
One minor problem, you need the 'pullup' in the SetPin, once that is in, all working fine. :-)
 'set IO pin direction
Sub init_gpio
 SetPin gp10,din,pullup 'UP key
End Sub

Should I assuming this is still not as fast as the original, for testing purposes? as I said I never played the original, presumably it speeds up as you go further? or does it and I've never got that far? :-(
Lovely piece of coding.
Regards, Kevin.
Edited 2024-01-24 21:14 by Bleep
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 11:21am 24 Jan 2024
Copy link to clipboard 
Print this post

  Quote   I can put it in, save the file, but when I go to edit it again, the $ has gone,

Mm.info$( and Mm.info( use the same token.
Its the same as with Bitbang XXX and Device XXX, You can type Bitbang but you get Device.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4036
Posted: 11:32am 24 Jan 2024
Copy link to clipboard 
Print this post

Hi guys,

Unfortunately I'm not "playing" at the moment, other things to spend my time on (Baldur's Gate 3) or demanding my attention (work and family).

  Bleep said  Looks like MMBasic is removing the $ itself! I can put it in, save the file, but when I go to edit it again, the $ has gone, however it doesn't seem to care.


The PicoMite editor canonicalises keywords, so MM.INFO$ => MM.INFO, CAT => INC, etc. IIRC this is because it is reading the actual tokenised form out of the flash and these "different" keywords use the same token.

  Volhout said  In the basic code I set "path$" to the path where the game resides.
It is defaulted to "B:/flappy11/" but in Game*Mite (when integrated) you must remove this define.


The way I have handled this elsewhere without hard-coding is:
Const CURRENT_PATH$ = Choice(Mm.Info(Path) <> "NONE", Mm.Info(Path), Cwd$)


This will get the correct path if the program is started with RUN "<filename>" or you are in the program directory. IIRC it does not work when running from the editor (unless in the program directory).

  Volhout said  There are a few PAUSE statements that may be quite long, but on my setup I needed them to wait for the SPI bus to become available before I can load files from SD card. They may be "tuned" to your setup and SD card speed.


M'eh, C'est la vie, just need to find a value large enough for "everyone".

  Volhout said  The game requires a minimum OPION MODBUFF ENABLE 128, but since I already have 180k on my system for PETSCII, that should not be a problem.


The suggested setting for the Game*Mite (as of 1.2) is:
   
OPTION MODBUFF ENABLE 192


  Volhout said  Happy Gaming, and let me know if something needs further bug fixing or tuning.


Thanks Harm. May I add a copy to https://github.com/thwill1000/mmbasic-third-party ?

Best wishes,

Tom
Edited 2024-01-24 21:35 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4223
Posted: 11:53am 24 Jan 2024
Copy link to clipboard 
Print this post

  thwill said  
May I add a copy to https://github.com/thwill1000/mmbasic-third-party ?

Best wishes,

Tom


Sure Tom, please do so.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4223
Posted: 12:00pm 24 Jan 2024
Copy link to clipboard 
Print this post

  Bleep said  
Should I assuming this is still not as fast as the original, for testing purposes? as I said I never played the original.
Regards, Kevin.


The version FLAPPY11 uses a loop time (for single pixel scroll of L layer) of 50ms.
- the LCD version requires the full 50ms (the layer merge takes some time) at 252MHz.
- the VGA version requires only 16-32ms (32 when painting the new pipe, and waiting for frame sync)

So the games should play identical, where the VGA version wastes some time waiting every loop.

- The game does not speed up (the LCD version can't). Typically the game ends when player looses concentration.

- The game settings are now "easy". If you change the "-7" to "-8" in below line you have a much harder time to win a gold medal.

if k$=" " then play modsample wing,4:spr=5:v=-7  '-8 flaps down and you rise


Have Fun,

Volhout

P.S. the Game*Mite has pullup resistors on the board (at least on my board).
Edited 2024-01-24 22:03 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 12:22pm 24 Jan 2024
Copy link to clipboard 
Print this post

Hi Harm,
Ok great, thanks for the info.
I have found another problem with the hardware button input. It is extremely difficult to avoid a double tap, however briefly I press the button, can I suggest a way of holding off the button press for a short time?
For now I have done this, which seems to eliminate double taps, if you have a better way of implementing this, then great :-)

Slow down the keyboard scanning with a Pause 10
   Do
     tmp$=read_input$()
     If tmp$<>"" Then k$=tmp$  'keep last valid key
     Pause 10
   Loop Until Timer>h_beat


Have a delay after seeing a press, before triggering another press.
 Else
   If MM.Info(platform)="Game*Mite" Then
     If Pin(gp10)=0 And button_hold>5 Then read_input$=" ":button_hold=0 'if "UP" pressed then output <space>
     Inc button_hold
   EndIf

Hope this is of use.
Regards, Kevin.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4223
Posted: 12:44pm 24 Jan 2024
Copy link to clipboard 
Print this post

Hi Kevin,

Understand what you are doing, and when this works fine, I will adopt.
It has one disadvantage.
Since the Game*Mite loop requires almost full 50ms, the pause 10 will exceed the h_beat limit, thus after 1 scan of the GPIO the next loop will start (with button_hold=1).
The next loop the same, button_hold=2
etc...
until button_hold=6 (>5).

This means that the fastests click speed on the button will be 6 loops (around 300ms).
If this is sufficient to have fun with the game, that is fine. Try flying up from a low pipe to a high pipe, when that satisf(l)ies...fine.

Volhout

P.S. You are right about the pullup, I assembled pullups on my board (at J10), but that was not in the description Tom provided with the Game*Mite kit. Maybe that also explains why I did not experience the "key bounce" as you describe it.


flappy11_game_mite_bf2.zip
Edited 2024-01-25 00:36 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 02:48pm 24 Jan 2024
Copy link to clipboard 
Print this post

Hi Harm,
Yes I understand about the delays, I've realised I was using 378Mhz, however I do still get the key double tap a lot at 252Mhz.
I have tried increasing the screen Blit to step by 4 instead of 1, this still looks quite smooth, but allows for the h_beat to be increased significantly to give scope for faster scrolling on the LCD, if require.
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 04:31pm 24 Jan 2024
Copy link to clipboard 
Print this post

Hi Harm,
Here is a version with the screen scroll set to 4 pixels, I have obviously had to adjust some of the other variables to cope, but as a proof of concept, so you can see what it's like, it still looks quite smooth to me, how it would look on a VGA? I'm also unsure about the collision detection, now everything moves 4 pixels at a time?
Regards, Kevin.

flappy11_game_mite_x4.bas.zip
Edited 2024-01-25 02:33 by Bleep
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4036
Posted: 04:56pm 24 Jan 2024
Copy link to clipboard 
Print this post

Hi Harm,

I made time to look at flappy bird (the 1px scroll version) on the Game*Mite and I'm very impressed, I can see it becoming a favourite with my girls, well done!

   

Here are some suggestions (in addition to Kevin's) for you to consider:

   - Have any button except START/SELECT act as "flap"

   - Don't auto-repeat when a button is held down, always require that the button state goes from high to low. It looks like you could use the INTL flag with SETPIN and have the interrupt routine set a global flap% variable which is then cleared when you actually "flap".

   - Consider putting the sprite data as CSUBs in the .bas file instead of a separate ".bin" file. FLASH DISK LOAD is great and was necessary for PETSCII Robots) but you probably shouldn't use it unnecessarily because it increases flash wear.

Best wishes,

Tom
Edited 2024-01-25 02:57 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9110
Posted: 05:28pm 24 Jan 2024
Copy link to clipboard 
Print this post

I've got a massive optimisation of BLIT on framebuffers under development that I can slip into 5.08.00 - watch this space

Best case even number of pixels starting and ending on an even position
e.g.
BLIT 0,0,2,0,mm.hres-2,mm.vres
was 44mSec now <2mSec (320x240)

Everything else slower but still way better than the 44mSec
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 06:32pm 24 Jan 2024
Copy link to clipboard 
Print this post

Hi Peter,
That sounds amazing, :-) will give it a run as soon as you publish. Any chance that this optimisation will also help improve the Framebuffer merge? as I believe Harm thought that was taking a lot of the time, I'm not currently able to test that, but I suspect not as the merge also includes the time taken to send the data to the LCD?
Thanks for your continued support.
Regards Kevin.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9110
Posted: 06:35pm 24 Jan 2024
Copy link to clipboard 
Print this post

Try this

Will kill the A: drive and options

Worst case is about 8mSec for any blit in a framebuffer (320x240), best case about 1.2mSec


PicoMite.zip

This should also work for mode 2 in the PicoMiteVGA when I copy across

Framebuffer merge already has all the optimisations in this change
Edited 2024-01-25 04:37 by matherp
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 07:06pm 24 Jan 2024
Copy link to clipboard 
Print this post

Blimey Peter! my loop timer, for a step of 4 has now gone down from about 40mS to 3 or 4mS! I didn't initially believe it! Even Harms original step of 1 is only 8 to 10mS! So presumably the sweet spot for smoothness/time would be a step of 2. ;-)
Thanks again.
Regards Kevin.
 
     Page 2 of 4    
Print this page
© JAQ Software 2024