Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: meishe91 on September 21, 2010, 04:03:58 am

Title: Meishe91's Tunnel
Post by: meishe91 on September 21, 2010, 04:03:58 am
This isn't anything to spectacular or anything, just thought it might be a cool little thing to make real quick. To see what I could come up with and how small I could make it on a "just go with it" type of thing. I think it turned out pretty well. But like I said, it's nothing special. Just another homescreen tunnel game.

Object of the game is pretty simple: don't hit the walls. As you progress the walls continually get closer together. Shouldn't be any bugs that I know of. Only thing is that don't try to go off screen before you reach the tunnel :P I have no edge code built in since it really isn't needed (I don't think you can reach the edge anyways). Um, ya. Think that's about it. Score is at the bottom. Have fun and enjoy :) Tell me what ya think.

Oh ya, it's only 304 bytes. Tried to keep it under 300 but failed to do so. I optimized it the best I could but if anyone sees any, if you go looking through the code, let me know and I'll change it :)

(http://img.removedfromgame.com/imgs/1285056073-Tunnel.gif)
(http://img.removedfromgame.com/imgs/1285056223-Tunnel2.gif)

Note:
Just noticed that in the screenshots you can see the score on the seventh line just barely. On a calculator you can't see it, or very barely can.
Title: Re: Meishe91's Tunnel
Post by: DJ Omnimaga on September 21, 2010, 04:11:57 am
Nice, pretty small indeed. The roads are generated as the game progresses, right? It seems kinda fast. I could not get better than 4 fps on a regular 83+ on a tunnel
Title: Re: Meishe91's Tunnel
Post by: coolsnake on September 21, 2010, 08:10:34 am
score: 1269 ^^
Fun game!
Title: Re: Meishe91's Tunnel
Post by: shmibs on September 21, 2010, 09:45:18 am
basic skillage!
nicely done there
Title: Re: Meishe91's Tunnel
Post by: Broseph Radson on September 21, 2010, 10:00:37 am
Nice! :D
Title: Re: Meishe91's Tunnel
Post by: meishe91 on September 21, 2010, 03:01:45 pm
Thanks guys :)

@DJ
Ya, the road is generated as it goes.

On another note, I realized there is one possible bug, but not very likely to happen.
Title: Re: Meishe91's Tunnel
Post by: DJ Omnimaga on September 21, 2010, 03:14:21 pm
What would be the bug?
Title: Re: Meishe91's Tunnel
Post by: meishe91 on September 21, 2010, 05:14:07 pm
When the tunnels shrink there could be a spot that looks like this:

Code: [Select]
XXX______XXXXXXX
XXXX______XXXXXX
XXXXX______XXXXX
XXXXXXX_____XXXX ←
...

In theory you might be able to get into that extra "X" but it wouldn't really give you any advantage, or at least not in the long run. I don't think it's really big enough to fix but if people really want it to be I can.

There is actually an example of that type of wall in the monochrome screenshot.

Edit:
By the way, for those of you who were wondering what the levels are:

Six: 0-50
Five: 51-200
Four: 201-800
Three: 801-3200
Two: 3201-12800
One: >12800

Also, my high is 2441, who can beat it? :P
Title: Re: Meishe91's Tunnel
Post by: Builderboy on September 21, 2010, 06:53:38 pm
Ah i see, so it only checks to see if your position is equal to the wall?  Why not just say less and or equal to and it could be fixed easily?
Title: Re: Meishe91's Tunnel
Post by: meishe91 on September 21, 2010, 09:30:40 pm
Oh, hmmm, never even thought of that :P Ya, that would fix it. Thanks :) I'll post a updated version soon.
Title: Re: Meishe91's Tunnel
Post by: Builderboy on September 21, 2010, 09:31:57 pm
Heh sounds good :) Sometimes the simplest solutions are the best ^^ Although not always the most obvious
Title: Re: Meishe91's Tunnel
Post by: meishe91 on September 21, 2010, 09:35:45 pm
Well actually it isn't as simple as that apparently :(
Title: Re: Meishe91's Tunnel
Post by: Builderboy on September 21, 2010, 09:38:48 pm
:( Oh noo whats going wrong?
Title: Re: Meishe91's Tunnel
Post by: meishe91 on September 21, 2010, 09:44:09 pm
I don't know. Well...actually I do now that I think about it. It checks the list element that lines up with the first row. So since those are zero at first it is saying it is larger than the right wall point, therefore ending the program.
Title: Re: Meishe91's Tunnel
Post by: nemo on September 21, 2010, 09:54:35 pm
yeah.. i just scored 500 by placing the cursor at the right side of the screen and then forgetting about it for a bit. anyway; here's a 295 byte version:
Code: [Select]
:DelVar {L1}16→dim({L1}
:1→B
:6→S
:5→A
:8→X
:10→W
:5W→J
:DelVar H1→L
:For(F,0,6
:Disp "
:End
:Repeat 0
:X+sum(DeltaList(getKey={24,26→X
:"**************
:Disp sub(Ans,1,A)+sub("      ",1,S)+sub(Ans,1,W-A
:min(W-1,max(1,A+randInt({-}1,1→A
:Ans→{L1}(L
:17-W+Ans→{L1}(L+1
:Output(1,X,"V
:Output(8,1,H
:If X={L1}(L+2-16(L=15)) or X={L1}(L+3-16(L=15
:Stop
:L+2
:Ans-16(Ans=17→L
:H+B→H
:If Ans>J
:Then
:max(1,S-1→S
:min(14,W+1→W
:4J→J
:B+1→B
:End
:End

all i did was eliminate the need for Str1 by replacing it with ans, changed a few things to Ans (speed optimization) and added getKey as part of the movement code statement.

by the way.. if you can get collision detection to work without the list, you'll save a ton of memory.

edit: it'd be really cool if you had a snippet of inline ASM to get the byte at which the V is. then it's not pure basic.. but still. otherwise you need a  112 external string variable... and managing that would be slow and memory consuming. it'd be slower, but i suggesting instead of using Disp, using Output. it makes collision detection so much simpler.
Title: Re: Meishe91's Tunnel
Post by: _player1537 on September 21, 2010, 10:15:23 pm
Quote
edit: it'd be really cool if you had a snippet of inline ASM to get the byte at which the V is. then it's not pure basic.. but still. otherwise you need a  112 external string variable... and managing that would be slow and memory consuming. it'd be slower, but i suggesting instead of using Disp, using Output. it makes collision detection so much simpler.
*cough* >.> *cough*

:)  I posted one like this lol :D  The whole collision stuff is in the string.


That aside, nice program Meishe :)
Title: Re: Meishe91's Tunnel
Post by: meishe91 on September 21, 2010, 10:26:45 pm
Ya, I know it'd be smaller without the list collision detection and I didn't want to do it with a string because I knew _player had mad one like that (which is kinda what gave me the idea to make a tunnel game). I just wanted to make something that was as fast and as small as I could do it in pure TI-BASIC, which using Disp I thought would be the ticket.

Edit:
Well there is some good news, and then some bad new.

The good news is that I shaved five more bytes off of it and solved that previous bug. The bad part, however, is that if you move either direction before you actually start moving it will end :(

Edit:
Ok, well fixed the bug. Should be bug free now. Only bad thing is that I had to fill in that five bytes and now am back at 295 bytes.

Also, new high score of 3246 ;D It gets really hard when you get to two spaces :P
Title: Re: Meishe91's Tunnel
Post by: DJ Omnimaga on September 21, 2010, 11:46:05 pm
@Nemo his goal was to use pure-BASIC actually, so ASM would be out of the question for this game.
Title: Re: Meishe91's Tunnel
Post by: ztrumpet on September 22, 2010, 05:14:00 pm
I got 1021.  That's a fun and simple (and really small) game.  Nice job! ;D

Here's a link to player's: http://ourl.ca/6773/111686  There's one by me in that topic too. :)
Title: Re: Meishe91's Tunnel
Post by: meishe91 on September 22, 2010, 08:18:52 pm
Thanks :)
Title: Re: Meishe91's Tunnel
Post by: Hot_Dog on September 22, 2010, 08:21:16 pm
Is that pure TI-Basic?  Awesome job!
Title: Re: Meishe91's Tunnel
Post by: meishe91 on September 22, 2010, 09:42:28 pm
Ya, it's pure TI-BASIC. Thanks :D