- Fast TI-BASIC Platformer Demo
- 06 Mar 2016 12:34:01 pm
- Last edited by lirtosiast on 06 Mar 2016 08:58:49 pm; edited 4 times in total
JWinslow23 is currently making This is the Only Level for the 84+ calcs in assembly. He challenged me to make a playable one-stage demo in pure TI-BASIC for monochrome 84+. Although that was mostly a joke, I think it's actually marginally possible given enough speed optimization. This thread is mostly so I can keep track of my own ideas/progress.
I've looked at a few other attempts at platformers, like Contra 83 (the very first one) and Absolute Madness. Contra is very slow, averaging about 2 FPS (but that's at 6 MHz). It uses, I think, text sprites, and has enemies, which slow the game down more. Absolute Madness also uses text sprites as far as I can tell, but has several further features like being able to push around a ball during movement. Both are tile-based, and both are barely playable before one adjusts to the input lag.
My goal is 6 FPS at 15 MHz, giving me a budget of 167 ms per frame in the average case. I hope that techniques discovered since 2011 can make this possible.
Here are some ideas I have to speed a program up:
* Finance variables throughout. The objective is speed; size isn't too important.
* Checking for solid ground using one or two pxl-Test( instead of looking up position in a matrix.
* Very simple sprites, just a single letter. Displaying the letter with Text( takes just 5 ms, and erasing a position with spaces takes only 10 ms.
* Perhaps a tile system like that of Absolute Madness, if the required speed is infeasible without tiling. Perhaps the character can move in half-tile increments?
* Lots of short-circuiting. Possibly Lbl:End subroutines.
Some problems:
* getKey takes 8 ms per call. If I take input more than once per frame, this will quickly eat into the time budget. If not, input will be restricted to once per frame, which may make gameplay difficult. Additionally, getKey can only detect one keypress at a time.
What I think is feasible to implement in 167 ms/frame:
* Left-right movement on a platform
* Movement while jumping
* Gravity with acceleration
* Maybe a way to control jump height?
Some things that are probably impossible:
* Scrolling (it's possible to have two sides of the screen, though, stored in two different pictures)
* Impressive graphics that aren't static.
Other helpful timings:
* Skipping each line of code in a false If:Then statement takes about 1 ms.
* 2>abs(|N-25 takes about 3 ms.
* RecallPic takes 27 ms. I guess I could recall a picture every five frames or so, fixing any mistakes with correcting player position. However, it's a bit expensive to call every frame, and probably too expensive to call more than once. I'll need to carefully plan my sprite drawing to minimize the number of calls.
* StoPic takes 4 ms. I don't know how often I'll be using it without text sprites though.
* ClrDraw takes 100 ms. I won't be using many of those, if any.
I've looked at a few other attempts at platformers, like Contra 83 (the very first one) and Absolute Madness. Contra is very slow, averaging about 2 FPS (but that's at 6 MHz). It uses, I think, text sprites, and has enemies, which slow the game down more. Absolute Madness also uses text sprites as far as I can tell, but has several further features like being able to push around a ball during movement. Both are tile-based, and both are barely playable before one adjusts to the input lag.
My goal is 6 FPS at 15 MHz, giving me a budget of 167 ms per frame in the average case. I hope that techniques discovered since 2011 can make this possible.
Here are some ideas I have to speed a program up:
* Finance variables throughout. The objective is speed; size isn't too important.
* Checking for solid ground using one or two pxl-Test( instead of looking up position in a matrix.
* Very simple sprites, just a single letter. Displaying the letter with Text( takes just 5 ms, and erasing a position with spaces takes only 10 ms.
* Perhaps a tile system like that of Absolute Madness, if the required speed is infeasible without tiling. Perhaps the character can move in half-tile increments?
* Lots of short-circuiting. Possibly Lbl:End subroutines.
Some problems:
* getKey takes 8 ms per call. If I take input more than once per frame, this will quickly eat into the time budget. If not, input will be restricted to once per frame, which may make gameplay difficult. Additionally, getKey can only detect one keypress at a time.
What I think is feasible to implement in 167 ms/frame:
* Left-right movement on a platform
* Movement while jumping
* Gravity with acceleration
* Maybe a way to control jump height?
Some things that are probably impossible:
* Scrolling (it's possible to have two sides of the screen, though, stored in two different pictures)
* Impressive graphics that aren't static.
Other helpful timings:
* Skipping each line of code in a false If:Then statement takes about 1 ms.
* 2>abs(|N-25 takes about 3 ms.
* RecallPic takes 27 ms. I guess I could recall a picture every five frames or so, fixing any mistakes with correcting player position. However, it's a bit expensive to call every frame, and probably too expensive to call more than once. I'll need to carefully plan my sprite drawing to minimize the number of calls.
* StoPic takes 4 ms. I don't know how often I'll be using it without text sprites though.
* ClrDraw takes 100 ms. I won't be using many of those, if any.