Page 1 of 1

Beginning and end in markers

Posted: 27.07.2009, 00:24
by eburacum45
Hi! Scripting is something I haven't tried before, and I must confess my complete ignorance at this time. However I've had an idea for a use of markers that would be very useful to me, and I wonder if there is any way that it can be done.

My plan is to show the advance of colonisation in the fictional Orion's Arm scenario over time- starting with the Solar System, and gradually expanding for the next ten thousand years until there are colonies several thousand light years away in all directions. Anyone who remembers Carl Sagan's Cosmos might know the sort of effect I mean to get.

The problem is, as I understand it the markers in Celestia do not obey Beginning and ending commands. Is this correct, and is there any way I could work around it? Once I have a few worked examples I should be able to complete the animation eventually- although with thousands of colonies to locate, this might be a very long job.

Re: Beginning and end in markers

Posted: 27.07.2009, 05:37
by Chuft-Captain
eburacum,

Have a look at this script by Vincent: http://shatters.net/forum/viewtopic.php?f=4&t=13945&p=116492#p116492
It's not designed for what you want exactly, but may give you some ideas.

The bit you should be interested in, is the line in red below:
function GotoStartDate()
sel = celestia:getselection()
t0 = sel:getinfo().lifespanStart
if t0 and math.abs(t0) > 1e-10 then
celestia:settime(t0)
end
end

You may be able to compare the lifespanStart of each colony to the simulation time in order to decide whether it should be marked at that particular time, however this could mean iterating through all of them at each time point that you want to check, so is not very efficient (given the number of colonies).

A more efficient method, is to iterate through all your colonies in lifespanStart order, adjusting simulation time to match each lifespanStart as you go.
However, making a script handle them in lifespanStart order is as far as I'm aware not that straight-forward in celX.
I assume they're also different types of objects as well (some stars, some planets, some spacecraft), which is potentially a complication as well.

Can you explain in more details about the nature of your addons and what you want to achieve in the animation?
eg. Do you want to increase time at a regular rate?... or do you want to jump forward one by one to the relevant start dates of each of your colonies, marking them as you go?

CC

Re: Beginning and end in markers

Posted: 27.07.2009, 18:34
by eburacum45
Well, we'll forget about the colonisation of the Solar System for now, as that would be on a completely different scale.

The animation I should like to make involves the colonisation of different stars, and so would start with the stars nearby to Sol, and gradually expand outwards as more and more stars are colonised. For instance a marker would appear at Alpha Centauri in 2252, another one at Tau Ceti in 2457, one at Sigma Draconis in 2547, and so on. The rate of colonisation does accelerate later, as the spacecraft become more advanced, but at no time does the colonisation exceed the speed of light.

Sometimes colonies would fail, and sometimes they would be recolonised (as at 61 Virgini).

If I could make such a script, I could then use it to make an animation, probably viewed from galactic north, starting with only the stars near Sol visible, but gradually increasing in angle of view. It would be nice to include different colours and shapes of markers, to distinguish the different factions involved in the colonisation- but that is not essential.

Re: Beginning and end in markers

Posted: 28.07.2009, 10:59
by Chuft-Captain
BTW. You should commit to learning CELX/Lua scripting rather than the more basic CEL scripting for this task.

eburacum45 wrote:Well, we'll forget about the colonisation of the Solar System for now, as that would be on a completely different scale.
Scale is not a problem as you can set the distance and FOV to whatever value you want from within the script.

eburacum45 wrote:The animation I should like to make involves the colonisation of different stars, and so would start with the stars nearby to Sol, and gradually expand outwards as more and more stars are colonised. For instance a marker would appear at Alpha Centauri in 2252, another one at Tau Ceti in 2457, one at Sigma Draconis in 2547, and so on. The rate of colonisation does accelerate later, as the spacecraft become more advanced, but at no time does the colonisation exceed the speed of light.
If you want to demonstrate the increasing rate of colonization, then this implies that your script will increase time at a constant rate. (eg. 100 years /sec would give a 100 second animation for 10,000 years)
This however, has implications for the efficiency of your algorithm... ie. you wouldn't want your script to have to check the begin date of every single colony at every 100 year point in time in order to decide whether to mark it or not... this would be very slow.... You will need to somehow organize your objects in time-order (either manually or within the script) so that the script can handle them efficiently when marking them for the animation.

eburacum45 wrote:Sometimes colonies would fail, and sometimes they would be recolonised (as at 61 Virgini).
Do you want to also UN-mark them in this case?

eburacum45 wrote:... It would be nice to include different colours and shapes of markers, to distinguish the different factions involved in the colonisation- but that is not essential.
This actually very easy... http://en.wikibooks.org/wiki/Celestia/Celx_Scripting/CELX_Lua_Methods/Celx_object#mark

CC

Re: Beginning and end in markers

Posted: 06.08.2009, 13:43
by eburacum45
I think that I may have to use meshes, assuming that they do obey 'beginning and ending' declarations.