A video game on my Trinket
Moderators: adafruit_support_bill, adafruit

A video game on my Trinket

by geogray on Thu Oct 10, 2013 1:18 am

So, I wrote this little game, loosely based on Space Invaders and Battlestar Galactica. It uses a Trinket, one button and a 2x16 LCD panel from Parallax. It is simple, but shows what can be done with these cool little boards and it doesn't involve thermometers or motors (though, that is cool by itself.)

Have a gander:
http://halfbyteblog.wordpress.com/2013/10/09/coding-for-small-platforms-is-nearly-a-lost-art-or-why-i-love-tiny-computers/
geogray
 
Posts: 22
Joined: Thu Sep 26, 2013 2:10 pm

Re: A video game on my Trinket

by adafruit_support_bill on Thu Oct 10, 2013 8:01 am

Awesome! Thanks for posting. :D
User avatar
adafruit_support_bill
 
Posts: 31070
Joined: Sat Feb 07, 2009 10:11 am

Re: A video game on my Trinket

by Winchell Chung on Mon Oct 21, 2013 6:48 pm

I am astonished that you managed to squeeze a game into 5K of RAM! Bravo, sir!
Back in the day I programmed games into the Atari 800, but I had 32K to work with.
User avatar
Winchell Chung
 
Posts: 54
Joined: Mon Sep 23, 2013 2:16 pm

Re: A video game on my Trinket

by geogray on Tue Oct 22, 2013 1:11 am

Winchell Chung wrote:I am astonished that you managed to squeeze a game into 5K of RAM! Bravo, sir!
Back in the day I programmed games into the Atari 800, but I had 32K to work with.


Thanks!

It was actually about 2.75k or so since the libraries ate some space. I have updated it since that post, it now has sound and an animation when you lose. You have only 10 torpedos and if all ten do not hit a target,you lose. The game is difficult to win. I want to do a version for the 4x20 display, but not sure how as there are only ten bytes free now.

Atari 800 game programming...now THATS impressive. If I recall, they were a bear to code for..or am I thinking of the VCS?
geogray
 
Posts: 22
Joined: Thu Sep 26, 2013 2:10 pm

Re: A video game on my Trinket

by jw4.0 on Tue Oct 22, 2013 9:50 am

That is, indeed, pretty darn impressive.
Breaking stuff since the 70s...
jw4.0
 
Posts: 20
Joined: Fri Jun 07, 2013 4:34 pm

Re: A video game on my Trinket

by geogray on Tue Oct 22, 2013 12:28 pm

I've posted revised code up on the blog, but Wordpress has munged the listing a bit. You can copy it and paste into the IDE and it should look and work fine.
http://halfbyteblog.wordpress.com/2013/10/22/a-video-game-on-my-trinket-take-2/
geogray
 
Posts: 22
Joined: Thu Sep 26, 2013 2:10 pm

Re: A video game on my Trinket

by Winchell Chung on Thu Oct 24, 2013 5:54 pm

geogray wrote:Atari 800 game programming...now THATS impressive. If I recall, they were a bear to code for..or am I thinking of the VCS?

Probably the VCS.
The Atari 800 generally was programmed in BASIC with assembly language subroutines. You would POKE various values into specific places in the memory space in order to activate hardware functions (such as changing screen resolution).
The display was a conventional television set. When the raster beam hit the end of the last scan line, the beam would start to travel to the upper left corner, and the vertical blank interrupt would trigger. You would attach to this an assembly language routine to be run, to perform any periodic operations (like polling the joystick to scroll the game screen).

The easiest way to insert such an assembly language subroutine was very Rube Goldberg. You'd write it in assembly language and compile it. You'd take the object code and turn it into a BASIC language string (using all sorts of weird font characters). In you BASIC program, you'd create a string variable, assign the object code "string" to it, and pass the address of the string variable to the vertical blank interrupt.
Those were the days.
User avatar
Winchell Chung
 
Posts: 54
Joined: Mon Sep 23, 2013 2:16 pm

Re: A video game on my Trinket

by geogray on Sun Oct 27, 2013 10:20 pm

Yeah, the VCS. Atari Age has a BASIC dev system, for Windows that lets you develop VCS games. It works well. Its a great exercise in tight coding.
geogray
 
Posts: 22
Joined: Thu Sep 26, 2013 2:10 pm

Re: A video game on my Trinket

by geogray on Sun Oct 27, 2013 10:21 pm

Yeah, the VCS. Atari Age has a BASIC dev system, for Windows that lets you develop VCS games. It works well. Its a great exercise in tight coding.
geogray
 
Posts: 22
Joined: Thu Sep 26, 2013 2:10 pm