Close

A Game in TGRK?

A project log for Tiny Bit Machine

An 8-bit solar powered gadget.

g0730ng0730n 09/05/2024 at 14:170 Comments

For the final addition for this device for the Tiny Games Contest, my challenge is to write some sort of game that runs on the Tiny Bit Machine. And write it in TGRK, AND write it into the device one bit at a time.

I will definitively develope and test using the serial transfer I added, but once the program is complete I will punch it in one bit and byte at a time. The serial transfer program is working flawlessly now. I did some more work on it yesterday and have tested transferring more than 60 bytes and havent had an error yet.

Limitations:

The 127 byte progam length is a real limitation for any complex game. It has to be simple. Just having all 8 empty functions initialized and setting all 8 registers once uses about 55 bytes.

I need to modify how I set up detecting button presses within TGRK. The way it works right now is we call a button, e.g Left button: "BL" and when TGRK reads that keyword, it waits until that button is pressed before continuing program. I need to do something more like this:

BG
BV

Button Get: "BG" will wait until any button is pressed, and when one is, it will store the button code (0-4) in the Button Value: "BV" register. Thr BV register can then be read to see what the button press was.

About a year ago, I wrote an RPG game in BASIC on the Smart Response XE running Arduino Basic. The entire game ended up being about 6Kb, which was maxing out useable memory.

I will probably use some of the concepts i used in that game, but obviously i need to optimize and slim it down.

In that game I used Arduino Basics "RND" Function quite heavily which generated a random float between 0.001 and .999.

In this TGRK game I will also need a random number generator, which I will probably name this keyword RND as well. But it will generate a number between 0 and 127. I have seen posts somewhere about using a timer to generate a random number on Attiny85, I may do that or when the BG function is waiting for input, have a counter constantly counting from 0-127, whatever it is at when button is pressed, that is the random number for that turn.

In a RPG generating random numbers is essential to almost everything. In each following step we roll a number: Will a monster appear this turn? Can I run from it? If it attacks, how much damage does it do? How much damage will I do this hit? Will it drop a coin?

We will see!

Discussions