Jump to content

Photo

FlappyBird test


334 replies to this topic

#26 tonma OFFLINE  

tonma

    Chopper Commander

  • Topic Starter
  • 142 posts

Posted Fri Dec 9, 2016 4:14 AM

Are you sure that you filter out the VBL interrupts only? It sounds like you would also use the sound interrupts. The sound interrupts at a much higher rate.

The default VBL is 75Hz but you can also ask for 60 or 50Hz.

I'm not sure at all :-D

 

I tried with my own code and with your pong source code with the same result.

 

I try to add into the main.c without success :

  joy_install(&lynx_stdjoy);
  tgi_install(&lynx_160_102_16);
  tgi_init();
  tgi_setcollisiondetection(1);
  tgi_setframerate(50);
  lynx_snd_init();
  CLI();

In the loop of the game, I use something like this. I've maybe misunderstood something :

void play()
{
	unsigned char joy;
	
	....
	....
	
	while (home==0) {
	//while (1) {
   	 
		if (!tgi_busy())
		{
		
			tgi_clear();		
			joy = joy_read(JOY_1);
			
			...
			
			//flip buffer vram
			tgi_updatedisplay();
		}
	}
}

I tried to keep reference from the tutorial "Part 3 Analyzing hello world". The tgi_updatedisplay wait for vbl.



#27 Level42 OFFLINE  

Level42

    River Patroller

  • 2,602 posts
  • Location:Ridderkerk, The Netherlands

Posted Fri Dec 9, 2016 2:15 PM

Thank you very much for testing on a real hardware.The speed is bizarre, I use the vblank of the tgi which must have a constant framerate by default.
I worked on music this week. Hum hum just bep bep sounds. When I add music, the game is much faster, unplayably fast. Amazing, normally playing music should slow down !!! Because it takes resources. :?


I could make a video of it running on the Lynx I as a reference if you'd like...

Edited by Level42, Fri Dec 9, 2016 2:15 PM.


#28 Trew OFFLINE  

Trew

    Chopper Commander

  • 246 posts

Posted Fri Dec 9, 2016 2:49 PM

Results from my Lynx 2.

 

When I tested the landscape version, I have to tap the button incredibly fast just to keep steady, and basically can't fly higher or lower.

 

On the portrait version it feels like the bird is being pulled down too by too much gravity. The collisions don't work (it just flies past pipes) and if you let go, the bird drops off the bottom of the screen and appears at the top again/repeat like it's falling through a portal.

 

(Just feedback in case handy).

 

Also, Level42, don't you have the crazy lynx that you can alter the clock speed on? Did you leave it all the way up :P



#29 Level42 OFFLINE  

Level42

    River Patroller

  • 2,602 posts
  • Location:Ridderkerk, The Netherlands

Posted Fri Dec 9, 2016 3:15 PM



#30 Level42 OFFLINE  

Level42

    River Patroller

  • 2,602 posts
  • Location:Ridderkerk, The Netherlands

Posted Fri Dec 9, 2016 4:18 PM

I (temporarily) removed the clock frequency mod because I wanted to have the other mods running steadily first.

So it's running with its original crystal now.

#31 tonma OFFLINE  

tonma

    Chopper Commander

  • Topic Starter
  • 142 posts

Posted Sat Dec 10, 2016 2:29 AM

 

Thanks for the video. I've the same anormal speed when I add music.

I certainly doing something wrong. It's weird, the pipe move at the same speed than the emulator but not the bird.

I may have to set the controls / move out of the function that displays the sprites with the tgi_updatedisplay.

 

In the pegsolitaire example, I show a WaitTicks fonction. I need to try this too. New tests for the next week.

 

Results from my Lynx 2.

 

When I tested the landscape version, I have to tap the button incredibly fast just to keep steady, and basically can't fly higher or lower.

 

On the portrait version it feels like the bird is being pulled down too by too much gravity. The collisions don't work (it just flies past pipes) and if you let go, the bird drops off the bottom of the screen and appears at the top again/repeat like it's falling through a portal.

 

(Just feedback in case handy).

 

Also, Level42, don't you have the crazy lynx that you can alter the clock speed on? Did you leave it all the way up :P

 

Yes, I removed the collision test until I found a solution for speed. Sorry, I thought I'd posted it.

 

Thanks all for test.



#32 karri ONLINE  

karri

    River Patroller

  • 2,588 posts
  • Location:Espoo, Finland

Posted Sat Dec 10, 2016 2:54 AM

A small note of what tgi_busy() and tgi_updatedisplay() does.

tgi_updatedisplay() only sets a byte SWAP_SCREENS to 1. It does not touch any registers.
tgi_busy() returns the valued of this SWAP_SCREENS byte. It does not touch any registers.

The only active player is the VBL interrupt.
If the SWAP_SCREENS is set it will change the draw_screen to display_screen and the previous display_screen to draw_screen. And it sets SWAP_SCREENS byte to 0.

So if you accidentally don't check the tgi_busy() properly then the screens is updated at every VBL.

If you don't call tgi_updatedisplay() then the screen never changes.

You can also skip both routines and draw directly on the display_screen. Then everything is updated in real time. Sometimes this is desired like in Sketch.

Edited by karri, Sat Dec 10, 2016 3:00 AM.


#33 karri ONLINE  

karri

    River Patroller

  • 2,588 posts
  • Location:Espoo, Finland

Posted Sat Dec 10, 2016 10:06 AM

There is also two commands for manually setting the view page and the draw page.

 

The pages are

0 = $EO18

1 = $C038

 

tgi_setviewpage(0); sets the LCD to show what is in RAM at page 0

tgi_setdrawpage(0); would also direct Suzy to draw to that same page 0

 

This is nice for seeing in real time what your code draws.

Of course you need to comment out tgi_updatedisplay() so that the IRQ routine does not change pages.

 

In Solitaire where the background contained lots of playing card images I used page 1 as my desktop. Instead of drawing everything again I just did a memcpy from the desktop to the view buffer to erase the sprite and drew my animations on the view page in real time. So Solitaire does not use normal double buffering. You can actually see when the playing cards are drawn. It also makes a nice effect.


Edited by karri, Sat Dec 10, 2016 10:14 AM.


#34 Kosmic Stardust OFFLINE  

Kosmic Stardust

    Princess Rescuer

  • 18,399 posts
  • Location:Milky Way Galaxy

Posted Sun Dec 11, 2016 1:38 AM

Weird how the bird speeds up but not the pipes. You'd think everything would speed up.



#35 tonma OFFLINE  

tonma

    Chopper Commander

  • Topic Starter
  • 142 posts

Posted Sun Dec 11, 2016 3:29 AM

A small note of what tgi_busy() and tgi_updatedisplay() does.

tgi_updatedisplay() only sets a byte SWAP_SCREENS to 1. It does not touch any registers.
tgi_busy() returns the valued of this SWAP_SCREENS byte. It does not touch any registers.

The only active player is the VBL interrupt.
If the SWAP_SCREENS is set it will change the draw_screen to display_screen and the previous display_screen to draw_screen. And it sets SWAP_SCREENS byte to 0.

So if you accidentally don't check the tgi_busy() properly then the screens is updated at every VBL.

If you don't call tgi_updatedisplay() then the screen never changes.

You can also skip both routines and draw directly on the display_screen. Then everything is updated in real time. Sometimes this is desired like in Sketch.

 

Ok, so tgi_busy waiting for vbl after the tgi_updatedisplay to avoid flickering. And drawing screen buffer can take more than one VBL before the tgi_updatedisplay.

We must change the position of the sprite every x frames, independently of the number of vbl used to fill the screen buffer.

 

Weird how the bird speeds up but not the pipes. You'd think everything would speed up.

 

Yes, I don't understand why only the bird speed up !!!! :-D

 

New version with better speed (I hope). Warning!!! no collision ;)

Attached Files


Edited by tonma, Sun Dec 11, 2016 3:30 AM.


#36 Kosmic Stardust OFFLINE  

Kosmic Stardust

    Princess Rescuer

  • 18,399 posts
  • Location:Milky Way Galaxy

Posted Sun Dec 11, 2016 3:31 AM

Can't wait to test this on my Lynx SD cart when it comes... :D



#37 karri ONLINE  

karri

    River Patroller

  • 2,588 posts
  • Location:Espoo, Finland

Posted Sun Dec 11, 2016 3:44 AM

There is a clock() function that counts real time in cc65.

#38 tonma OFFLINE  

tonma

    Chopper Commander

  • Topic Starter
  • 142 posts

Posted Sun Dec 11, 2016 3:57 AM

Can't wait to test this on my Lynx SD cart when it comes... :D

Me too, but I'm at the bottom of the list. I'm very patient.

 

There is a clock() function that counts real time in cc65.

Yes, I could change position at every x ticks with the clock function.



#39 Kosmic Stardust OFFLINE  

Kosmic Stardust

    Princess Rescuer

  • 18,399 posts
  • Location:Milky Way Galaxy

Posted Sun Dec 11, 2016 5:44 AM

Me too, but I'm at the bottom of the list. I'm very patient.

 

It took a long, long, long time for him to get to me as I put my name in after the initial rush. I think developers should automatically get bumped to the top, provided you can show proof you developed a game.



#40 Stun Runner 87 OFFLINE  

Stun Runner 87

    Stargunner

  • 1,248 posts
  • Location:Chicago Illinois

Posted Tue Dec 20, 2016 10:08 PM

Is this available on cart for lynx?

#41 tonma OFFLINE  

tonma

    Chopper Commander

  • Topic Starter
  • 142 posts

Posted Wed Dec 21, 2016 2:55 AM

Is this available on cart for lynx?

 

No cart yet. I'll have to work on it and find some music to add.

For now, I use karri music. Karri, I remove it if you don't want me to use it.

 

After, if someone want to make a cart, why not.

 

I have make some progress on speed. Works well on mednafen but not in handy because the emulator use 50hz. I don't know on real hardware. You can only flap when the nose is down and with a more fluid curve. No collision for testing the speed.

Attached Files



#42 karri ONLINE  

karri

    River Patroller

  • 2,588 posts
  • Location:Espoo, Finland

Posted Wed Dec 21, 2016 3:50 AM

The popcorn soundtrack is from Chipper. Sage added it as an example.

 

The game is now playable. Although it gets a bit repetitive after the first 10 seconds ;)

 

If you really want this on a cart I can burn it for €10 + postage (worldwide in an envelope for  €3). With tonma's approval of course. (This must be the smallest cart release in history. Any takers?)



#43 tonma OFFLINE  

tonma

    Chopper Commander

  • Topic Starter
  • 142 posts

Posted Wed Dec 21, 2016 4:54 AM

The game is now playable. Although it gets a bit repetitive after the first 10 seconds ;)

 

If you really want this on a cart I can burn it for €10 + postage (worldwide in an envelope for  €3). With tonma's approval of course. (This must be the smallest cart release in history. Any takers?)

:-D I can do it more smaller.

 

It's playable ... but need to add collision / random columns. :thumbsup: When it'll be finished, I leave it free, I'll work on a more bigger game.



#44 Guitari OFFLINE  

Guitari

    Stargunner

  • 1,718 posts
  • Location:Kent

Posted Wed Dec 21, 2016 5:05 AM

The popcorn soundtrack is from Chipper. Sage added it as an example.

 

The game is now playable. Although it gets a bit repetitive after the first 10 seconds ;)

 

If you really want this on a cart I can burn it for €10 + postage (worldwide in an envelope for  €3). With tonma's approval of course. (This must be the smallest cart release in history. Any takers?)

Happy to take a cart release once it's complete :)



#45 MrBland OFFLINE  

MrBland

    Dragonstomper

  • 826 posts
  • 474|2!
  • Location:Richmond, Va

Posted Wed Dec 21, 2016 7:16 AM

Sure I'll take one.

#46 tonma OFFLINE  

tonma

    Chopper Commander

  • Topic Starter
  • 142 posts

Posted Wed Dec 21, 2016 9:23 AM

Thanks all, it gives me the motivation to work on a bigger game.

 

I'll PM Sage to ask him for the music.



#47 KidGameR186496 OFFLINE  

KidGameR186496

    Dragonstomper

  • 504 posts

Posted Wed Dec 21, 2016 12:01 PM

Looks Dead-on to the original game. Good work :D

#48 Trew OFFLINE  

Trew

    Chopper Commander

  • 246 posts

Posted Wed Dec 21, 2016 12:05 PM

yeah, I'd be down for a cart. Why not eh.



#49 tonma OFFLINE  

tonma

    Chopper Commander

  • Topic Starter
  • 142 posts

Posted Thu Dec 22, 2016 3:30 AM

I'm for one cart too. :-D

 

And for whom can't test the game, a little animated gif :

 

Attached Thumbnails

  • flappy_lynx.gif


#50 karri ONLINE  

karri

    River Patroller

  • 2,588 posts
  • Location:Espoo, Finland

Posted Thu Dec 22, 2016 1:03 PM

Do you want to have saved high score? The options are:

 

128 bytes:

unsigned __fastcall__ lynx_eeread_93c46(unsigned char cell);
; /* Read a 16 bit word from the given address */

 

; write word to EEPROM
; void __fastcall__ lynx_eewrite_93c46(unsigned int addr, unsigned int val);
 

 

2048 bytes:
; unsigned int __fastcall__ lynx_eeread_93c86(unsigned int addr);
 

; write word to EEPROM
; void __fastcall__ lynx_eewrite_93c86(unsigned int addr, unsigned int val);
 

 

It adds a few cents to the components but does not affect the price of the cart.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users