Star Modding

A place for discussion of making game modifications.
Tangle
Posts: 3
Joined: Sun Jul 16, 2017 5:32 pm

Star Modding

Postby Tangle » Sun Jul 16, 2017 5:42 pm

Hi! I'm trying to mod in new types of stars, like Brown Dwarfs and F white stars. I'm modding the init_star.lua file and the ~GalaxyMap star files, but I'd like to know if there are any other files I should get to before I try to start the game. Should I just follow any error messages shown?

EDIT: All right, my modifications to the file are at least non-error-throwing... but my star generation does not occur. The vanilla star generation takes place.

User avatar
sven
Site Admin
Posts: 1223
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Star Modding

Postby sven » Sun Jul 16, 2017 7:41 pm

Tangle wrote:Hi! I'm trying to mod in new types of stars, like Brown Dwarfs and F white stars. I'm modding the init_star.lua file and the ~GalaxyMap star files, but I'd like to know if there are any other files I should get to before I try to start the game. Should I just follow any error messages shown?

EDIT: All right, my modifications to the file are at least non-error-throwing... but my star generation does not occur. The vanilla star generation takes place.


Take a look at planet_decks.lua. From the game's perspective, what's most important about each star type is what kinds of planets they can start with, so, the core star spawning rules are all defined there, inside init_star_decks().

Also: if you haven't found the modding page yet, I'd recommend checking that out for some useful general info.

Tangle
Posts: 3
Joined: Sun Jul 16, 2017 5:32 pm

Re: Star Modding

Postby Tangle » Sun Jul 16, 2017 8:14 pm

sven wrote:
Tangle wrote:Hi! I'm trying to mod in new types of stars, like Brown Dwarfs and F white stars. I'm modding the init_star.lua file and the ~GalaxyMap star files, but I'd like to know if there are any other files I should get to before I try to start the game. Should I just follow any error messages shown?

EDIT: All right, my modifications to the file are at least non-error-throwing... but my star generation does not occur. The vanilla star generation takes place.


Take a look at planet_decks.lua. From the game's perspective, what's most important about each star type is what kinds of planets they can start with, so, the core star spawning rules are all defined there, inside init_star_decks().

Also: if you haven't found the modding page yet, I'd recommend checking that out for some useful general info.

Apologies if this is something immensely obvious, but now the game has begun throwing exceptions when it tries to make the orbit ranges for each star. Relevant code:

Code: Select all

StarOrbitRange = {
  ['White Dwarf']=catch(1,3),
  ['M Red']=catch(1,3),
  ['T Red']=catch(1,3),
  ['L Magenta']=catch(1,2),
  ['Y Brown']=catch(0,1),
 
  ['K Orange']=catch(1,4),
  ['G Yellow']=catch(1,4),
  ['F White']=catch(3,6),

  ['Red Giant']=catch(3,4),
  ['AB Blue White']=catch(2,4),
}

User avatar
sven
Site Admin
Posts: 1223
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Star Modding

Postby sven » Sun Jul 16, 2017 11:08 pm

Tangle wrote:Apologies if this is something immensely obvious, but now the game has begun throwing exceptions when it tries to make the orbit ranges for each star. Relevant code:


Hmm. It's not obvious to me exactly what's going wrong, but, at a high level, I can tell you that adding new star types is going to require updating the Lua code in a number of places -- there are various supplemental tables that are defined per-star type, and ontop of that you'll need to define new display functions for the new types (which happens in a different part of the code base).

If I were you, I'd start by doing a find-all over all the source files, and looking for all the places where one of the type strings for an existing star type turn up. For example, do a global search for 'M Red'. That will give you a quick sense of all the places where you'd need to make changes. Then, again, I'd start simple -- just go to all those places in the code, and try adding an extra entry, identical to the one for 'M Red', that instead references a 'Y Brown'.

If you can get that working without breaking, then you can start customizing things for your new star type -- alternate initialization rules in planet_decks.lua, different color values in the sun_shaders.lua/sun_shaders.cg files, and so on. Then if you want to add a few more types after getting a brown dwarf working, you'll know more or less what's involved.


Return to “Modding”

Who is online

Users browsing this forum: No registered users and 1 guest

cron