Game Development Community

TorqueBASIC: A Scripting Language

by TechLord · in General Discussion · 07/13/2004 (11:48 am) · 143 replies

I love C++ (Torque) and TorqueScript. However, I'm very fond of the BASIC syntax as it was my very first programming language.

I've used other game development 'languages' which used a BASIC syntax and found them relative easy to get started. BASIC Game Dev Languages also have a large customer base. I can see TorqueScript with a BASIC syntax beneficial for Torque in this regard.

Sometime in the unknown future, I'm going to write a TorqueBASIC to TorqueScript Converter or TorqueBASIC Compiler for Torque.

Thoughts wanted.
#21
07/14/2004 (12:41 am)
Isnt TS just a lexx and yacc implementation? in which case, getting a grammer for basic might work.

Of course, I'm not that bothered, never really got into basic much myself.
#22
07/14/2004 (2:21 am)
@Davis,

Hahahah ... the thought did actually cross my mind ;-)

Re: Lua ... I have a 90% complete C++ integration of Lua that works similarly to TGE's console. The interface for defining classes in C++ is possibly similar enough to TGE's that it could work as a replacement to TorqueScript.

I've pondered doing it, but not really looked into it with any degree of seriousness. If there's any interest, I may be persuaded into massaging it into TGE.

T.
#23
07/14/2004 (7:32 am)
Just adding my 2cents :

Implement BASIC and someone will come and beg for LISP. Soon there will be Torque apps made in 30 different scripting languages, somenone will post a request in TorqueBASIC and receive a reply in TorquePascal...

BASIC is a very easy language and it's been a first language for most of us. But I agree with Josh when he says that what made BASIC popular was VB rather than BASIC itself. Not to mention that there were dozens of BASIC dialects.

My first issue : Is there a problem with TS ? Is it hard to learn ? I think the hardest part isn't really the language but the OO implementation ( Datablocks, Classes, polymorphism, etc. ). BASIC won't help it either.

If TS should be replaced, IMHO, I beleive we should go for the market standards : LUA or Python. That would help people so they wouldn't need to learn another language.

Other approach would be making an interface layer between the engine and the script language so that ANY language could be compiled with lexx&yacc and still fit in Torque, maybe doing a TorqueYacc would do the trick. But the reason people rather code their compilers instead of using Yacc is that Yacc's code isn't really the best possible when regarding performance.
#24
07/14/2004 (7:45 am)
I have similar problems here at work with .NET

Developers who are coming from a VB background think it's more appropriate for them to migrate into VB.NET while C++ programmers see C# as a better choice. In reality, they're the same (with minor syntactical differences). I mean, if you took away the semicolons in C# and replaced "{" with BEGIN (or whatever the VB.NET construct is) it would be VB.NET.

While there are lots of people that can pick up TorqueScript with little problem there are others that will just bang their heads against the wall over the syntax because they've been living in the BASIC style construct for so long. LUA, Python, are all the same. A great programmer can pick up any language because principle of a structured programming language are universal.

I'm not a big BASIC dialect kinda guy, but I agree that the more the merrier. A TorqueBASIC would be great because I see it drawing in people from the DarkBASIC and other BASIC like systems. From an implementation standpoint you should be able to find any BASIC interpreter out there and modify it, following TorqueScript as a guideline. Why reinvent the wheel?

At the end of the day, it'll just be a wrapper over top of the current AAA engine that Torque is but in a syntax that's familiar to more people.
#25
07/14/2004 (7:51 am)
Yacc doesn't actually give you a working compiler, just the framework for a tokenizer. You still have to take the tokens you get from Yacc and convert them to a program somehow - and that's where the performance, and the complexity, usually goes. People wouldn't use lex/yacc and co if the problem those tools were addressing wasn't both solved adequately and boring as heck.

And, as I mentioned above, I don't think that Lua or Python are real replacements for TS.

I tend to side with the "let's fix TS rather than add more languages" but on the other hand if by adding basic to Torque we can introduce hundreds or thousands of people to game development, then it's pretty tempting to do that. After all, BASIC is designed with "beginner" in the name, whereas TorqueScript was not. :)
#26
07/14/2004 (8:42 am)
"Implement BASIC and someone will come and beg for LISP. Soon there will be Torque apps made in 30 different scripting languages...

I'm sorry, but I don't see this as a Bad Thing. The ultimate goal of using the TGE is to realize a goal, or a product, IMO. The TG engine is solid, and TS is a great scripting language but it doesn't appeal to everyone. What if you get some enterprising coders to create specific scripting that interfaces to the TGE? As long as they are responsible for maintaining their script/binding/whatever, and not load it onto the GG guys, I'd say go for it.

I would like to point out that while the OpenGL API is coded primarily in C, it has not stopped anyone from producing C++, Eiffel, Python, Euphoria, Ruby, etc. bindings and making OGL available to others more adept in those languages.

I see the TGE as just another API...
#28
07/14/2004 (9:23 am)
Which is the whole point. Once you're in the water it's easy to swim. But how can you get someone in the water to begin with?

You have to start at the shallow end.

Which is what Torque2D and this discussion and many other lines of effort and thought at GG are all about. We want to help people get into the pool, then learn to swim. We already have the deep end ready to go. :)
#29
07/14/2004 (9:28 am)
Most of you are missing the point. Nearly everybody here that has replied to this thread is already "over the hump", i.e. you understand all of the OO stuff that comes along with TorqueScript, C++, etc. BASIC access to the Torque would not be the preferred way to make a game. It would be a gentle bridge for all of the people that use VB, Dark Basic, Blitz, etc.

I am not proposing replacing TorqueScript at all. I just want newbie users to have access to an easily understood language so they can start having fun right away. BASIC would not give you full access to a complex 3D networked system. It would give you access to portions of an extremely powerful, cross platform game engine, so you can learn the basic methodology of the system before moving onto the next concept.

When people want to learn how to program, I don't want to point them to DB and say come back in two years. I want to say, here grab this installable (maybe free?) Torque Demo with bult in BASIC, and go to Dev Master for a bunch of free ground up tutorials that teach you programming. Now, use the built in GUI editor (which is the same from this free version all the way to TSE), use the built in IDE (same thing), etc. In other words, get used to the way we do things in Torque.

-Jeff Tunnell GG
#31
07/14/2004 (9:40 am)
I for one didn't miss the point, Jeff, but I still don't agree with it. Basic's success isn't built on simpler syntax - basic isn't especially easier to learn than C, or pascal, or what have you. I should know, since basic was my first programming language.

The success and simplicity of basic is built on the IDE and the API. If you want to make learning Torque easier on newcomers, add a programming IDE right into the Torque Demo. Let people write and debug scripts easily and in real time in the mission editor. Rebuild a subset API with simplicity in mind, instead of flexibility.

In short, it's the tools, not the syntax.
#33
07/14/2004 (10:33 am)
Quote:Lua is an excellent replacement, Python is not. I've seen all three sides of the equation, inside and out, and know this... You can disagree, but you'll be wrong, and I won't debate about it.

I'm not at all in a position to debate you, and I'm not going to, but I would love to know what makes Lua the better TScript replacement.
#35
07/14/2004 (10:42 am)
You guys are still missing the point:) I ARE A NOOB... you guys are not. I am much closer to the problem than you are.

Bottom line... BASIC is easier to learn than any of the C-like languages. It doesn't have a lot of curly brackets, it has GO-To's, and it is just easier to get something up and running. It does not matter if it can't make a commercial game.

-Jeff
#36
07/14/2004 (10:44 am)
Basic was what I began with and what I wrote my micro-sim mortar firing game with[in 1980, junior year HS...lol]; all these dang dot's and methods git me all mixed up...;) I still find myself wanting to write things like Eric F. describes above, LOL...then; no, I need a dot something and the proper command...and a handle...hahaha. I've not found Torque Scipt overwhelming; and I can see where prior experience is helpful, it has been kinda slow bringing myself up to crawl speed.
#38
07/14/2004 (10:53 am)
JT has, IMO, the point. It's not a debate about whether Lua or is better/stronger/faster or whatever than a BASIC syntaxed language. BASIC is just simpler to learn. I ask you to look at the comments from others in this thread. BASIC was a "first language" for many coders who moved on to C/C++ an so on. We were all NOOBs once... 8^)

Or, maybe it's the *FUN* factor that BASIC seems to have...
#39
07/14/2004 (11:18 am)
Perhapse more to the point would be.

"How far do you want to be able to go with TorqueBASIC?"


Simple text processing?

10 Print "Hello"
20 Goto 10
Note: With or without the line numbers

Perhapse a new GUI control that supports primitive TorqueBASIC graphics statements?
LINE, CIRCLE, PIXEL?

Realisticly with a standard "BASIC" you're not going to be doing anything on the lines of RealmWars.