Scripting Languages for Celestia
-
Topic authorchris
- Site Admin
- Posts: 4211
- Joined: 28.01.2002
- With us: 22 years 10 months
- Location: Seattle, Washington, USA
Scripting Languages for Celestia
Celestia needs a replacement for the very rudimentary scripting that it currently has. I started out writing my own scripting language, but have decided that I'd be better off using an existing one and spending my time on other Celestia development.
Here's the list of possilbities that Christophe, Fridger, and I have come up with:
Perl
Advantages: familiar, powerful
Disadvantages: big runtime
Python (http://www.python.org/)
Advantages: familiar (though not as much as perl), powerful, probably cleaner than perl
Disadvantages: big runtime
Lua (http://www.lua.org/)
Advantages: tiny, extensible
Disadvantages: small user base
Tcl (http://www.tcl.tk/)
Advantages: tiny, many users, extensible
Disadvantages: wacky syntax
JavaScript
Advantages: huge user base
Disadvantages: fairly large runtime (500k)
As far as size Python and Perl are the largest, and are probably overkill for Celestia. JavaScript is in the middle, and Tcl and Lua are both tiny. I'm quite enamored of Lua at the moment--it's small, clean, easily extensible, but lack's Tcl's aggravating (IMO) syntax. Mozilla's SpiderMonkey implementation of JavaScript looks promising--I just wish it wasn't so big.
--Chris
Here's the list of possilbities that Christophe, Fridger, and I have come up with:
Perl
Advantages: familiar, powerful
Disadvantages: big runtime
Python (http://www.python.org/)
Advantages: familiar (though not as much as perl), powerful, probably cleaner than perl
Disadvantages: big runtime
Lua (http://www.lua.org/)
Advantages: tiny, extensible
Disadvantages: small user base
Tcl (http://www.tcl.tk/)
Advantages: tiny, many users, extensible
Disadvantages: wacky syntax
JavaScript
Advantages: huge user base
Disadvantages: fairly large runtime (500k)
As far as size Python and Perl are the largest, and are probably overkill for Celestia. JavaScript is in the middle, and Tcl and Lua are both tiny. I'm quite enamored of Lua at the moment--it's small, clean, easily extensible, but lack's Tcl's aggravating (IMO) syntax. Mozilla's SpiderMonkey implementation of JavaScript looks promising--I just wish it wasn't so big.
--Chris
Have you looked at REXX? The varant named Regina is available for most platforms. ( I used to use AREXX when I had an Amiga, but that was long ago )
FWIW, quick skim of the Python web site seemed to suggest that there's quite a bit of infighting going on about the direction that the language should be headed.
Whatever language is chosen, I'd be concerned about it getting modified out from under you, making all the (not yet) existing scripts unusable.
Right now there are few enough scripts that it probably doesn't matter which language is chosen in terms of compatibility.
I'd also vote for a small, simple language, not a large, complex one.
FWIW, quick skim of the Python web site seemed to suggest that there's quite a bit of infighting going on about the direction that the language should be headed.
Whatever language is chosen, I'd be concerned about it getting modified out from under you, making all the (not yet) existing scripts unusable.
Right now there are few enough scripts that it probably doesn't matter which language is chosen in terms of compatibility.
I'd also vote for a small, simple language, not a large, complex one.
Last edited by selden on 10.04.2003, 19:52, edited 1 time in total.
Selden
- John Van Vliet
- Posts: 2944
- Joined: 28.08.2002
- With us: 22 years 3 months
re
How about PHP then it would be cross platform , and some what easy to use
one other thing a lot of people all ready know some ? php/html , but perl/pear people are perl and tcl people are tcl people and python peoplelike python
very hard choice witch one
one other thing a lot of people all ready know some ? php/html , but perl/pear people are perl and tcl people are tcl people and python peoplelike python
very hard choice witch one
Last edited by John Van Vliet on 10.04.2003, 19:53, edited 1 time in total.
-
- Posts: 986
- Joined: 16.08.2002
- With us: 22 years 3 months
- Location: USA, East Coast
- John Van Vliet
- Posts: 2944
- Joined: 28.08.2002
- With us: 22 years 3 months
re
hi billybob i think chris means that you have to allready have java on your sys 1/2 meg is about size that java takes up on your systom
-
Topic authorchris
- Site Admin
- Posts: 4211
- Joined: 28.01.2002
- With us: 22 years 10 months
- Location: Seattle, Washington, USA
Some code samples:
Tcl implementation of factorial:
Lua implementation:
REXX implementatioin:
--Chris
Tcl implementation of factorial:
Code: Select all
proc fac {x} {
if {$x <= 1} {
return 1
} else {
return [expr {$x * [fac [expr {$x-1}]]}]
}
}
Lua implementation:
Code: Select all
-- calculate the factorial function
fac = function(x)
if (x == 0) then
return 1
else
return x * fac(x - 1)
end
end
REXX implementatioin:
Code: Select all
factorial: /* calculate the factorial of the argument */
procedure
parse arg p
if p<2 then return 1
else return factorial(p-1) * p
--Chris
Re: Scripting Languages for Celestia
chris wrote:Celestia needs a replacement for the very rudimentary scripting that it currently has. I started out writing my own scripting language, but have decided that I'd be better off using an existing one and spending my time on other Celestia development.
Here's the list of possilbities that Christophe, Fridger, and I have come up with:
Perl
Advantages: familiar, powerful
Disadvantages: big runtime
Python (http://www.python.org/)
Advantages: familiar (though not as much as perl), powerful, probably cleaner than perl
Disadvantages: big runtime
Lua (http://www.lua.org/)
Advantages: tiny, extensible
Disadvantages: small user base
Tcl (http://www.tcl.tk/)
Advantages: tiny, many users, extensible
Disadvantages: wacky syntax
JavaScript
Advantages: huge user base
Disadvantages: fairly large runtime (500k)
As far as size Python and Perl are the largest, and are probably overkill for Celestia. JavaScript is in the middle, and Tcl and Lua are both tiny. I'm quite enamored of Lua at the moment--it's small, clean, easily extensible, but lack's Tcl's aggravating (IMO) syntax. Mozilla's SpiderMonkey implementation of JavaScript looks promising--I just wish it wasn't so big.
--Chris
Hi all,
"Lua" reminds me of a poisonous Brazilian snake;-); yes I spent about
half a year in Brazil, a long time ago (dancing Samba from morning to
night, of course)...
Back to more serious matters:
Perl, Python are great, but definitely overkills...
And moreover: let me do a poll among this illustrous group of 600 "Celestians":
who of you Windows addicts really "speaks" Perl?;-)
Of course, I know exactly who is speaking Perl here, and counting the
'perls' takes less than the five fingers of my hand.
Since Perl is still simpler and better known than Javascript among
non-professionals at least, skip Javascript, too...
Remains Lua/lua;-) and Tcl/Tk, both being small, well embeddable and
extensible.
The glorious days of Tcl/Tk also seem to be over, so let's take
Lua/lua for a change...
Bye Fridger
PS: from now on all my mails will be anonymous, since the write of this mailbox-upgrade code has decided to make the login incompatible with Netscape 4.x.
-
Topic authorchris
- Site Admin
- Posts: 4211
- Joined: 28.01.2002
- With us: 22 years 10 months
- Location: Seattle, Washington, USA
Rassilon wrote:Hey Fridger you speak Perl
I think you should stick with the current setup or use the XML type scripting dtessman was working on for open universe...
The current system is much too limited. There are no variables or flow control constructs . . . Celestia's gotten complex enough that real language features would be useful for creating tutorials, augmenting the UI, extensions, and other things. dtessman's XML stuff is for specifying data files; it would replace .ssc files, not scripts.
I will leave the current scripting system in Celestia, however there won't be any new commands added to it.
--Chris
If I could vote against one, I would vote against Tcl/Tk, as A) I've used it before and I hated it; and B) it's a little too old IMO.
I like the idea of choosing a language whose interpreter is smallest and has the best performance. Let's face it, in the years to come Celestia enthusiasts are going to write some hideously complicated scripts , and we'll want to have chosen the intepreter which can best handle them.
Also, it probably better to choose a newer language, as that language's development typically benefits in hindsight from the problems encountered with other languages, and so is more well-designed and implemented.
Given these considerations, I would choose Lua.
Cheers,
Paul
I like the idea of choosing a language whose interpreter is smallest and has the best performance. Let's face it, in the years to come Celestia enthusiasts are going to write some hideously complicated scripts , and we'll want to have chosen the intepreter which can best handle them.
Also, it probably better to choose a newer language, as that language's development typically benefits in hindsight from the problems encountered with other languages, and so is more well-designed and implemented.
Given these considerations, I would choose Lua.
Cheers,
Paul
-
Topic authorchris
- Site Admin
- Posts: 4211
- Joined: 28.01.2002
- With us: 22 years 10 months
- Location: Seattle, Washington, USA
I agree completely . . . I listed Tcl as a choice, but someone would have to come with an incredibly compelling reason for me to overlook its syntax and actually use it. The expression syntax is just hideous . . . I know it's just syntax, but when doing a lot of math (which at least Celestia scripts will certainly do), concise notation is very important. One of the nice things about Lua is that you overload the arithmetic operators to handle new types that you create with C extensions. So vectors, matrices, quaternions, etc. can be manipulated very naturally . . .Paul wrote:If I could vote against one, I would vote against Tcl/Tk, as A) I've used it before and I hated it; and B) it's a little too old IMO.
I don't think any of the interpreters would have trouble with large programs. Interpreter size doesn't necessarily correlate with performance--in fact, I suspect that Perl or Python might execute programs the fastest, though that's nothing more than intuition.Paul wrote:I like the idea of choosing a language whose interpreter is smallest and has the best performance. Let's face it, in the years to come Celestia enthusiasts are going to write some hideously complicated scripts , and we'll want to have chosen the intepreter which can best handle them.
Here I agree completely . . . Notice that no other language has emulated Tcl's syntaxPaul wrote:Also, it probably better to choose a newer language, as that language's development typically benefits in hindsight from the problems encountered with other languages, and so is more well-designed and implemented.
Paul wrote:Given these considerations, I would choose Lua.
So far, that's my conclusion as well . . . Are there any other small, embeddable interpreters out there?
--Chris
-
Topic authorchris
- Site Admin
- Posts: 4211
- Joined: 28.01.2002
- With us: 22 years 10 months
- Location: Seattle, Washington, USA
I've been experimenting with integrating Lua into Celestia. Here's very small taste of the likely future of scripting in Celestia--the first Lua script to run in Celestia:
This is a lot of fun
--Chris
Code: Select all
celestia:flash("Hello")
celestia:show("boundaries", "constellations", "orbits")
This is a lot of fun
--Chris
Chris,
I'd never heard of Lua until you posted this but having taken a quick look at it it really does seem to be the best choice by far. As a committed Perl fanatic I'd love to see Perl scripting capability in Celestia but it would be overkill from a size point of view and to be fair to Lua it crams a very impressive amount of functionality into a very small package.
As someone who really wants to do some intricate scripting with Celestia I've been hoping for major developments in this area for some time. If it requires that I learn (quite) a bit about Lua in the process then I'm very happy to do that, as I'm sure are many others.
JoeM
I'd never heard of Lua until you posted this but having taken a quick look at it it really does seem to be the best choice by far. As a committed Perl fanatic I'd love to see Perl scripting capability in Celestia but it would be overkill from a size point of view and to be fair to Lua it crams a very impressive amount of functionality into a very small package.
As someone who really wants to do some intricate scripting with Celestia I've been hoping for major developments in this area for some time. If it requires that I learn (quite) a bit about Lua in the process then I'm very happy to do that, as I'm sure are many others.
JoeM
"The current version is Lua 5.0, released on 11 Apr 2003"
"Lua means moon in Portuguese and is pronounced LOO-ah. "
http://www.lua.org/
"Lua means moon in Portuguese and is pronounced LOO-ah. "
http://www.lua.org/