Go Down

Topic: Arduino Tetris (Read 4318 times) previous topic - next topic

mdmetzle

I just this Tetris working with TVout.

Short video of me loosing:
[media]http://www.youtube.com/watch?v=Bawl3-wNE7Q[/media]

It uses a modified version of simple tetris clone http://www.youtube.com/watch?v=Bawl3-wNE7Q The only modifications are some quick datatype changes (ints to chars ect) to fit with the memory constraints. This could also be easily used with a Tellymate shield if one desires with no extra effort.

I will release post the sketch when I fix a small bug that kills the input randomly.

mowcius

Nice, I might have to take this and modify it slightly for my hackvision.

It was kinda on my list to do. Glad you got there first! :D

Mowcius

mdmetzle

#2
Nov 18, 2010, 01:31 pm Last Edit: Nov 18, 2010, 01:33 pm by mdmetzle Reason: 1
actually this is written for a hackvision atm but changing it to work for the video game shield would be easy (i have both).  The only thing is this requires the latest TVout as it uses TVouts version of millis() and the new bitmap function which is a very recent addition. All the other changes would be simple to get working on the version of TVout that nootropic has posted for the hackvision.

The simple tetris clone is a great bit of code it takes care of all the computation you are just left to code the input and output.

mowcius

Quote
actually this is written for a hackvision atm but changing it to work for the video game shield would be easy

Oh righty ho :)

I can't watch the video from here so I suppose I shouldn't assume things :P

nootropic

This is awesome, mdmetzle.  After you fix the bug, I'd love to show a video and make this available for download on the Hackvision site's game page.  

Some clarity on a confusing issue: the only reason I used a particular version of TVout for Hackvision is that the preloaded games (Space Invaders/Pong) takes up a lot of SRAM, and the older version of TVout I used was a little slimmer.  The current/newest builds of TVout certainly work on the Hackvision hardware (which is what mdmetzle did I think).

mdmetzle

Yes the newest version of TVout work on the hackvision as is and I am currently working on its memory usage back down so your current examples will work as is.  I have freed up about 10 extra bytes and know how to free up another 10.

What i was trying to say is this needs the newer TVout so that it has access to a reliable millis() function which the version you used to write your games did not have yet.

On a side note I think that your examples could be made to work with the newest version of TVout by the encapsulating pong and space invaders data members inside a struct and then dynamically allocating the memory depending on which is chosen, much the way the simple-tetris-clone library does.

The only problem is I dont have any clue why the input bug is happening.  What happens is will randomly think that the left button is being pressed repeatedly and render the game unplayable.  Its probably something very simple if anyone wants to take a look as is just let me know and ill upload it somewhere as It may be a while before I can look at it again.

nootropic

mdmetzle, you can send me the code and I'll take a look.  It could be a sticky button, too.  (unless you tested using a plain arduino and some buttons).

adamwolf

mdmetzle, if you send it my way I can change the controller stuff over to work with the Video Game Shield, and look for the input bug as well.

nootropic

I found the input bug and sent mdmetzle the fix.  Great implementation of tetris!

mowcius

Mowcius will have to have a play with it soon.

Mowcius

nootropic

#10
Nov 20, 2010, 03:58 pm Last Edit: Nov 20, 2010, 03:58 pm by mkrumpus Reason: 1
mdmetzle has finished the game and it's available on the Hackvision games page.  This is a really great Tetris implementation.

UnaClocker

I notice the Hackvision supports a Wii Nunchuck.. Does this game?
Brian from Tacoma, WA
Arduino evangelist - since Dec, 2010.

mdmetzle

While I didn't write nunchuck support into it specifically adding nunchuck support would be trivial.  Include the one of the libraries that can be used for the nunchuck instead of the hackvision controller/nunchuck library and modify platformReadInput().

I have posted the latest version of the game on TVout google code page. This game requires the beta. I am not sure if I made a few minor changes vs the version posted on the hackvision site but I may have.

I do know that the guys behind the video game shield where planning on adding nunchuck support however I don't know what has happened to that.

adamwolf

We've got a version that works with all the hackvision stuff, as well as the nunchuck and the classic controller.  As soon as we get back up to speed after our vacation we'll post source and videos and stuff.  Expect something by the end of the week!

Divyanshu

|I love Technology|

Go Up