Feature request: time jump

General discussion about Celestia that doesn't fit into other forums.
Topic author
renTor

Feature request: time jump

Post #1by renTor » 04.02.2004, 11:30

I would like an option to (auto (every n ms)) increment/decrement time with a given amount of time like a day or a year. This should be nice for example for watching the motion of the moon and the planets every evening 8 o'clock.
This one is fairly simple to implement I think, so maybe in 1.3.2 it could be implemented...

Also very nice: an option to grab a series of images with a given amount of time between the capture dates. This could also be used instead of the capture movie function, without the limitations of the avi file format (i.e. 2GB size limit)

hope this could be done!

Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 8 months
Location: Germany

Re: Feature request: time jump

Post #2by Harry » 04.02.2004, 12:17

renTor wrote:I would like an option to (auto (every n ms)) increment/decrement time with a given amount of time like a day or a year. This should be nice for example for watching the motion of the moon and the planets every evening 8 o'clock.
This one is fairly simple to implement I think, so maybe in 1.3.2 it could be implemented...

Is there anything wrong with using a script for this?

Harald

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

Post #3by selden » 04.02.2004, 15:21

Harold,
You wrote
Is there anything wrong with using a script for this?

Are you implying that such a script command already exists?
If so, what is it?

Or are you asking so you can consider some implementation tradeoffs?
Selden

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

Post #4by selden » 04.02.2004, 15:57

To clarify, script commands exist to set the simulated time and to pause for a while, but I know of no script command to take a snapshot of Celestia's window.

e.g.

Code: Select all

time { jd 22222.5 }   # set the time in the simulation to a specific julian date
#or
time { utc "2003-11-05T12:12:12.54"} # set the time to a specific Gregorian date: year-month-dayTh:m:s.s
timerate {rate 0.01}  # run time in the simulation at 1/100 normal
wait {duration 1.0}  # do nothing for 1 second of real time
Selden

Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 8 months
Location: Germany

Post #5by Harry » 04.02.2004, 17:43

selden wrote:To clarify, script commands exist to set the simulated time and to pause for a while, but I know of no script command to take a snapshot of Celestia's window.

Taking snapshots is not possible using scripts, I was only referring to changing the time.

But if there is demand for this, I could have a try at implementing it. There is one thing to consider: this will allow scripts to fill up the HD - is this an acceptable risk?

Harald

UPDATE: A possible safeguard against filling the HD would be a setting in celestia.cfg which limits the number of screenshots a script is allowed to take, defaulting to 0. Oh, and setting a path where to save them wouldn't be a bad idea either.

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

Post #6by selden » 04.02.2004, 18:26

Harald,

Being able to do snapshots from a script would be extremely useful, even if it risks filling up a disk.
Selden

Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 8 months
Location: Germany

Post #7by Harry » 04.02.2004, 19:08

selden wrote:Being able to do snapshots from a script would be extremely useful, even if it risks filling up a disk.

I wish my TODO-List would get shorter, instead of longer ;)

Harald

Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 8 months
Location: Germany

Post #8by Harry » 04.02.2004, 21:16

Update: I've got screenshots working, with a per-script-limit (defaults to no screenshots) and a target-directory which can be set in celestia.cfg, but currently PNG only. There is no warning before overwriting files, but as they are all called screenshot-xyz.png and you can choose the directory, this shouldn't be a problem.

I will clean it up a bit, maybe add a way to choose between JPG and PNG, and then check it in (if there are no complaints ;) )

Harald

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

Post #9by selden » 04.02.2004, 21:34

Harry,

I assume the "xyz" field corresponds to a frame number.

It'd be very useful if that field could be a fixed width, larger than could possibly ever be needed (at least 7 digits), with leading zeros, so as to avoid all sorts of contortions in the scripts that'd be combining the frames into a continuous movie.

Thanks!!!
Selden

don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 9 months
Location: Colorado, USA (7000 ft)

Post #10by don » 05.02.2004, 00:10

Greetings,

Gee wiz, sleep in a few hours longer and miss a whole new function! Sheesh!

Nice work Harald!

Harald, what parameters can be passed to this function? Specifically, can the user specify at what rate to capture images? Does the function take into account the current FPS rate of the user's system, so that it doesn't try to capture images more frequently than is possible, thus messing things up or possibly causing problems in Celestia?

Personally, I prefer JPG over PNG due to size. You might also want to consider GIF, for easy GIF animation use.

I agree with Selden that a LONG pre-defined number be used as a sufffix to the filename --or-- use the Julian Date.

I sure wish there was a cross-platform video capture library out there that was this easy to implement!

Cheers,

-Don G.

Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 8 months
Location: Germany

Post #11by Harry » 05.02.2004, 02:20

don wrote:Harald, what parameters can be passed to this function? Specifically, can the user specify at what rate to capture images? Does the function take into account the current FPS rate of the user's system, so that it doesn't try to capture images more frequently than is possible, thus messing things up or possibly causing problems in Celestia?
The function only takes a single screenshot, so no arguments at all (yet). Taking a screenshot takes quite some time (up to >1s on my system), so the FPS isn't relevant anymore :(

I am afraid there will be some problems with gotos, which use their own, independent timing, and there is no easy solution for this.

don wrote:Personally, I prefer JPG over PNG due to size. You might also want to consider GIF, for easy GIF animation use.
I will add JPG anyway, but the code to take screenshots doesn't support GIF. It's easy to let the script decide the format.
don wrote:I agree with Selden that a LONG pre-defined number be used as a sufffix to the filename --or-- use the Julian Date.

I've been thinking about using dates, but it would make some long and cumbersome filenames. A simple incrementing serial number is IMHO a good solution - maybe I will add a paramter to let the script choose an id for the screenshot, such that the name is "screenshot-id-number.png". I just want to make sure the script can't deliberately overwrite files with a given name, so I will leave the "screenshot-" prefix.

Harald

renTor
Posts: 1
Joined: 04.02.2004
With us: 21 years 3 months
Location: Delft, Netherlands

Post #12by renTor » 05.02.2004, 02:58

Nice work Harald, this makes the .cel scripting language a bit more complete, though it isn't yet possible to set time relative, like time +100 s or so, is it?
Thus for every situation a script has to be made... and the script has to be loaded every step (if it was possible to step)....

Till now I hadn't heard of the lua scripting language, so I didn't see a way to implement an easy to acces time jump script, but I'll take a look at lua, looks much more valuable for plugins e.a.
The .cel seems to be more an easy presentation language, which is also usefull at its times, so don't make it too complicated ;)

For the screenshot function in .cel maybe its nice to ask for a filename the first time the function is called, with also an option to cancel all screenshots in the script. Then add a (fixed or variable) number of digits to the name.

When the screenshot function will be implemented in lua it may have a more complicated syntax, maybe the script can choose the filename and type or so.

jpeg and png are enough for most actions, they can be converted to avi, mov, ogm, etc. by mencoder of transcode, though a uncompressed format like tga can be handy too, since it needs less cpu power, and virtualdub reads only bmp and tga.
Of course it would be nice to pipe the datastream to mencoder or transcode, but not needed :)

Piers

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 23 years 3 months
Location: Seattle, Washington, USA

Post #13by chris » 05.02.2004, 08:53

Harald,

Great feature! This is a very useful addition to Celestia scripting.

don wrote:Personally, I prefer JPG over PNG due to size. You might also want to consider GIF, for easy GIF animation use.


I'm really not interested in supporting GIFs. The fact that it can handle no more than 256 colors in an image makes it practically useless for Celestia. I wish the format would just go away. If someone's really interested in making an animated GIF, they can simply use another tool to build one from a sequence of JPGs and PNGs.

--Chris

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 23 years 3 months
Location: Seattle, Washington, USA

Post #14by chris » 05.02.2004, 08:58

renTor wrote:Nice work Harald, this makes the .cel scripting language a bit more complete, though it isn't yet possible to set time relative, like time +100 s or so, is it?
Thus for every situation a script has to be made... and the script has to be loaded every step (if it was possible to step)....

For Lua scripts, you can set the time relative to the current time like this:

Code: Select all

-- Advance one hour
celestia:settime(celestia:gettime() + 1/24)


In .cel scripts it's trickier . . . About all that you can do is set the time acceleration and call wait, so that the time scale times the wait duration equals your relative time adjustment.

--Chris

Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 8 months
Location: Germany

Post #15by Harry » 05.02.2004, 12:39

renTor wrote:Nice work Harald, this makes the .cel scripting language a bit more complete, though it isn't yet possible to set time relative, like time +100 s or so, is it?
Uh, who said I was talking about CEL-scripts? :o This is implemented for Lua-scripting, and I think it wouldn't make nearly that much sense in CEL-scripts.
renTor wrote:Thus for every situation a script has to be made... and the script has to be loaded every step (if it was possible to step)....
This isn't a problem when using Lua-scripting :)
renTor wrote:For the screenshot function in .cel maybe its nice to ask for a filename the first time the function is called, with also an option to cancel all screenshots in the script. Then add a (fixed or variable) number of digits to the name.
That would be nice, but this is only possible by including UI-dependent code, which I believe isn't a good idea for various reasons. The current solution should be good enough.
renTor wrote:When the screenshot function will be implemented in lua it may have a more complicated syntax, maybe the script can choose the filename and type or so.

Type is ok, but I will not allow the script to freely choose a filename - this would introduce unnecessary risks.

Harald


Return to “Celestia Users”