More Planet/Star Information

The place to discuss creating, porting and modifying Celestia's source code.
kikinho
Posts: 330
Joined: 18.09.2004
With us: 20 years 2 months
Location: Eden, a planet in Etheral Universe

Post #41by kikinho » 22.10.2004, 19:16

Yes, I agree. And I think that is a good idea to add planet information in screen instead of a pop up window. Its because Celestia can calculate the gravity, mass, radius, etc of a body instead of pop up windows.

And if I want to add fictious worlds? If I want to add information to these new worlds. I have to edit every line of gravity, mass, density...

But, if the text is in Celestia, Celestia can calculate automatically all the informations you put in ssc.

I think that it can also be added a new line in .ssc files that specify the mass and density. The mass + density + radius information of a planet could show a gravity value.

And also add greenhouse information in .ssc file. For example: If you put a greenhouse value of 52, 52K will be added to a body. And if you want a lower temperature value to a body, put -82, that will decrease 82K of temperature.

Could also add some transparency to the text? And I think the ideal thing is to put in Celestia.cfg what informations you would like to see. :)

Also, Chris would permit stars be in a distance more that 16.000 ly. That would permit stars in at least near galaxies. Also, permit more distant planets.

With all these features, the next version of Celestia will be much better than without it.
One day we will swim in the subsurface ocean of Europa and take shower in ethane lakes of Titan.

Michael Kilderry
Posts: 499
Joined: 11.10.2004
With us: 20 years 1 month
Location: London, UK

Post #42by Michael Kilderry » 23.10.2004, 03:15

Evil Dr Ganymede wrote:You know, this is a Development forum, not Purgatory. It would be nice if we got back on topic.

Sorry, I can get a bit carried away with the made-up Evil Dr. Europa, Callisto and Mars (I didn't make up Dr. Barsoom though). People do actually get off track quite often. I found one of my forum topics had a lot of new posts and most of them were about beer! And I didn't recall making a beer planet in the Lera Solar System I've created, which is what the topic was about.

kikinho wrote:Also, Chris would permit stars be in a distance more that 16.000 ly. That would permit stars in at least near galaxies. Also, permit more distant planets.


I think a more distant range of stars is a must for Celestia. You can put stars further, but you have to be looking towards where all the other stars are to see it, this is very, very annoying. If possible, I would at least stretch that 16,000 ly region of stars to the edge of the known universe. You could put stars in any galaxy you please! You'd have to implement most of the galaxies first though.

I also like the idea of realistic gravity some how getting implemented into Celestia, if you do it right, it couldn't be too difficult. Then you could experiment with your worlds to see if they crash into each other or fling each other out of their solar systems. It would be great fun! :D

Michael Kilderry :)
My shatters.net posting milestones:

First post - 11th October 2004
100th post - 11th November 2004
200th post - 23rd January 2005
300th post - 21st February 2005
400th post - 23rd July 2005

First addon: The Lera Solar System

- Michael

kikinho
Posts: 330
Joined: 18.09.2004
With us: 20 years 2 months
Location: Eden, a planet in Etheral Universe

Post #43by kikinho » 23.10.2004, 03:23

But i'm not talking about implementing gravity effect, but just only the gravity value appearing in the information text. :!:
One day we will swim in the subsurface ocean of Europa and take shower in ethane lakes of Titan.

Michael Kilderry
Posts: 499
Joined: 11.10.2004
With us: 20 years 1 month
Location: London, UK

Post #44by Michael Kilderry » 24.10.2004, 06:46

If all gravity is going to be is an entry in the information text, then I think that it is pretty useless.

A ggod way of implementing gravity into Celestia would be to have it being able to be switched on and off, so that the program doesn't have to take gravity into consideration decades and decades ago (gravity only works after you turn it on) and so you can play without it. So things are not too complicated, Celestia could only take into compensation things with high enough gravity so that they are going to have a noticeable effect on an objects movement. You could even just set Celestia so only certain objects are affected by gravity.

When two objects collide through the effects of gravity or just on their own, the new world should be bigger as it is the two of them put together. Another good idea is when two objects collide, moons are created in some cases (our own moon formed this way) you could also have rings getting created. If the objects crash into each other and get disrupted, a group of asteroids should be left behind.

When two objects do collide to form a new planet, the new world shouldn't have any textures (unless a small object collides with a big one, in that case you sould be able to see a crater on the bigger object's surface). Because if the new world has no textures, you can make your own! As the object made from the two would probably end up looking a bit different from the two of them if they are more evenly sized. The new object should also be given a name such as eg. planets Jovalera and Pramarr crash into each other, the new combined world is called Jovalera+Pramarr. For this new world, you can specify in an .ssc file which texture it uses, and what proper name you want to give it in Celestia.

Michael Kilderry :)
My shatters.net posting milestones:



First post - 11th October 2004

100th post - 11th November 2004

200th post - 23rd January 2005

300th post - 21st February 2005

400th post - 23rd July 2005



First addon: The Lera Solar System



- Michael

Evil Dr Ganymede
Posts: 1386
Joined: 06.06.2003
With us: 21 years 5 months

Post #45by Evil Dr Ganymede » 24.10.2004, 08:03

Sure, maybe this will happen in Celestia 200.1.4, when we're all running the equivalent of a modern supercomputer on our desktops.... ;)

But til then, putting in gravity is definitely a no-no according to Chris, and modelling collisions is insanely complicated. All this stuff would (a) take a vast amount of effort, (b) radically change Celestia from what Chris wants it to be and he and the developers have got their hands full keeping it on track as it is, and (c) grind Celestia to a halt as it does all the calculations.

I don't think either of you (or other newcomers) realise how much hard effort it would take to implement all these things that you eagerly suggest and claim "wouldn't be too difficult", and how much it would change the program. If you want to try to do it yourself, then you'll have to modify the sourcecode yourself but you'd be pretty much on your own. But saying "it's a good idea" or "it's cool" doesn't make it any more persuasive or more likely to happen.

Michael Kilderry
Posts: 499
Joined: 11.10.2004
With us: 20 years 1 month
Location: London, UK

Post #46by Michael Kilderry » 24.10.2004, 09:05

This sort of implemention of gravity and collisions is going to happen in Celestia 200.13 not Celestia 200.14, Celestia 200.14 is where futuristic holographic technology is implemented allowing us to actually walk on our planets and meet the aliens there. :lol:

If Chris doesn't want gravity to be put into Celestia, I respect that (it's because we haven't nagged enough :lol: ). After all, there are other gravity simulating programs out there where you can remake your solar systems to see what happens, and the whole idea of implementing collisions where worlds break up into a thousand pieces is a liitle overboard, I guess.

Michael Kilderry :)
My shatters.net posting milestones:



First post - 11th October 2004

100th post - 11th November 2004

200th post - 23rd January 2005

300th post - 21st February 2005

400th post - 23rd July 2005



First addon: The Lera Solar System



- Michael

T. C.
Posts: 5
Joined: 27.06.2004
With us: 20 years 4 months

Post #47by T. C. » 25.10.2004, 19:22

DSF wrote:Ken,

If this may help you, I have implemented a little bit more information on the screen tampering with Celestia code, but it was not forthright.

The code I entered, mainly, allows me to see the Body mass, Gravity, Orbital Radius and Density, though more information is easily inserted if you put this into it.

First, I created a nw entry in the ssc files for bodies listing their Mass whigh goes like this:

Mass 5.98E+24

That's earth's mass.
Then, to make Celestia read this information, I added a new private property to the Body class in "body.h":

double mass;

and the following new methods:

double getMass() const;
void setMass(double);
float getDensity() const;
float getGravity() const;

which were defined in "body.cpp" like this:

double Body::getMass() const
{
return mass;
}


void Body::setMass(double _mass)
{
mass = _mass;
}

float Body::getGravity() const
{
return GRAVITATIONAL_CONSTANT * mass / pow(radius*1000, 2);
}

float Body::getDensity() const
{
return mass*1000 / (4 * PI * pow(radius*100000, 3) / 3);
}


Thus, the "CreatePlanet" function in "Solarsys.cpp" had to be altered to actually make Celestia read the information in the ssc files. This was easily done with the following lines:

double mass = 0.0;
planetData->getNumber("Mass", mass);
body->setMass(mass);

inserted at about line 377 of solarsys.cpp (right after the code loads the oblateness data).

Lastly, I modified "celestiacore.cpp" to allow it to display the new extra information, altering the "displayPlanetInfo" method by adding:

if (detail > 2)
{
overlay << "Period: " << body.getOrbit()->getPeriod() << " Earth days\n";
if (body.getMass() > 0)
{
overlay.printf("Mass: %.2E Kg\n", body.getMass());
overlay.printf("Gravity: %.2f m/s2\n", body.getGravity());
overlay.printf("Orbital Radius: %.2E km\n", body.getOrbit()->getBoundingRadius());
overlay.printf("Density: %.2f g/cm3\n", body.getDensity());
}
}

You may notice that the condition "if (detail > 2)" refers to a detail lever which will never be properly selected in Celestia, since its detail levels are 0, 1 or 2. I added a new detail level in the render options menu called "astro" with code 3 that allows for the selection of this new information.

The result:

Image


I am a new Celestia User - it is awesome!

Also I think about more planet information.
I think, this example made by DSF is a good idea, but I don't know what I have to do under Windows 98.

Could someone be so kind and explain me what I have to do - how I can manipulate the code like the example shown above - what programs I need and where I can download there?

Thank you :)

T. C.
Kind regards,

T. C.

Evil Dr Ganymede
Posts: 1386
Joined: 06.06.2003
With us: 21 years 5 months

Post #48by Evil Dr Ganymede » 25.10.2004, 21:14

On a windows system, you need to know C++ and you need to have a Visual C++ compiler. And you need to know your way around the sourcecode ;).

Apparently there's a way to compile the code using some free tools from microsoft, but I don't think wcomer's (I think he was the one who said he found this method?) got round to explaining how to do that yet

wcomer
Posts: 179
Joined: 19.06.2003
With us: 21 years 5 months
Location: New York City

Post #49by wcomer » 25.10.2004, 21:48

Evil Dr,

That's right. Chris is reviewing some minor code changes I've requested and if he approves them I'll put up the walkthrough. It is the difference between most anyone being able to compile and just those comfortable reading compiler errors and manually fixing some minor problems in the source code (not everyone) ; so I think the wait is worth it.

cheers,
Walton

Evil Dr Ganymede
Posts: 1386
Joined: 06.06.2003
With us: 21 years 5 months

Post #50by Evil Dr Ganymede » 25.10.2004, 22:48

That's OK, I'm in no tearing rush :D.

The only language I know is Fortran (and I like it, and nothing anyone says will persuade me otherwise), though I've dabbled enough in other languages to realise that when it comes down to it they're all similar enough in their logic for me to be able to figure out what's going on, so long as I account for things like memory allocation and file I/O.

Brendan
Posts: 296
Joined: 15.07.2003
With us: 21 years 4 months
Location: Bellows Falls, VT
Contact:

Post #51by Brendan » 15.12.2004, 08:57

I tried to make the extra info text display based on DSF's code in the Windows version. The functions for getting and setting the mass were already in the source. So I only needed the functions for finding the density and surface gravity. I also added the new mode to the viewing options and inserted it into the 'V' cycle.
body.h

add the function declarations

Code: Select all

float getDensity() const;
float getGravity() const;


body.cpp

add the line

Code: Select all

#include "astro.h"


add the function definations

Code: Select all

float Body::getGravity() const
{
    return astro::G*mass/pow(radius*1000,2);
}
   
float Body::getDensity() const
{
    return mass*1000/(4*PI*pow(radius*100000,3)/3);
}


celestiacore.cpp

add these lines to displayPlanetInfo

Code: Select all

if(detail>2)
{
    overlay<<"Period: "<<body.getOrbit()->getPeriod()<<"Earth days\n";
    if(body.getMass()>0)
    {
        overlay.printf("Mass: %.2E Kg\n",body.getMass());
        overlay.printf("Gravity: %.2f m/s2\n",body.getGravity());
        overlay.printf("Orbital Radius: %.2E km\n",body.getOrbit()->getBoundingRadius());
        overlay.printf("Density: %.2f g/cm3\n",body.getDensity());
    }
}


change the function setHudDetail from doing %3 to %4

Code: Select all

void CelestiaCore::setHudDetail(int newHudDetail)
{
    hudDetail = newHudDetail%4;
    notifyWatchers(VerbosityLevelChanged);
}


change the % 3 to % 4 for the V case in the big switch statement in charEntered

Code: Select all

case 'V':
    setHudDetail((getHudDetail() + 1) % 4);
    break;


winviewoptsdig.cpp

add those lines after the ones for the other info text cases

Code: Select all

case IDC_INFOTEXT3:
    Dlg->appCore->setHudDetail(3);
    break;


resource.h

add the line

Code: Select all

#define IDC_INFOTEXT3                   50000


celestia.rc

add astro mode by adding the following line after the ones for the other modes

Code: Select all

CONTROL         "Astro",IDC_INFOTEXT3,"Button",BS_AUTORADIOBUTTON,183,142,34,10


change the dimensions of the info text group box by modifying the line to read:

Code: Select all

GROUPBOX        "Information Text",IDC_STATIC,174,90,71,65


;)

I hope I didn't forget anything. :oops:

Brendan

Brendan
Posts: 296
Joined: 15.07.2003
With us: 21 years 4 months
Location: Bellows Falls, VT
Contact:

Post #52by Brendan » 16.12.2004, 18:04

Maybe I'll add a Density entity for ssc files, so if the density computed from the mass and radius is wrong, like for nonspherical objects, it can be overridden. Maybe there could be a custom info text display mode added that would have a CustomInfoText class to print out whatever it is set to display. That would mean making a new dialog box to set up what would be displayed. That means I would need to learn more about the Windows GUI. 8O

Brendan

P.S. If I learn enough about the Windows GUI, maybe I could generalize the eclipse finder GUI. ;)

Brendan
Posts: 296
Joined: 15.07.2003
With us: 21 years 4 months
Location: Bellows Falls, VT
Contact:

Post #53by Brendan » 23.12.2004, 20:20

I got it to use the density in the ssc file if there is one and compute one if there is none.

body.h

add this line after the one for mass

Code: Select all

float density;


add these function declarations after the ones for mass

Code: Select all

float getDensity() const;
float computeDensity() const;
void setDensity(float);


body.cpp

add this line after the initialization of the mass in the constructor

Code: Select all

density(0.0f),


add these function definations after the ones for mass

Code: Select all

float Body::getDensity() const
{
    return density;
}


float Body::computeDensity() const
{
    return mass*1000/(4*PI*pow(radius*100000,3)/3);
}


void Body::setDensity(float _density)
{
    density = _density;
}


solarsys.cpp

add these lines after the ones for mass

Code: Select all

double density = 0.0;
if (planetData->getNumber("Density", density))
    body->setDensity((float) density);
else
    body->setDensity(0.0f);

celestiacore.cpp

make the code for the new info text display look like this:

        if(detail>2)
        {
            overlay<<"Period: "<<body.getOrbit()->getPeriod()<<"Earth days\n";
            if(body.getMass()>0)
            {
                overlay.printf("Mass: %.2E Kg\n",body.getMass());
                overlay.printf("Gravity: %.2f m/s2\n",body.getGravity());
                overlay.printf("Orbital Radius: %.2E km\n",body.getOrbit()->getBoundingRadius());
            }
            if(body.getDensity()>0)
            {
                overlay.printf("Density: %.2f g/cm3\n",body.getDensity());
            }
            else if(body.getDensity()<0)
            {
                overlay.printf("Density: ?");
            }
            else if(body.getMass()!=0)
            {
                overlay.printf("Density: %.2f g/cm3\n",body.computeDensity());
            }     
        }


Brendan


Return to “Development”