Jump to content
IGNORED

FlappyBird test


tonma

Recommended Posts

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.

Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

 

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.

Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

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 ;)

lynxFlapp003.zip

Edited by tonma
Link to comment
Share on other sites

  • 2 weeks later...

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.

flapvert2.zip

  • Like 1
Link to comment
Share on other sites

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?)

  • Like 2
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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 :)

  • Like 2
Link to comment
Share on other sites

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.

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