CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: princetonlion.tibd on January 01, 2015, 08:02:07 AM

Title: Dodge 68k (Voyage 200)
Post by: princetonlion.tibd on January 01, 2015, 08:02:07 AM
I'm making a game called Dodge, a port/expansion of a 83+ game I made with my friend T.Wang.

[spoiler=Dodge 83+ links]
Omnimaga: https://www.omnimaga.org/ti-z80-calculator-projects/my-project-with-t-wang/
Cemetech (Very outdated because I'm banned and T.Wang is inactive) : http://www.cemetech.net/forum/viewtopic.php?p=220173#220173
[/spoiler]

Current features (V2.0):
-Options: Choose your own character, line, and speed.
-High Scores: Top three scores are saved
-Gameplay:
  *Randomized speed
  *Player slows down over time


Title: Re: Dodge 68k (Voyage 200)
Post by: Dream of Omnimaga on January 02, 2015, 04:35:58 AM
I wonder if this type of pure BASIC game would slow down much if you would use pictures instead of lines? I know that 68K pictures can be any size, like sprites, but I never tried them in a game. Of course if you need Disp scrolling then disregard pictures, though, lol. Anyway do you have a new screenshot for people who don't have a Voyage 200 or way to try? :)
Title: Re: Dodge 68k (Voyage 200)
Post by: compsystems on January 02, 2015, 03:12:29 PM
Hello

Sorry for my bad English, please princetonlion.tibd  can create a version without GOTO, Thanks

I extracted the source code in Unicode format, using Tiedit68k

Please try this latest versión

Tiedit New Beta version 0.7.5.28

http://www.jaimeza.org/Mathematic/TexasInstruments/ti68k/ti68k_SDK/TIEdit075_beta.rar (http://www.jaimeza.org/Mathematic/TexasInstruments/ti68k/ti68k_SDK/TIEdit075_beta.rar)


dodge()
Prgm
  Local s,b,k,c,d,cc,f,i,cc,k,cl,cht,h,spd,l
  {8,10,20,40}→l
  1→b
  1→d
  0→k
  5→spd
  "π"→cc
  "|"→cl
  0→s
  Lbl aa
  2→i
  0→s
  Try
    If s>dghigh[1] Then
      dghigh[2]→dghigh[3]
      dghigh[1]→dghigh[2]
      s→dghigh[1]
    EndIf
    If s>dghigh[2] and s<dghigh[1] Then
      dghigh[2]→dghigh[3]
      s→dghigh[2]
    EndIf
    If s>dghigh[3] and s<dghigh[1] and s<dghigh[2]
      s→dghigh[3]
  Else
    Define dghigh={0,0,0}
  EndTry
  ClrIO
  Disp "Dodge V.2.0","By Princetonlion.tibd","","High Scores",dghigh[1],dghigh[2],dghigh[3]
  Toolbar
    Title "Play",p
    Title "Help"
    Item "Instructions",h
    Item "Credits",crd
    Title "Options",o
    Title "Cheat code",c
    Title "Quit",q
  EndTBar
  Lbl crd
  ClrIO
  Disp "Ported to V200 by Princetonlion.tibd","Agranovskiy 2014","More information: omnimaga.org","","Original by Princetonlion.tibd & T.Wang"
  Pause
  Goto aa
  Lbl o
  ClrIO
  Disp "Options","Your Charactor:",cc,"Your Line Charactor:",cl,"Starting Speed:",i
  Toolbar
    Title "Speed"
    Item "Very Slow",de
    Item "Slow",dm
    Item "Normal",dh
    Title "Characters"
    Item "Custom Player",cc
    Item "Custom Line",cl
    Title "Clear Score",dhs
    Title "Reset Settings",ors
    Title "Back",aa
  EndTBar
  Lbl dhs
  ClrIO
  Disp "Are you sure you want to clear","High scores and score?"
  Toolbar
    Title "Yes",chs
    Title "No",aa
  EndTBar
  Lbl chs
  {0,0,0}→dghigh
  0→s
  Goto o
  Lbl cl
  Request "Custom Line",cl
  left(cl,1)→cl
  Goto o
 
  Lbl cc
  Request "Custom Player",cc
  left(cc,1)→cc
  Goto o
  Lbl de
  3→i
  Goto o
  Lbl dm
  5→i
  Goto o
  Lbl dh
  20→i
  Goto o
  Lbl ors
  2→i
  0→s
  "π"→cc
  "|"→cl
  Lbl c
  ClrIO
  Request "Cheat code",cht
  If cht="123outerme" Then
    Disp "Starting score is 1337"
    1337→s
    Pause
    Goto aa
  EndIf
  Disp "Wrong code!","The code is on omnimaga.org"
  Pause
  Goto aa
  Lbl h
  ClrIO
  Disp "Use arrow keys to move player.","Avoid the lines.Score is saved in dghigh"
  Pause
  Lbl p
  1→b
  1→d
  0→k
  While true
    ClrIO
    Output 84,b,cc
    Output 45,117,s
    rand(234)→d
    rand(234)→f
    b→h
    For c,0,84,i
      Output c,d,cl
      Output c,f,cl
      Output c,h,cl
      If c=80 and (d=b or d=b+1 or d=b+2 or d=b-1 or d=b-2 or f=b or f=b+1 or f=b+2 or f=b-1 or f=b-2 or h=b or h=b+1 or h=b+2 or h=b-1 or h=b-2) Then
        Goto aa
      EndIf
      getKey()→k
      If k≠0 Then
        Output 84,b," "
      EndIf
      If k=340 and b<234 Then
        b+spd→b
        Output 84,b,cc
      EndIf
      If k=337 and b>−7 Then
        b-spd→b
        Output 84,b,cc
      EndIf
      If c=80 and (d=b or d=b+1 or d=b+2 or d=b-1 or d=b-2 or f=b or f=b+1 or f=b+2 or f=b-1 or f=b-2 or h=b or h=b+1 or h=b+2 or h=b-1 or h=b-2) Then
        Goto aa
      EndIf
      Output 45,117,s
      Output 84,b,cc
    EndFor
    s+1→s
    If fPart(s/10)=0
      spd-1→spd
    If i≤8
      i+2→i
    If i≥8
      l[rand(4)]→i
  EndWhile
  Lbl q
  ClrIO
  DispHome
  Stop
EndPrgm


PD: The above code can display color (highlighted)?
Title: Re: Dodge 68k (Voyage 200)
Post by: princetonlion.tibd on January 02, 2015, 04:42:30 PM
Quote from: DJ Omnimaga on January 02, 2015, 04:35:58 AM
I wonder if this type of pure BASIC game would slow down much if you would use pictures instead of lines? I know that 68K pictures can be any size, like sprites, but I never tried them in a game. Of course if you need Disp scrolling then disregard pictures, though, lol. Anyway do you have a new screenshot for people who don't have a Voyage 200 or way to try? :)
I'll upload the screenshots. And I do have a beta version with sprites, just that I haven't implemented collisions yet.
Quote from: compsystems on January 02, 2015, 03:12:29 PM
Hello

Sorry for my bad English, please princetonlion.tibd  can create a version without GOTO, Thanks

I extracted the source code in Unicode format, using Tiedit68k

Please try this latest versión

PD: The above code can display color (highlighted)?
What's wrong with the version with goto?

And I can't open .rar files on my mac. I'll try it when I can get to a windows computer.
I don't know about the color/highlighting, could you explain it a bit more?
Title: Re: Dodge 68k (Voyage 200)
Post by: Dream of Omnimaga on January 02, 2015, 05:05:52 PM
Using Lbl/Goto is generally discouraged in programming, especially older calculators. It can lead to slowdowns in BASIC because the calc will search from the beginning to the end of the program to find the Lbl. Goto also makes the program harder to follow in some cases. And if Goto is nested in a loop or If block this causes a memory leak on some calculators.
Title: Re: Dodge 68k (Voyage 200)
Post by: compsystems on January 02, 2015, 05:17:12 PM
Is easier to understand the code in functional form, ie calling subroutines or a single code without goto, the goto should be used in extreme cases where it is almost impossible to use the functional form.

On the highlighted I mean is show code in various colors on the forum.

PS: I continue with TI68k calculators that allow me to create dialog boxes in TI-BASIC and that have management command pixels. without requiring compilation or learn complex languages as LUA

Hopefully Tinspire developers incorporate "missing" TI68k basic commands

(http://jaimeza.org/Mathematic/TexasInstruments/images/SDK_TI68K_BASIC_TI89_VOYAGE200.png)
...

I would like you to please test TIedit, in which it is developing
Title: Re: Dodge 68k (Voyage 200)
Post by: princetonlion.tibd on January 02, 2015, 05:30:30 PM
Quote from: compsystems on January 02, 2015, 05:17:12 PM
Is easier to understand the code in functional form, ie calling subroutines or a single code without goto, the goto should be used in extreme cases where it is almost impossible to use the functional form.

On the highlighted I mean is show code in various colors on the forum.

I would like you to please test TIedit, in which it is developing
I think the forum doesn't show syntax highlighting.

I don't really like subprograms, but I have another program called doge (reference at DJ's joke for the first dodge on omni) I use to test gameplay while skipping the menu. I can make that a subprogram.
Title: Re: Dodge 68k (Voyage 200)
Post by: Dream of Omnimaga on January 02, 2015, 07:46:45 PM
Yeah unfortunately SMF software currently lacks TI-BASIC syntax highlighting. Someone would need to write a mod for that)
Title: Re: Dodge 68k (Voyage 200)
Post by: princetonlion.tibd on January 02, 2015, 08:19:49 PM
Quote from: DJ Omnimaga on January 02, 2015, 07:46:45 PM
Yeah unfortunately SMF software currently lacks TI-BASIC syntax highlighting. Someone would need to write a mod for that)
like this (http://www.simplemachines.org/community/index.php?topic=290024.0)?

And the person writing the mod would need to make TI BASIC availiable :P
Title: Re: Dodge 68k (Voyage 200)
Post by: TIfanx1999 on January 02, 2015, 09:40:01 PM
Quote from: compsystems on January 02, 2015, 05:17:12 PM
Hopefully Tinspire developers incorporate "missing" TI68k basic commands

If you Mean Texas Instruments themselves, I think that is very unlikely. It seems they plan on keeping nspire BASIC pretty limited.

*Edit* And yea, use of Goto is generally discouraged. Sub programs or loops are usually used instead, or subroutines of some sort (provided the language supports it).
Title: Re: Dodge 68k (Voyage 200)
Post by: princetonlion.tibd on January 02, 2015, 10:01:11 PM
I guess I'll make a version with subprograms then.
Title: Re: Dodge 68k (Voyage 200)
Post by: Dream of Omnimaga on January 02, 2015, 10:21:38 PM
Quote from: princetonlion.tibd on January 02, 2015, 08:19:49 PM
Quote from: DJ Omnimaga on January 02, 2015, 07:46:45 PM
Yeah unfortunately SMF software currently lacks TI-BASIC syntax highlighting. Someone would need to write a mod for that)
like this (http://www.simplemachines.org/community/index.php?topic=290024.0)?

And the person writing the mod would need to make TI BASIC availiable :P
Yeah something like that, but we would need it for like 10-15 different calc languages >.<

Quote from: princetonlion.tibd on January 02, 2015, 10:01:11 PM
I guess I'll make a version with subprograms then.

It's possible to make a program not use goto without having to rely on sub-programs. It requires extra variables or a list element and nesting many Repeat/While loops, though.
Title: Re: Dodge 68k (Voyage 200)
Post by: princetonlion.tibd on January 02, 2015, 10:30:02 PM
I know, just that subprograms are easier for me.
Title: Re: Dodge 68k (Voyage 200)
Post by: novenary on January 06, 2015, 07:26:43 AM
Iirc 68k basic supports functions. ;)
Title: Re: Dodge 68k (Voyage 200)
Post by: Dream of Omnimaga on January 06, 2015, 06:27:40 PM
Although functions might be a problem if his code gets large and if the 68K BASIC editor lacks a search function.  It gets hard to find anything in such case. That said, large code and small screen size was not much of an issue for me in TI-83+ BASIC, though, except on the CSE because of the horribly slow editor.
Title: Re: Dodge 68k (Voyage 200)
Post by: princetonlion.tibd on January 06, 2015, 10:49:35 PM
The 68k BASIC editor has a "Find" tab, but it doesn't find words (At least when I tried it). Dodge is big enough that it's hard finding specific lines of code, which is why I have another program for the game loop (not a subprogram yet)

And I thought functions were for number manipulation only?
Title: Re: Dodge 68k (Voyage 200)
Post by: Dream of Omnimaga on January 06, 2015, 11:10:15 PM
Is "Find" only to find variables?

The other solution is to code on the computer, but after getting used to on-calc programming it can take a while to get used to doing it elsewhere, plus I think there is no Voyage 200 BASIC editor other than TI-Graph Link 92+ (which won't run on 64-bit OSes)
Title: Re: Dodge 68k (Voyage 200)
Post by: T.Wang on January 07, 2015, 01:30:50 PM
Quote from: princetonlion.tibd on January 06, 2015, 10:49:35 PM
The 68k BASIC editor has a "Find" tab, but it doesn't find words (At least when I tried it)
I know that on the nspire find only finds comments in the code, will that help?

EDIT: I can upvote things now :D
Title: Re: Dodge 68k (Voyage 200)
Post by: princetonlion.tibd on January 07, 2015, 10:56:10 PM
I don't think it finds comments
In:

comment()
prgm
@comment
Endprgm

using find to search for "comment" gives a "text not found" error. It's not other programs or variables either... I'll check on TI|BD
Title: Re: Dodge 68k (Voyage 200)
Post by: Dream of Omnimaga on January 08, 2015, 03:01:01 AM
It would be hilarious if it actually did nothing at all (as in not working as intended)
Title: Re: Dodge 68k (Voyage 200)
Post by: princetonlion.tibd on January 08, 2015, 04:42:47 AM
I actually think it does nothing  :P  I never use it anyways.

nothing on TI|BD, which I expected :P
Title: Re: Dodge 68k (Voyage 200)
Post by: Travis on January 12, 2015, 09:20:15 PM
Find works fine on my TI-89s. It searches everything, code and comments. Make sure the cursor is above what you're trying to find, though, or it won't find it—it always starts from the current cursor position going down and doesn't "wrap".

Functions are used for returning expressions (which can include numbers, strings, lists, etc.) and can be used directly in other expressions, but they're limited to program flow statements and other functions. Many instructions and I/O commands are disallowed in functions. Subprograms, on the other hand, can use all of those but can't (directly) return values. Another benefit of using separate functions/programs is it makes it easier to test/debug the program in incremental steps. :) Also, don't forget that the 68K calcs have folders, so programs using separate vars aren't nearly as annoying (though nested folders and a better path resolution system like the HP 48/49/50s have would have been even better).
Title: Re: Dodge 68k (Voyage 200)
Post by: Dream of Omnimaga on January 13, 2015, 01:11:56 AM
Ooh I see now. That probably explains why he couldn't find what he wants. Also for some reasons I tend to not use folders much except when downloading games, but again I was used so much to the lack of folders on the 83+ before that it's an habit to not use them now. :P (there was MirageOS, but when your RAM was cleared your folder settings were lost, and DCS7 came out a bit too late )
Title: Re: Dodge 68k (Voyage 200)
Post by: princetonlion.tibd on January 13, 2015, 01:21:40 AM
Quote from: Travis on January 12, 2015, 09:20:15 PM
Find works fine on my TI-89s. It searches everything, code and comments. Make sure the cursor is above what you're trying to find, though, or it won't find it—it always starts from the current cursor position going down and doesn't "wrap".

Functions are used for returning expressions (which can include numbers, strings, lists, etc.) and can be used directly in other expressions, but they're limited to program flow statements and other functions. Many instructions and I/O commands are disallowed in functions. Subprograms, on the other hand, can use all of those but can't (directly) return values. Another benefit of using separate functions/programs is it makes it easier to test/debug the program in incremental steps. :) Also, don't forget that the 68K calcs have folders, so programs using separate vars aren't nearly as annoying (though nested folders and a better path resolution system like the HP 48/49/50s have would have been even better).
So that's how find works... :P
And I have a giant folder named "Dodge."
I don't even use the "main" folder anymore :P
Title: Re: Dodge 68k (Voyage 200)
Post by: Travis on January 13, 2015, 04:04:41 AM
Yeah, I never really liked the "main" folder because many programs and apps always want to clutter it with junk. :P I have a "home" folder which I use as a "main" folder that actually stays clean. :D