Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411496 Posts in 69373 Topics- by 58428 Members - Latest Member: shelton786

April 25, 2024, 06:56:06 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)TiBasic - The ultimate road to complete indieness?
Pages: [1] 2
Print
Author Topic: TiBasic - The ultimate road to complete indieness?  (Read 7931 times)
Lukas
Level 3
***



View Profile
« on: March 19, 2008, 05:46:58 PM »

Hey there!
Maybe some of you know/remember the "Texas Instruments"-Calculators?
They are often used in schools. (for educational purpose)
http://en.wikipedia.org/wiki/TI-83_series



Those calculators can (of course) calculate, store data, display graphs and tables and (!) they have a built-in code-editor and interpreter which runs the "Ti-Basic"-programming language. 
http://en.wikipedia.org/wiki/TI-BASIC
http://tibasic.wikia.com/wiki/Beginner's_Guide_to_Programming_TI-BASIC

For me, the Ti83+ was what the C64 was for most people of the last generation.
It was my first contact with developing and sharing software.
Anyway... I have to admit that I'm not a programmer and Ti-Basic is the only language I ever learned.

I tried to code lots of different games: From TextRPGs(most succesful) to 2D-topdown-adventures to "3D"-Egoshooters (least succesful).
After all I did not give up developing games for my TI because TI-Basic wasn't powerful enough... it was a matter of resources. Even my simple 3D-shooter (4 directions, doomlike) had to be played turnbased and crashed after 20 turns or so. 6Mhz and 32 KBs of RAM just weren't enough anymore.  Wink

Anyway... My point is: Ti-Basic is a really neat little programming language everybody can learn in a matter of minutes/hours although I can barely imagine what Ti-Basic-games could be like if they were running on machines 1000 times as fast as a TI-calculator.

My point expanded:
What about a programme that converts (slightly modified (=some commands removed, others added) TI-Basic-code into C++(or any other mighty programming language)-code which can be compiled?
Or even better (but more difficult to make): A compiler for TI-Basic?

So this may sound a bit weird... Why creating a compiler for a programming language if there are languages like C++ or Basic which are even more powerful. How could Ti-Basic possibly be easier to learn and debug than Basic or BlitzBasic? The answer: The graphical possibilities are restricted!
Let's look at the Calculator's specifications:
The display has got 96x64 pixels, is monochrome and it can display 16x8 characters at a time. Too restricted? Well: a.) This can be improved a little bit. b.) I don't know what you are thinking but the little retro-indie-gamer in me gets all fuzzy even thinking about it! That's even more lo-fi than a GB is. :D
This means: The compiled .exe-file would open in a window/stretched screen with 96x64 (or something) (enlarged) pixels. Maybe even a recreation of the TI-display itself? (authentic greenish colours?)

So what are the two sides of the coin?
Bad:
- The graphical capabilites of such a programme are extremely restricted.

Good:
- Probably the most easy-to-learn yet extremely rich game-development-possibility ever. (as I said. I can clearly imagine simple 3D-games. I just never had the Mhz to make them real. Smiley )
- Excelent for prototyping. (refers to point above)
- Extremely small games. (no graphics, no sound if we don't tweak the language a little bit (lower-fi-sound would be awesome Smiley ) Just plain code.
- No more excuses. Games on that platform can't look better or worse than they can. It's up to the programmer to pour the heck out of every single monochrome pixel.  :D Awesomeness.
- Tweakable. It wouldn't be too hard to add some absolutely simple commands to the language itself to allow things like multiplayer-gaming or... lowest-fi-music?)


So what do you think? Do you have some questions about my idea? Are there major downsides to the idea I didn't notice? I'm pretty interested in this whole thing. Smiley

By the way: Some examples of pure 96x64-monochrome-goodness:











Notice: Most of the screenshots above are taken from games programmed in "Assembly" which is a very, very complicated language. The Metroid- and Contra-ones are Ti-Basic games, but they are pretty restricted anyway. (concerning gameplay, content, pixel-graphics and framerates)


BaronCid


« Last Edit: March 19, 2008, 05:51:02 PM by BaronCid » Logged

I make (60s/70s) rock music. Listen to my band's new album here: www.speicher.bandcamp.com
Farbs
Man
Level 10
*


/Farbs


View Profile WWW
« Reply #1 on: March 19, 2008, 06:02:07 PM »

Wandering off topic a bit, but:

My highschool calculator looked a lot like this:

Except the back panel was missing and it had a standard 9v battery taped to the back of it.

Many a happy hour was spent trying to cram a game into the half a kilobyte of memory the device made available. Did anyone else do this kind of thing?
Logged
shinygerbil
Blew Blow (Loved It)
Level 10
*


GET off your horse


View Profile WWW
« Reply #2 on: March 19, 2008, 06:15:06 PM »

Many a happy hour was spent trying to cram a game into the half a kilobyte of memory the device made available. Did anyone else do this kind of thing?
Yep. Pong and Snake on my old Casio. :D


BaronCid: I'd love to see a compiler for TI-Basic :D
Logged

olücæbelel
FARTRON
Level 4
****


the last man in space


View Profile WWW
« Reply #3 on: March 19, 2008, 09:29:39 PM »

drugwars = ultimate game
Logged

Everything that was once directly lived has receded into a representation. - debord
dustin
Level 6
*


View Profile
« Reply #4 on: March 19, 2008, 10:15:25 PM »

When I have to take a compiler class next year I'll get back to you on how hard this looks Smiley
Logged
Derek
Bastich
Administrator
Level 10
******



View Profile WWW
« Reply #5 on: March 20, 2008, 01:24:04 AM »

Great thread!

Quibble Race started out as a TI-89 game called "Hog Race."  The big draw was that the hogs took shits on the racetrack.



Also, did anybody else play Drug Wars/Pimp Wars in highschool? :D
Logged
team_q
Level 10
*****


Divide by everything is fine and nothing is wrong.


View Profile WWW
« Reply #6 on: March 20, 2008, 06:38:00 AM »

Yeye, I played a lot of Drug wars. heh.
Logged

Dirty Rectangles

_PRINCE OF ARCADE_
Saint
Level 3
***



View Profile WWW
« Reply #7 on: March 20, 2008, 06:47:11 AM »

Heh, I had a TI-82. Made a simple sort of farm sim and played it during boring classes... Looking back now, I wish I had payed attention to what the teacher was saying in some of them, but what are you gonna do  Smiley

I did write a version of the farm sim in HTML/Javascript though. Aside from the graphic upgrade and the variety of crops, it's almost identical; http://hem.passagen.se/px/game/index.html
Logged
Lukas
Level 3
***



View Profile
« Reply #8 on: March 20, 2008, 03:48:28 PM »

Please Note: You don't have to read it all, of course. Just pick out information you need to get an idea of what I mean. Smiley

Hey, thanks for the good feedback.  Grin
I actually kept thinking about it and well... my vision is getting clearer.  :D

Advanced model:
The Compiler itself will be available with a toolkit of useful programmes for Game-Development.
We got:
- a code-editor + interpreter + compiler. (all 3 together in one programme)
- a sprite editor (Basically a Painting-Programme which turns pixelgraphics into
                   lines of code which can be implemented into the programme)
- a simple synthesizer/sequencer (for the creation of low-fi-chiptune     
                                  sounds and music. The applications themselves
                                  are not able to play any soundfile other than
                                  those, created in the low-fi-synth.  :D )


The applications will consist of a folder with the following files and subfolders:

- the .exe itself: The only way to execute a game.
- subprogramme-subfolder: The compiler can compile .exe-files and .subp-files.
                          Explanation following...
- sound-subfolder: Contains all sound data. Sounddata is accessible directly
                   through code in the programme. It is stored in .tis-files.
                   (the synth/sequencer produces .tis-files) (I just made up
                   that filetype. Smiley )
- data-file: In this file (probably a .bin?) all variable-data of the
             application itself is being stored. The application can edit
             it's existing data-file.


About .exe- and .subp-files:
.exe files are executable. As some of you probably remember, the TI-calculators allowed executing other programmes using a certain command which could be included in the code itself. So .subp-files are built pretty much like .exe-files except: They can only be executed by the .exe-file itself.
The developer can choose wether he wants to compile a .exe or a .subp when using the compiler/code-editor.
Subprogrammes (.subp) are very helpful things when developing bigger games.
They actually allow "selfmade commands". If the programmer defines some parameters before executing the Subprogramme, he can basically let anything happen. Smiley
It also helps keeping the code easy to understand:
If you have to execute a long row of commands, you can simply build a subprogramme which contains them all, name it "functionx.subp" (or how you want to call it) and then include a command into you .exe which tells the machine to run the subprogramme which contains all the commands.
(Note, the code will only be able to use .subp-files which are stored in the application's subprogramme-folder)


The commands and logic:
I slightly modified TI-Basic itself so it is even easier to understand, in my opinion.
Since the resources are actually almost "unlimited". (Come on, letting a 3Ghz, 1GB-RAM Computer display graphics with 96x96-monochrome-pixels? My computer's processor is ~600 times faster than a TI83-one) I was able to reduce the amount of different resource-saving-only-commands. I can show of all the commands needed in this post:

(Important: every new line starts with a ":")
(Important: the whole language is absolutely caseUNsensitive)

Basic ones:
- +,-,*,/,log(),sin(),cos(),tan(), root(), ^, (, )  (mathematical)

- # (defines a Variable/String/List-Value/Matrix-Value)

Example 1:
Code:
:5 # VARx      //The variable x now has the Value 5

Example 2:
Code:
:"Hello" # STRtest   //The string test now contains the information "Hello"


- [ and ] (open and close blocks)
              (Blocks are parts of If-, Repeat- and While-operations)
Example:
Code:
:If(x=5)   //If the x-variable has the value 5...
:[       
:Stop     //stop and close the programme...
:]

- If()  (Starts an if-bracket)

Example: See "[" and "]"

- Stop (Stops and closes the programme)

Example: See "[" and "]"

- Return() (Stops a subprogramme and returns to the place the subprogramme was
          executed at)

- Pause (Stops the programme-flow until the user presses the Enter-key)

Example:
Code:
:Output(1,1,"Hello World!")    //writes "Hello World!" on the screen
:Pause                          // waiting...
:Stop                           // Stops and closes the programme
                                 
- wait()     (stops the programme-flow for a certain amount of time) (in ms)
 
- starttimer() (starts a timer and stores the value in a certain variable)(in ms)
- stoptimer() (stops the timer of a certain variable)

Example:
Code:
:starttimer(VARtest)         //starts a timer for the variable "test")
:wait(10000)                 //waits for 10 secs (10000ms)
:stoptimer(VARtest)          //stops the timer of the variable "test")
:output(1,1,Vartest)         //displays the variable's value)

- lbl()     (sets a point int the code. the programme returns to lables through
             goto()-commands.)

- goto()    (searches for a lable and returns to it)


Example:
Code:
:goto(1)        //jumps to "lbl(1)"
:lbl(2)         
:Stop           //stops and closes programme
:lbl(1)
:goto(2)        //jumps to "lbl(2)"

- Repeat()  (repeats the commands in the block until the statement in brackets
             is true)

Example:
Code:
:1 # VARx           //assigns the value 1 to the variable "x"
:Repeat(VARx=4)     
:[
:VARx+1 # VARx      //adds the value 1 to the variable "x"
:]

- While()  (repeats the commands in the block until the statement in brackets
            is not true anymore)

Example:
Code:
:1 # VARx          //assigns the value 1 to the variable "x"
:While(VarX<4)     
:[
:VARx+1 # VARx    //adds the value 1 to the variable "x"
:]

- exec()   (executes a Subprogramme)

Example:
Code:
:exec(SUBPROGRAMME1)   //executes subprogramme1.subp (located in the 
                         subprogramme-folder)

-rand(,)   (corresponds with a random value between the two given in the 
            brackets)

Example:
Code:
:rand(1,10) # VARx    //assigns a random Value between 1 and 10 to the 
                        variable "x"


Logic and test:

- =, >, <, <=, >=   (used in statements for if-, repeat- and while-functions)

Example:
Code:
:If(VARx<=10)       //if the variable "x" has a value equal to- or smaller than
                      10...
:[                   
:Stop               //stops and closes programme
:]

- and, or, xor      (used in statements for if-, repeat- and while-functions)

Example:
Code:
:If(VARx<=10 and VARy=5)       //if the variable "x" has a value equal to- 
                                 or smaller than 10 AND the variable "y" has
                                 the value 5....   
:[                   
:Stop                          //stops and closes programme
:]


Input/Output/Graphics/Sound:

- Output( , , )  (displays a string, variable or a line of charakters on
                  a certain position of the screen)

Example1:
Code:
:Output(1,1,"Hello World!")   //Displays "Hello World!". the line of charakters
                                starts at line 1, column 1

Example2:
Code:
:Output(2,3,STRtest)          //Displays the String "test". the line of
                                charakters starts at line 2, column 3

:Output(3,1,VARtest)          //Displays the Variables ("test") Value. the line
                                of charakters starts at line 3, column 1

Note: A charakter consists of 5x7 black and white pixels. The Screen can hold
      16x12 Charakters (96x96pixels)

- Input()     (pauses the programme-flow. The player has to input
                    a string/number and press the enter-key to continue)

Example:
Code:
:Input(STRtest)  //the player enters a string which will be stored in
                   the string "test"

- ClrHome       (all pixels on the screen are turning white)

- BlackHome     (all pixels on the screen are turning black)

- checkkey()    (checks if a key is being pressed at the moment and stores
                 a 0 or a 1 in a certain variable (pressed=1, not pressed=0))
NOTE: There will be a table of values for every keyboard-key.

Example:
Code:
:Repeat(VARx=0)
:[
:checkkey(1,VARx)   //the variable "x" changes it's value to 1 if the player
                      presses the Escape-Key (the escape-key has the number "1")
:]
- pxlon( , )       (turns the pixel of a certain coordinate (x,y) black)

- pxloff( , )       (turns the pixel of a certain coodinate (x,y) white)

- pxlchange( , )   (changes the color of a pixel of a certain coordinate)

- pxltest ( , , )  (checks a pixel of a certain coordinate and saves it's state
                    (on/off -> 1/0) to a certain variable)
- startsound()     (starts playing a .tis-file from the sound-folder)
- stopsound()      (stops playing a .tis-file from the sound-folder)



Data-management:
There are 4 data-types:
- VAR (variables)
- STR (strings)
- LST (list, a 1-dimensional array)
- MTX (matrix, a 2-dimensional array)

Data doesn't have to be defined. If information is assigned to data, it is being defined automatically in the application's datafile.
If data is being mentioned but not defined, it's default value is 0.

Data always has to be named after a certain scheme:
VAR, STR, LST or MTX have to be the first 3 characters of a certain piece of daa.

Lists always have 100 free slots. (1-100)
Matrices always have 100x100 free slots. (1x1-100x100)
One slot equals one variable.

Strings have a maximum of 100 chracters.

In code, lists and matrices are used like this:

Example1:
LSTtest<1>    -> stands for one value

Example2:
MTXtest<1,1>   -> stands for one value



The virtual screen:
The virtual screen consists of 96x96 "pixels".
This equals 16x12 characters.


Sound:
No exact ideas yet...

 





                       
Logged

I make (60s/70s) rock music. Listen to my band's new album here: www.speicher.bandcamp.com
dustin
Level 6
*


View Profile
« Reply #9 on: March 20, 2008, 05:31:29 PM »

I just read the full post and I have some questions.  Note I have never programmed in tiBasic so maybe some of these questions are weird...


Quote
- a code-editor + interpreter + compiler. (all 3 together in one programme)

1 why would you write your own code-editor instead of letting people choose whatever editor they want?

2.  You do not need an interpreter and a compiler.  You either compile it so it runs nativly or run it through and interpreter I don't really see any reason to have both...

Quote
- the .exe itself: The only way to execute a game.
- subprogramme-subfolder: The compiler can compile .exe-files and .subp-files.
                          Explanation following...
- sound-subfolder: Contains all sound data. Sounddata is accessible directly
                   through code in the programme. It is stored in .tis-files.
                   (the synth/sequencer produces .tis-files) (I just made up
                   that filetype. Smiley )
- data-file: In this file (probably a .bin?) all variable-data of the
             application itself is being stored. The application can edit
             it's existing data-file.



ok so a subprogram is bassically just a function right?  That's what it seems to me.  By a .exe file I assume you mean an executable file of any type.  This is what you'd get from a compiler so I still don't understand the interpreter thing. 


About this data file.  What do you mean that's were the variable-data is being stored.  Variable data would be stored in memory.  Do you mean this is where data can be saved to disk by the program?  If you want all the variables to be here then this should only be done on exit as you don't want be constantly reading from the disk..


About the commands the only ones I see as being actual language keywords are

the math ones (even then these could be functions c++ style)
#
if
stop
return
lbl
goto
repeat
while
and the logic commands

Everything else you listed seemed like just a built in function (not that this is bad the fewer keywords the easier it is to right the compiler in general)

Overall I wouldn't want to write a compiler (as I have no experience and that would mean a different compiler for all os's)

What I could see myself doing is writing a program that simply converts this code into c code or some other popular language and then that can be compiled for whatever os.  Would that be applicable with your vision Smiley ?

Also writing a converter seems pretty doable and then people could implement all the functions as they wished.  I had to write an emulator of similar complexity last year and I had to write it in this random integrated system assembly so writing it in java would be much easier Smiley
« Last Edit: March 20, 2008, 05:34:03 PM by dustin » Logged
Lukas
Level 3
***



View Profile
« Reply #10 on: March 20, 2008, 06:31:35 PM »

Hey dustin!
Thanks for a.) the interest b.) reading all my crazy sh*t up there c.) your willingness to help. :D

Quote
why would you write your own code-editor instead of letting people choose whatever editor they want?

Well, I'd like to achieve something similar to the Processing-interface.
->You can use another editor and Copy-Paste but it's pretty comfortable to work in the environment given. (->Hotkeys for commands etc.?)


Quote
2.  You do not need an interpreter and a compiler.  You either compile it so it runs nativly or run it through and interpreter I don't really see any reason to have both...

I have to admit that I'm not that much of an ace concerning technical stuff. :D
With interpreter I meant: a possibility to run the application directly but... You are right, I guess.


Quote
ok so a subprogram is bassically just a function right?

I guess you could call it a function, yes. I still know the TI83's features pretty well and I liked the whole thing: You had multiple programmes.
I just call them "subprogramme" in my new model because I don't want them to be executable. Some developers wouldn't want players kind of... vandalizing their experience? Smiley I don't really know how to express that.


Quote
About this data file.  What do you mean that's were the variable-data is being stored.  Variable data would be stored in memory.  Do you mean this is where data can be saved to disk by the program?  If you want all the variables to be here then this should only be done on exit as you don't want be constantly reading from the disk..

Maybe this would really be better: The compiler builds the datafile and the application just takes it's data and stores it in the RAM to write it into the file itself when the application is closed again. Is it that what you mean? Smiley


Quote
Everything else you listed seemed like just a built in function (not that this is bad the fewer keywords the easier it is to right the compiler in general)
Yes. It is what makes this language TI-Basic. (anyway, I'd called something else now...) There some built-in-functions/commands, what you may call it that bind the developer to the standarts we give him: The amount of Pixels, characters, etc...


Quote
What I could see myself doing is writing a program that simply converts this code into c code or some other popular language and then that can be compiled for whatever os.  Would that be applicable with your vision  ?

I guess that's a good thing! Your points (the os-crossing, allowing experienced coders to tweak the code a bit or something like that) are actually pretty good!
We should stay in contact over P.M. (and later ICQ?) to work out something. Smiley
Also... If we do succeed we could search for a even more experienced programmer who'd be able to expand our programme so that it compiles directly... (basically baking our programming and a C/whatever-compiler). Let's see...


Wow, I'm so excited. :D


BaronCid

Logged

I make (60s/70s) rock music. Listen to my band's new album here: www.speicher.bandcamp.com
Hideous
That's cool.
Level 10
*****


3D models are the best


View Profile WWW
« Reply #11 on: March 25, 2008, 05:22:36 AM »

This would be amazing. I want a TI calculator now.
Logged

moi
Level 10
*****


DILF SANTA


View Profile WWW
« Reply #12 on: March 25, 2008, 10:45:01 AM »


Quote
- a code-editor + interpreter + compiler. (all 3 together in one programme)
2.  You do not need an interpreter and a compiler.  You either compile it so it runs nativly or run it through and interpreter I don't really see any reason to have both...
Wel if plans to use a bytecode (something like java) then yes, he needs both.
Logged

subsystems   subsystems   subsystems
dustin
Level 6
*


View Profile
« Reply #13 on: March 25, 2008, 10:20:35 PM »

Quote
Quote from: dustin on March 20, 2008, 05:31:29 pm

Quote
- a code-editor + interpreter + compiler. (all 3 together in one programme)
2.  You do not need an interpreter and a compiler.  You either compile it so it runs nativly or run it through and interpreter I don't really see any reason to have both...
Wel if plans to use a bytecode (something like java) then yes, he needs both.

Good point.  That just didn't seem like the way to go in terms of simplicity but good point java has a compiler and interpreter.
Logged
Hideous
That's cool.
Level 10
*****


3D models are the best


View Profile WWW
« Reply #14 on: March 26, 2008, 12:34:35 AM »

Alright, so now you've got me rather interested in these, but there's no way I can afford a TI calculator. Are there any good emulators or anything that I can use?

EDIT: ... I need a ROM from the calculator, which I can only get if I have a calculator. Great.
« Last Edit: March 26, 2008, 12:49:59 AM by Hideous » Logged

Lukas
Level 3
***



View Profile
« Reply #15 on: March 26, 2008, 03:30:03 AM »

ahm... you know that the project is about simulating the best aspects of that calculator+improving it?

By the way... you can afford one for... 50€? I don't think it costs more than that.

BaronCid
Logged

I make (60s/70s) rock music. Listen to my band's new album here: www.speicher.bandcamp.com
Hideous
That's cool.
Level 10
*****


3D models are the best


View Profile WWW
« Reply #16 on: March 26, 2008, 05:28:04 AM »

You know, Cid, there are programs that compile TI-basic into assembly, so you can run games faster:

Wikipedia time:
"Assembly language (often referred to as "asm") can also be used, and C compilers exist for translation into assembly.".
Logged

Lukas
Level 3
***



View Profile
« Reply #17 on: March 26, 2008, 06:34:38 AM »

Quote
"Assembly language (often referred to as "asm") can also be used, and C compilers exist for translation into assembly.".

Yes, but my intention is not to make those games playable on a calculator.
(If I understood correctly) Wikipedia says, that there are compilers which translate C-code into ASM. My project is meant to translate a modified version of TI-Basic into C. Which can be compiled and runs on PCs or Macs.
Thanks for the research, though. Smiley

BaronCid
Logged

I make (60s/70s) rock music. Listen to my band's new album here: www.speicher.bandcamp.com
Hideous
That's cool.
Level 10
*****


3D models are the best


View Profile WWW
« Reply #18 on: March 26, 2008, 08:29:49 AM »

Yeah, I knew that.

But that was just to help you get back into calculator programming Tongue
Logged

Lukas
Level 3
***



View Profile
« Reply #19 on: March 26, 2008, 09:10:51 AM »

Yeah, calculators are really cool... still... you can't download them over internet and unfortunately not everyone has a TI-calculator and the right cable for usb-transfer of data. So it's much easier to share programmes wich run on PCs... and Macs.

BaronCid
Logged

I make (60s/70s) rock music. Listen to my band's new album here: www.speicher.bandcamp.com
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic