Request: Sending commands to Celestia from an external prog.

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
StevenBarjek

Request: Sending commands to Celestia from an external prog.

Post #1by StevenBarjek » 07.11.2002, 06:14

I would like to be able to send commands from another program to Celestia so I can use it as a reference guide for some notes I take on different planets.
An ideal application of it would be able to select and goto a planet by an external trigger with some sort of GUI and then interact with objects as well, having a click on an object pull up a webpage or a document associated with it.
Is anything like this possible?

Any help is appreciated,
Signed,
Steven Barjek
steve@barjek.com

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 5 months
Location: NY, USA

Post #2by selden » 07.11.2002, 11:48

Steven,

Celestia has several different ways to display notes you write, but as part of static menu items. They can't be added dynamically at runtime in quite the way you'd like.

You could add them to the file guide.cel in Celestia's root directory, for example. Its descriptions are shown in the Navigation menu item "Tour Guide".

A somewhat more dynamic technique would be to use the new InfoURL option. You can write Web pages and add an InfoURL descriptor to the appropriate entries in solarsys.ssc (or to whatever .ssc you create). The InfoURL links are invoked from the popup menu that appears when you right-click on an object visible in Celestia's display. By default the menu item Info goes to a couple of different Web sites. (This option requires 1.2.5 or later.) Adding all the explicit InfoURL commands would be a pain, but the contents of the referenced pages could be changed at any time.

[added later] A third option would be to use Celestia's scripting option and use its Print command to display your notes on the screen. They'd be more awkward to invoke, since you'd have to specify the appropriate script using the File menu. The print command only displays the specified text string, it can't reference another file.

Unfortunately, remote scripting would require someone to write the code to incorporate an inter-process communications module that would invoke the various scriping command routines. Preferably it'd use sockets so Celestia could be controlled from other networked systems, or one system could control multiple Celestia displays simultaneously. That, plus a program that sends a command string while retrieving tthe results of the previous command, would make so many other things possible.

It's rather frustrating. Operating systems like AmigaDOS and BeOS include IPC in their basic design and come with utilities that make it look so easy. If such a thing could be incorporated in Celestia, it'd substantially reduce the amount of (so far unwritten) scripting support built into Celestia, since conditionals and looping (for example) could be provided by whatever scripting language one likes. Even perl ;)

So as it currently stands, the direct answer is no. :(
Selden

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 7 months
Location: Lyon (France)

Post #3by Christophe » 07.11.2002, 13:42

selden wrote:Unfortunately, remote scripting would require someone to write the code to incorporate an inter-process communications module that would invoke the various scriping command routines. Preferably it'd use sockets so Celestia could be controlled from other networked systems, or one system could control multiple Celestia displays simultaneously. That, plus a program that sends a command string while retrieving tthe results of the previous command, would make so many other things possible.

It's rather frustrating. Operating systems like AmigaDOS and BeOS include IPC in their basic design and come with utilities that make it look so easy. If such a thing could be incorporated in Celestia, it'd substantially reduce the amount of (so far unwritten) scripting support built into Celestia, since conditionals and looping (for example) could be provided by whatever scripting language one likes. Even perl ;)


On the KDE version you can already go to a specific location using urls from Konqueror or the shell. For a more advanced control I could quite easily add a DCOP interface that would provide that kind of IPC/RPC mecanism. I was actually planning on doing it but haven't found the time to do it yet. With that you could control Celestia from the shell, perl, python... or even through XML/RPC from a remote host (not sure that's useful though). Adding RMB menu items could be done with DCOP too.

On Windows I think that COM provides that kind of facility, but I don't know how difficult it is to implement.

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 5 months
Location: NY, USA

Post #4by selden » 07.11.2002, 15:50

Christophe,

If it can be done so that it'll work on both (all) systems, that would be best. I think it would be better to use a somewhat ineffecient portable solution than a proprietary one like DCOM.

Thanks for investigating.
Selden

SteveBarjek

Thanks for the input!

Post #5by SteveBarjek » 07.11.2002, 16:21

For the time being I can try and use the existing functions to see if I can get my idea out in some form. My ideal application would be to have a program manage menus and database access. Hopefully I would be able to make a tree where I can add new notes and records on the GUI, and have Celestia goto the planet or moon I am adding notes to.
I love Celestia as is so far, and appreciate your efforts! Thanks for investigating this as well.

SteveBarjek

Need interaction afterall...

Post #6by SteveBarjek » 07.11.2002, 17:33

Once the new version with a working InfoURL function is out, I think I can use it for the time being without interaction... Yet, I will need it at some future point.

irguy

use TCL

Post #7by irguy » 07.11.2002, 22:15

The need for this capability also crossed my mind a while ago. I recommended using TCL (http://www.tcl.tk) as the IPC and scripting language for Celestia. TCL is a free cross-platform scripting language and IPC that is designed from the start to be embedded into other applications for remote control and access.

I planned to take a shot at wrapping the current Celestia scripting calls in TCL (that way you get both), but I haven't had the time. Based on previous work I've done with TCL, I really think this would be a fairly simple thing to do. The internals of the Celestia scripting engine could probably be modified (perhaps with the use of templates) to create the TCL command wrappers automagically. Thus, preventing a maintenance headache.

Once Celestia can be controlled by another app., a whole wealth of possibilities emerge.

Rassilon
Posts: 1887
Joined: 29.01.2002
With us: 23 years
Location: Altair

Post #8by Rassilon » 07.11.2002, 22:27

is InfoURL invoked as: InfoURL "http://www.myurl.com" ??

And where is it placed in the ssc file??

Like:

"earth" "sol"
{
InfoURL "blah"

nm I see it now under Charon :P

InfoURL "http://www.nineplanets.org/pluto.html#Charon"
I'm trying to teach the cavemen how to play scrabble, its uphill work. The only word they know is Uhh and they dont know how to spell it!

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 5 months
Location: NY, USA

Post #9by selden » 08.11.2002, 00:28

yes.
Selden

SteveBarjek

Applications...

Post #10by SteveBarjek » 12.11.2002, 17:41

A couple of applications that could use Celestia with this feature:

An interactive webpage (my intention) that makes calls to some external program that then sends commands to Celestia to goto a location that is referenced in the webpage. That way, since InfoURL can call a page it can work both ways (having a page that calls up something in Celestia).

A database of notes that can use Celestia to view a location specified in the database.

Other applications could write out temporary Celestia scripts, and then have Celestia execute these scripts. Or bypass the temporary file all together and have the program send commands directly to Celestia for use with interactive demos.

Having Celestia able to take commands could open up Celestia to be widely used in many ways such as irguy has said.

SomeGuyNamedEric

Controlling Celestia from an external program

Post #11by SomeGuyNamedEric » 12.11.2002, 21:43

I, too, would like to be able to send commands to Celestia from an external program, but what I want to do is a little more than simply referencing a location from an external link.

I'd like to be able to have an external program place and move multiple objects such as spacecraft and continutally update their positions and orientations based on information from the external program.

Why? Well, people have created fictional solar systems within Celestia before, but entire fictional universes have been created for online text-based multi-user roleplaying games called MUSHes. These games often provide the ability to navigate a virtual spacecraft through the virtual universe.

Problem is, it's all text-based.

Several MUSH client (such as MUSHclient, for windows) programs have the ability to control other programs through scripting. It would be interesting if Celestia allowed itself to be controlled by such a program, allowing players to see the movements of in-game planets, stars, and vessels rendered graphically rather than as lists of coordinates and bearings.

astroballu
Posts: 6
Joined: 11.11.2002
With us: 22 years 3 months

I've developed a celestia server which takes in commands .

Post #12by astroballu » 27.11.2002, 09:41

hi i've recently developed a server for Celstia which accepts client connection on some specified PORT (i used 5555). The client passes the commands in the form of the scripts (the usual cel scripts) and then the server runs the scripts and the changes are ON the CELESTIA SCREEN...


Hope this is going to help someone trying to remote control Celstia.....
There are a lot of possibilities as the client can be ay thing which could send in scripts to the server....

The development i've done works well on WINDOWS as i have no access to any other systems.. .I feel porting to any other platform should not be much of a problem.....

Anyone needs the EXE and code fixes can mail me!!!

mailto://astroballu@yahoo.com

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 5 months
Location: NY, USA

Post #13by selden » 27.11.2002, 11:27

Astroballu,

If you haven't already, I strongly urge that you provide Chris with the source code for the server and the mods to Celestia for inclusion in the SourceForge archives. That way Windows users can enjoy using them soon and Linux and Mac people will have a chance to port them.
Selden

SteveBarjek

All praise to thee Astroballu!

Post #14by SteveBarjek » 29.11.2002, 05:35

Astroballu,

Thanks indeed! This seems perfect for what I wanted to use it for. :)
Forgot to mention in my email, but yes indeed send all you have to Chris please.

Thanks again.

:) :D


Return to “Development”