Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: A couple modding questions  (Read 1005 times)

Tellaris

  • Ensign
  • *
  • Posts: 18
    • View Profile
A couple modding questions
« on: May 28, 2019, 04:36:52 PM »

I'm extremely new to modding and coding in general. The most experience I have with coding is BeeperBot.

I have made maps for Age of Mythology and Warcraft 2/3 so I have some idea how those systems worked.
I even engineered a simple script for Age of Mythology that created a Day/Night cycle during the game, that people seemed to love and popped up all over the place after I did it online...

(It was basically a system of simple triggers that fired after x amount of time, and repeated.)

Anyways. I'm looking at Rules.csv and trying to understand what's going on in the dialogues. I DID look at the PDF file for rules.csv that's linked in the forums here. However, I'm still not really understanding what's going on.

So this string:

marketOptionCommDir,DialogOptionSelected,$option == marketCommDir,OpenCommDirectory,You connect to the local comm directory and browse the public and otherwise known listings.,,

So if I understand it, it's adding an option, called "CommDir", checking if someone clicked it, loading what CommDir tells it to, and then opening CommDirectory, followed by a line that is printed in the window for it.

So off of that I came up with this:

marketOptionDecInd,DialogOptionSelected,$option == marketDecInd,OpenDecIndDecision,Are you sure you want to grant this colony independence? #(Yes, No)

Currently it does absolutely nothing, as I've not defined "DecInd" to mean anything.

I'm thinking I could get that rolling with something like:

marketAddOptionDecInd, PopulateOptions,"$hasMarket
$menuState == main
$tradeMode != NONE #Is this line necessary? Does the game consider it a trade if not here? Or some weirdness?
$faction.id == player",MakeOption ...
And that's as far as I got.

What I'm hoping this does is to define "DecInd", populate the options (Though I'm not entirely sure if this is a pre-defined set of options or, if I have to define my confirmation elsewhere, and this calls it) and checks if the planet has a market.
I'm guessing $menuState is checking if its the main menu still?
$faction.id == player checks if the market belongs to the player, and then I have the MakeOption line that I assume calls something else. (I see a lot of "OpenCore" but not entirely sure what that is.)

I have no idea how complex this particular idea is to actually implement, and I don't think it really matters. I can learn what I need to as I go along, so long as people are willing to help me with my questions.

I'm mostly just wondering if I'm on the right track to make it create an option called; "Declare Independence" with a player owned colony.

The ultimate goal of what I'm trying to work towards is a mod with this option, asks yes/no, and on yes, "grants" independence to the colony. This independence would depend on if "free port" is toggled on or not. (Only player owned colonies)
If Free Port is off, and you use this option, it would transfer ownership of the colony to the Independent faction. If Free Port is on, it becomes a Pirate colony instead.
This DOES raise the question of what might happen if the now Independent colony has a Patrol HQ or higher, as Independent colonies don't seem to have this in vanilla. I'm unsure of what the game would do with that, if anything.

A future goal with this as well, would be to create a custom event for this. Assuming that planetary invasion ever becomes a thing, (maybe it doesn't need to be for this to work) it would generate a fleet from one of the factions that would aggressively target this new independent colony for conquest. Effectively, the player is given the choice of either personally, or by proxy, defending the independent planet from a faction invasion. (Possibly more than once.) I figure this fits in with the lore, as the Factions, especially the Hegemony are described as occasionally annexing Independent worlds, and are generally not fond of them. (EX The Last Hurrah mission and the fate of the Independent Mayathura people.) Another set of effects I'd like it to eventually do is provide an opinion malus from the main factions, and an opinion boost from the Independent faction (If it becomes independent). (Pirates/Pathers don't really care either way.) It would also provide a system wide stability malus, "Granted a Colony Independence"

So I'm trying to get the whole thing rolling just from Rules.csv (I have no experience with Java, I'm mostly just looking at what has already been done in those files from both modders and Alex, and trying to figure out what that stuff does. It LOOKS pretty understandable and I think I can figure it out just by playing with stuff. Creating brand new functions is beyond me atm. So my current goal is to just figure out how to modify and how Rules.csv works.)

-------
ProcGen questions

Another question I have maybe a lot simpler.

I've been messing around with ProcGen (I like my Starsector with double the objects/system than the defaults provide) and I noticed two things.

Firstly, the secondary and trinary stars of multi star systems seem to quite often be devoid of planets, even with the increased object counts. Is there a way to force the planet generator to check if there are companion stars, and to specifically add a minimum number of objects to those companion stars, so they aren't mostly unused? Or is this just abnormal/unlucky behavior where I'm finding this happening? (When I say Companion Stars, I mean stars that are nearer to the edge of the map, as opposed to systems with them all bunched together in the center.)

Additionally, I noticed that either the game is running out of objects to add, or some other weirdness is happening, the faded in asteroid/dust streams usually present around Black Holes is often showing up around non-black hole stars. Is there a way to force ProcGen to ONLY generate this around black holes? I'm not sure where to look for these things.

Finally, is it possible to adjust the number of systems generated per cluster? I've not seen this option in ProcGen so far. Or maybe I just missed it.

Big thanks to anyone who can help me out!

(Also, I DID figure out how to create a mod_info file, which makes editing the game so much easier for version control, so I don't have to back up every base game file I mess with!)
« Last Edit: May 28, 2019, 04:39:18 PM by Tellaris »
Logged

mendonca

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1159
    • View Profile
Re: A couple modding questions
« Reply #1 on: May 28, 2019, 11:44:22 PM »

Hi there,

I’m really no expert at rules.csv, but I’d suggest using SafariJohn’s Rules Tool to hopefully assist in navigating and experimenting (sorry I can’t offer any otherwise solid advice)

http://fractalsoftworks.com/forum/index.php?topic=13976.0

On procgen issues; I’m fairly sure this can be done - but it would involve having a compiled .jar and (in my mind, at least to do everything you would want) rewriting the ThemeGenerator procgen code that vanilla uses.

Numbers / probabilities etc. are contained here, in the Theme Generator code, including e.g. chance that a research base appears at a given point.

I don’t honestly know about accretion disk generation, but I’d assume it’s all in the same general part of the code, I’d have a poke round the various generators etc.
Logged


"I'm doing it, I'm making them purple! No one can stop me!"

Histidine

  • Admiral
  • *****
  • Posts: 4692
    • View Profile
    • GitHub profile
Re: A couple modding questions
« Reply #2 on: May 29, 2019, 04:22:24 AM »

Your rules code appears to be headed in the right direction.

Quick notes (for manual editing, I dunno what the Rules Tool equivalent is)

For the "MakeOption" thing, what you want is to add the option in the last column of rules.csv. e.g.
7:marketDecInd:Grant independence
Here 'marketDecInd' means that when this option is clicked, $option is set to marketDecInd and it looks for the DialogOptionSelected rule that matches that $option (in this case, marketOptionDecInd).
The last part of the string is the text of the option.
The '7' controls the ordering of the options in the dialog options panel and is optional.

$tradeMode is an indicator of whether you can trade with the market. NONE means you're completely locked out (transponder on while unfriendly, or there's been "recent commotion"); there's also a setting for sneaking in with transponder off, and normal legitimate docking.
It doesn't matter in your case, since it should always be full trade for your own colony.
Logged