Notifications
Clear all

Editing System Information


Thargoid
(@thargoid)
Senior Chief Registered
Joined: 12 years ago
Posts: 67
Topic starter  

Just a quickie: Is the information on http://eatenbyagrue.org/f/pioneer/coded ... s.BodyType still true? I tried to use a GRAVPOINT for the main part of the system (ie trying to make a binary with other planets orbiting the barycentre, not the individual stars) and I make Pioneer quite upset when doing this.

And I apologise for my ignorance but how do you make comments in the code, i.e leave the code in there but make it invisible so it doesn't try to read it? I looked up some LUA stuff and it suggested ==[ and ==] but that didn't work.

Thanks

John


Quote
Brianetta
(@brianetta)
Commander Registered
Joined: 13 years ago
Posts: 863
 

--[ and --] for Lua block comments.


ReplyQuote
Potsmoke66
(@potsmoke66)
Captain Registered
Joined: 7 years ago
Posts: 1815
 

comments in LUA scripts are marked like this,

"--" (double dash) to mark the following glyphs in the line as comment

"--[[" (double dash, double open square bracket) to open a comment, no matter how many lines.

"--]]" (double dash, double close square bracket) to close a comment.

"----[[ "(double dash in front of open comment), "temporarely" disables a comment (i.e. you disabled some code to test the script and like to re-enable it quick).

attention!

❗ comment's cannot be nested (no "--[[" and a further "--[[" or no "----[[" and any further "--[[".

❗ take care, some text editors make from a "--" a long "-", that won't work!

could be "--[" works to, i just copied that behave from "pimodels.lua" i.e..


[/hr]

i'm not sure, but it looks like "GRAVPOINT" isn't supported no more?


ReplyQuote
robn
 robn
(@robn)
Captain Registered
Joined: 13 years ago
Posts: 1035
 

You'll need to post exactly what you're trying to do, and what happens when you do. Gravpoints in custom systems worked when custom systems were first implemented. We don't have any systems that use it in the codebase though, so there may be a regression that we haven't caught. A reproducable case will let us check and fix the bug, if there is one.

Regarding comments, -- is Lua's comment marker. ... is a multi-line string literal. Thus, --... makes a multi-line comment. Those are the only rules around comments. Everything else potsmoke66 mentioned (end multi-line comments, disable comment, no nested comments) falls out from those two rules.


ReplyQuote
Thargoid
(@thargoid)
Senior Chief Registered
Joined: 12 years ago
Posts: 67
Topic starter  

Thanks everyone.

Robn, by wanting a sample, should I be asking for a pull request on that file for you to see it or is there another way? maybe a screenshot of the code and a screen shot of the error message?


ReplyQuote
Potsmoke66
(@potsmoke66)
Captain Registered
Joined: 7 years ago
Posts: 1815
 

i don't like to interrupt, but i do

Quote:
Regarding comments, -- is Lua's comment marker. ... is a multi-line string literal. Thus, --... makes a multi-line comment. Those are the only rules around comments.

i guess this is a good example for "bad" explained to a novice.

if you're familiar with it, your expression is true and enough to know, truely anything else falls from it.

but for one that isn't experienced in the matter, it's not enough and nothing will "fall" by itself, what's logical to one must not be logical for another one. or you need to know the connotation first, then it falls from it.

that's why i usually start at "stoneage" with my explanations 😉


[/hr]

my master was such meticulous, when i wrote "take a sponge" he was able to ask "how do i take a sponge".

but as a result you could take my books, read them and start printing...


ReplyQuote
robn
 robn
(@robn)
Captain Registered
Joined: 13 years ago
Posts: 1035
 

I don't mind. Pull request is probably an overkill. Just a link will be fine, or throw it in a pastebin, or past it here. I'm only checking your code so it doesn't have to be anything formal. Same for the error - post the text or a screenshot here, or in an image drop, or whatever.


ReplyQuote
Marcel
(@marcel)
Captain Registered
Joined: 7 years ago
Posts: 1188
 

Thargoid, are you using LuaEdit? http://luaedit.sourceforge.net/

It'll make things much easier. For example, disabled code is colored green.


ReplyQuote
robn
 robn
(@robn)
Captain Registered
Joined: 13 years ago
Posts: 1035
 
potsmoke66 wrote:
Quote:
Regarding comments, -- is Lua's comment marker. ... is a multi-line string literal. Thus, --... makes a multi-line comment. Those are the only rules around comments.

i guess this is a good example for "bad" explained to a novice.

Perhaps, perhaps not. Your explanations might have been practical, but I wonder if a novice would read them and infer the existence of language features that don't actually exist, which may lead to later confusion. What I wrote is the bare minimum necessary to construct the rest of your examples. Now this thread has two complementary explanations, and is better for it.


ReplyQuote
Thargoid
(@thargoid)
Senior Chief Registered
Joined: 12 years ago
Posts: 67
Topic starter  

Hey

I wasn't using Luaedit, I was just using notepad, but I am now and it looks much nicer. Reminds me of MATLAB that I had to use back at University.

The code is a bastard of the Epsilon Eridani system that I havent finished changing and works if i substitute the gravpoint for a brown dwarf. The error message is attached.

The code is below. Thanks for your help.

And I did understand pot smokers comments about comments. And yours too Robn.

local s = CustomSystem:new('Tolan', { 'GRAVPOINT' })

:govtype('PLUTOCRATIC')

:short_desc('Tolan Kingdom. Terraformed world with introduced life. Isolationist')

:long_desc(Little is known about the Tolan Kingdom System. Tolan Oberon and his descendents have ruled for over six centuries. They have a strong police force and most activities are illegal. Traders from outside are welcome, but only at the designated starports. Entering the cities or landing anywhere but the starports without the correct documentation carries the death sentence.)

local epserid = CustomSBody:new('Tolan', 'GRAVPOINT')

:radius(f(7,10))

:mass(f(61,110))

:temp(4584)

local icarus = CustomSBody:new('Tolan A', 'STAR_A')

:seed(13)

:radius(f(42,100))

:mass(f(41,100))

:temp(687)

:semi_major_axis(f(17,1000))

:eccentricity(f(205,1000))

:rotation_period(f(12,1))

local pritchard = CustomSBody:new('Tolan B', 'STAR_F')

:semi_major_axis(f(40,1000))

:eccentricity(f(100,1000))

:rotation_period(f(6,1))

local atlantica = CustomSBody:new('Atlantica', 'PLANET_TERRESTRIAL')

:seed(8)

:radius(f(245,100))

:mass(f(315,100))

:temp(328)

:semi_major_axis(f(793,1000))

:eccentricity(f(487,1000))

:inclination(math.deg2rad(3.09))

:rotation_period(f(243,1))

:axial_tilt(math.fixed.deg2rad(f(26,10)))

:metallicity(f(5,6))

:volcanicity(f(6,10))

:atmos_density(f(9,1))

:atmos_oxidizing(f(1,1))

:ocean_cover(f(8,10))

:ice_cover(f(0,1))

:life(f(11,100))

local newhope = CustomSBody:new('New Hope', 'PLANET_TERRESTRIAL')

:seed(43)

:radius(f(4,3))

:mass(f(5,4))

:temp(287)

:semi_major_axis(f(9,10))

:eccentricity(f(367,10000))

:rotation_period(f(4,6))

:axial_tilt(math.fixed.deg2rad(f(1741,100)))

:metallicity(f(5,6))

:volcanicity(f(68,100))

:atmos_density(f(15,10))

:atmos_oxidizing(f(10,10))

:ocean_cover(f(45,100))

:ice_cover(f(6,10))

:life(f(9,10))

local newhope_starports = {

CustomSBody:new('New Hope', 'STARPORT_SURFACE')

:latitude(math.deg2rad(31))

:longitude(math.deg2rad(-121)),

CustomSBody:new("Gandhi's Revenge", 'STARPORT_SURFACE')

:latitude(math.deg2rad(19))

:longitude(math.deg2rad(99)),

CustomSBody:new('Epsilon Cove', 'STARPORT_SURFACE')

:latitude(math.deg2rad(51))

:longitude(0),

CustomSBody:new('Eridani Commercial Center', 'STARPORT_ORBITAL')

:semi_major_axis(f(9068,100000000))

:rotation_period(f(11,24)),

}

local hades = {

CustomSBody:new('Hades', 'PLANET_TERRESTRIAL')

:seed(191082)

:radius(f(484,1000))

:mass(f(121,1000))

:temp(280)

:semi_major_axis(f(27,100000))

:eccentricity(f(349,1000))

:inclination(math.deg2rad(5.145))

:rotation_period(f(4,10))

:axial_tilt(math.fixed.deg2rad(f(668,100)))

:volcanicity(f(9,10))

:atmos_density(f(1,10)),

{

CustomSBody:new('Eagles Nest', 'STARPORT_ORBITAL')

:semi_major_axis(f(5068,100000000))

:rotation_period(f(11,24)),

},

}

local hercules = CustomSBody:new('Hercules', 'PLANET_GAS_GIANT')

:radius(f(14,1))

:mass(f(8115,10))

:temp(134)

:semi_major_axis(f(4582,1000))

:eccentricity(f(488,10000))

:inclination(math.deg2rad(1.305))

:rotation_period(f(4,10))

:axial_tilt(math.fixed.deg2rad(f(313,100)))

local hale = {

CustomSBody:new('Halee', 'PLANET_TERRESTRIAL')

:seed(14782)

:radius(f(317,1000))

:mass(f(117,1000))

:temp(135)

:semi_major_axis(f(457,100000))

:eccentricity(f(92,1000))

:inclination(math.deg2rad(5.145))

:rotation_period(f(9,10))

:axial_tilt(math.fixed.deg2rad(f(668,100)))

:volcanicity(f(6,10))

:atmos_density(f(1,15))

:ocean_cover(f(4,10))

:ice_cover(f(9,10))

}

s:bodies(epserid, {

icarus,

pritchard,

atlantica,

newhope,

newhope_starports,

hades,

hercules,

hale,

})

s:add_to_sector(1,0,-1,v(0.037,0.5,0.6))

Obvv


ReplyQuote
robn
 robn
(@robn)
Captain Registered
Joined: 13 years ago
Posts: 1035
 
Thargoid wrote:
local s = CustomSystem:new('Tolan', { 'GRAVPOINT' })

The types passed to CustomSystem are what is used in the sector map, and also to generate the stars if no custom bodies are specified. You don't want GRAVPOINT here - its meaningless (though a crash is perhaps a bit harsh). Based on your custom star bodies later, what you probably want is:

Code:
CustomSystem:new('Tolan',{'STAR_A','STAR_F'})

Quote:
s:bodies(epserid, {

icarus,

pritchard,

atlantica,

...

The arguments to bodies() form a tree structure that defines which things orbit which other things. The Epsilon Eridani script is actually a tricky one to learn from, so its not a surprise that you got it wrong. The basic idea is that a Lua table following a body contains things that orbit that body. More than one table can be passed, which means they all orbit that body. The first time a new body is seen at a particular level of the tree, the previous one becomes "closed", and new tables will have things that orbit the new one.

That's a terrible explanation. This might help. Consider our solar system:

Code:
Sol
Mercury
Venus
Earth
Moon
Mars
Phobos
Deimos
...

That could be defined in a system def as:

Code:
system:bodies(sol, {
mercury,
venus,
earth, {
moon
},
mars, {
phobos,
deimos
},
...

If you want deeper things (moons with moons, etc), you just add deeper tables.

So, for a binary system, you want this:

Code:
system:bodies(gravpoint, {
star_a, {
things_that_orbit_star_a,
},
star_b, {
things_that_orbit_star_b,
},
things_that_orbit_the_pair
})

That last one is a tricky sucker. To set up something to orbit the "pair", you actually have it orbit the gravpoint, but just a long way out. Think of a gravpoint is just a regular body without a physical presence. Draw a little circle there if it helps 🙂

That's the way it should work (from memory). As I said though, gravpoints aren't used in any current custom def so they might not work properly. Keep posting here if its not working and I'll do some testing against the code proper to see what's going on.


ReplyQuote
Thargoid
(@thargoid)
Senior Chief Registered
Joined: 12 years ago
Posts: 67
Topic starter  

Thanks Robn.

I kept playing last night to get the rest of the system right. I figured that the the number in temp(XXX) is in kelvin but how does mass(xx,xxx) and life(xx,xxx) and other ones work? i just randomly change the numbers then run pioneer to see what has happened.

the error code was pretty good once. it said 'body tolan 4 is too close to its parent' and i found that modifying the semi major axis sorted that out, again trying random numbers.

I'll try and get the proper binary action happening.

Thanks again,

John


ReplyQuote
Potsmoke66
(@potsmoke66)
Captain Registered
Joined: 7 years ago
Posts: 1815
 

the values for i.e. life, mass and all the rest that appears in (f(1,10) i.e

means for this example fixed, 1 part of 10,

and is nothing else as 0.1

you just multiply a given 1 (for population this is 1 billion i.e.) with a suitable counter/numerator (is that right?) in this case 10 and divide it with the needed divisor, i.e. 1 to get 10% of 1 or 0.1.

that would be in this example 100 millions

as far as i understand this, it's simply "upscaled" to get integer values.

this was a clever move to avoid floating point complications between OS's (i assume, robn will correct me).

mass referes for planets to 1 earthmass

and stars to 1 solar mass.

as a example my Ross 154 mod

Code:
local s = CustomSystem:new("Ross 154",{ 'STAR_M' })
:seed(455)
:govtype('CORPORATE')
:long_desc([[Corporate ice and water world. Discovered by NSR, in early 24th century, Tomboghandi is a harsh world with not much to offer]])

local star = CustomSBody:new("Ross 154", 'STAR_M' )
:radius(f(24,100))
:mass(f(17,100))
:temp(2700)

local planet1 = CustomSBody:new('Anezar', 'PLANET_TERRESTRIAL')
:seed(7)
:radius(f(23,100))
:mass(f(6,100))
:temp(222)
:semi_major_axis(f(1,10))
:eccentricity(f(1,100))
:inclination(math.deg2rad(3.5))
:rotation_period(f(580,100))
:axial_tilt(math.fixed.deg2rad(f(1,1000)))
:metallicity(f(3,10))
:volcanicity(f(3,10))

local planet2 = CustomSBody:new('Caesar', 'PLANET_GAS_GIANT')
:seed(1)
:radius(f(117,10))
:mass(f(1097,10))
:temp(253)
:semi_major_axis(f(333,1000))
:eccentricity(f(5,1000))
:inclination(math.deg2rad(2.7))
:rotation_period(f(333,1000))
:axial_tilt(math.fixed.deg2rad(f(13,1000)))

local moon2_1 = CustomSBody:new('Tombogandhi', 'PLANET_TERRESTRIAL')
:seed(345) --2
:radius(f(53,100))
:mass(f(49,100))
:temp(269)
:semi_major_axis(f(3,1000))
:eccentricity(f(3,100))
:inclination(math.deg2rad(29.9))
:rotation_period(f(73,100))
:axial_tilt(math.fixed.deg2rad(f(26,1000)))
:metallicity(f(3,10))
:volcanicity(f(6,10))
:atmos_density(f(45,100))
:atmos_oxidizing(f(8,10))
:ocean_cover(f(6,10))
:ice_cover(f(7,10))
:life(f(6,10))

local port2_1 = CustomSBody:new('Assawindea', 'STARPORT_SURFACE')
:latitude(math.deg2rad(31))
:longitude(math.deg2rad(-11))

local port2_2 = CustomSBody:new('Kingsville', 'STARPORT_SURFACE')
:latitude(math.deg2rad(31))
:longitude(math.deg2rad(-100))

local moon2_2 = CustomSBody:new('Natty', 'PLANET_TERRESTRIAL')
:seed(5)
:radius(f(23,1000))
:mass(f(1,100))
:temp(233)
:semi_major_axis(f(1,100))
:eccentricity(f(9,100))
:inclination(math.deg2rad(18.9))
:rotation_period(f(38,100))
:axial_tilt(math.fixed.deg2rad(f(26,1000)))
:metallicity(f(9,10))
:volcanicity(f(3,10))
:ice_cover(f(7,10))
:atmos_density(f(5,1000))
:atmos_oxidizing(f(9,10))

local planet3 = CustomSBody:new('Vampiretta', 'PLANET_TERRESTRIAL')
:seed(1)
:radius(f(99,10))
:mass(f(444,100))
:temp(88)
:semi_major_axis(f(293,100))
:eccentricity(f(12,100))
:inclination(math.deg2rad(5.2))
:rotation_period(f(33,100))
:axial_tilt(math.fixed.deg2rad(f(146,1000)))
:metallicity(f(7,10))
:volcanicity(f(9,10))
:ice_cover(f(8,10))
:atmos_density(f(5,10))
:atmos_oxidizing(f(5,10))

s:bodies( star, {
planet1,
planet2,{
moon2_1, {
port2_1,
port2_2
},
moon2_2
},
planet3
})

s:add_to_sector(-2,0,-1,v(0.918,0.239,0.510))

--[[
Arisata is a Ross154 Hack for Frontier by NSR, who ever that is 😉
--]]

excerpt:

local moon2_1 = CustomSBody:new('Tombogandhi', 'PLANET_TERRESTRIAL')

:seed(345) -- initial seed of the body and determines i.e. which type of fractal terrain it will have

:radius(f(53,100)) -- 53 of 100 means .53. earth radii for planets, solar radii for stars

:mass(f(49,100)) -- earth masses resp. solar masses

:temp(269) -- kelvin, you know already

:semi_major_axis(f(3,1000)) -- Astronomical Units, since this is only a "moon", relatively close to the planet.

:eccentricity(f(3,100)) -- 0 would be a circle 1 the max. eccentricity, don't ask me how much that is. anyways this results in perihel and apihel. choose low values in general, small "schnelläufer" such as comets can have a extreme eccentricy and inclination

:inclination(math.deg2rad(29.9)) -- you enter degrees and it results in radiants. hey, shouldn't that be (math.deg2rad(299,1000))? it works even when you didn't use "fixed parts of 1", but it's not recommended. but i guess when calculated with math.deg2rad it will be a floating point value anyway, no? "bahnneigung" in german or simply inclination, means the tilting of the path, usually not much since we have to imagine that all systems are born like ours as a disk, if no cosmic catastrophes happen they will stay on the "aequatorial" plane they was born once. multiple systems can have weird appearance. but make yourself clever and google for proper relations between planets and multiple systems

:rotation_period(f(73,100)) -- earth days = 24hrs

:axial_tilt(math.fixed.deg2rad(f(26,1000))) -- degrees of the bodies axial tilting, (important to have seasons ;))

:metallicity(f(3,10)) -- percent

:volcanicity(f(6,10)) -- percent

:atmos_density(f(45,100)) -- percent

:atmos_oxidizing(f(8,10)) -- percent

:ocean_cover(f(6,10)) -- percent

:ice_cover(f(7,10)) -- percent

:life(f(6,10)) -- percent

i hope i sorted that out proper.


ReplyQuote
robn
 robn
(@robn)
Captain Registered
Joined: 13 years ago
Posts: 1035
 
Thargoid wrote:
but how does mass(xx,xxx) and life(xx,xxx) and other ones work?

The f(A,B) are A/B (ie, A divided by B). This unfortunate syntax is how we make sure that fractional amounts work across different platforms, which can introduce subtle difference in internal number formats. So if you wanted to say that a planet is 0.385 earth masses, you'd write mass(385,1000).

The meanings of the different fields are documented here: https://github.com/pioneerspacesim/pion ... om-Systems


ReplyQuote
Potsmoke66
(@potsmoke66)
Captain Registered
Joined: 7 years ago
Posts: 1815
 

yes, i missed this: "https://github.com/pioneerspacesim/pion ... om-Systems"

i only remembered the link to: http://eatenbyagrue.org/f/pioneer/coded ... y-cpp.html, on which some is missing.

"grillähirni" i would say i am. (cricket brain)


ReplyQuote
Thargoid
(@thargoid)
Senior Chief Registered
Joined: 12 years ago
Posts: 67
Topic starter  

Thanks everyone.

I still can't get Gravpoint to work. I'll think i'll just push on, fake it with the second sun orbiting close and the rest far out, as Robn suggested.

Cheers

John


ReplyQuote
robn
 robn
(@robn)
Captain Registered
Joined: 13 years ago
Posts: 1035
 
Thargoid wrote:
I still can't get Gravpoint to work

I'll give it a try myself soon (tonight hopefully).


ReplyQuote
Potsmoke66
(@potsmoke66)
Captain Registered
Joined: 7 years ago
Posts: 1815
 

@thargoid

i made myself a little wiser,

according to Keplers Laws, the maximum eccentricity is a open ended parabole (1), the minimum simply a circle (0).

just because i wrote, "don't ask me".


ReplyQuote