Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose galaxy parameters - modify explored space radius #5941

Merged

Conversation

impaktor
Copy link
Member

@impaktor impaktor commented Oct 28, 2024

I've always felt the 700 ly radius we have of explored worlds is much too big.

A user (crux_72) has used pioneer universe for many years as basis as dungeon master for a RPG, but only plays a few hand-made system, and expressed the need to change the radius for explored systems, such that he could tailor it for his needs.

I think it's a good idea, and seems like a very simple thing to do.
...Apparently not for piglet brained people, thus this PR is WIP. Problem: it doesn't create the new galaxy.ini file, as I expected. I've pretty much copy-pasted the pattern for how we do with the usual config.ini file, but my initialization differs in sufficiently different way as to not be used by the game.

Since @Web-eWorks is currently going through the galaxy generation code, I'll open this not-yet-working very small fix.

If anyone want to take over, or re-implement this from scratch, you're more than welcome.

@impaktor impaktor force-pushed the expose-galaxy-parameters branch 3 times, most recently from 0cfad00 to 0e20c86 Compare October 28, 2024 12:48
@sturnclaw
Copy link
Member

A user (crux_72) has used pioneer universe for many years as basis as dungeon master for a RPG

There are dozens two of us! ...Well, I've only been running one for about six months now, but still.

expressed the need to change the radius for explored systems

So, I've been looking at this from a slightly different angle, and it's that we also need to have a non-circular shape for the explored bubble. The scale height for the Milky Way is (grossly simplifying) ~1000ly, which means that the circular bubble tends to look quite unnatural as it seems there's been a great migration to comparatively sparse regions of space but less expansion out "horizontally" into the denser parts of the galaxy along the main disk.

I'd like to implement a squashed sphere instead, that matches the density falloff of the galaxy a bit better. I'll take a look at this PR when I get there - currently have several other things vying for my attention right now IRL.

@impaktor
Copy link
Member Author

I really want to see this in master before the February 2025 release.

I think just reading the parameters from a file is a first (minimal) step.

@fluffyfreak
Copy link
Contributor

Problem: it doesn't create the new galaxy.ini file, as I expected. I've pretty much copy-pasted the pattern for how we do with the usual config.ini file

You could call Save(); anytime you like. I just added it into the end of the GalaxyConfig Ctor which might not be perfect but it worked well enough and generated the ini file.

You can also create one by hand.

galaxy.zip

@fluffyfreak
Copy link
Contributor

GalaxyConfig::GalaxyConfig()
{
	// set defaults
	std::map<std::string, std::string> &map = m_map[""];
	map["GalaxyExploredMax"] = "90";
	map["GalaxyExploredMin"] = "65";
	map["GalaxyExploredMix"] = "40";

	Read(FileSystem::userFiles, "galaxy.ini");
	
	Save(); // always write to disk to create file
}

That works perfectly. If there's no galaxy.ini then it creates it, if there is then it just loads the values from the file 👍

Good job, all works

@impaktor
Copy link
Member Author

@fluffyfreak thanks! I'll have to try this out after the weekend, and un-draft this PR, with the aim of getting it merged before next release unless someone else supersedes me with a better implementation.

@impaktor impaktor force-pushed the expose-galaxy-parameters branch from 0e20c86 to 880b79e Compare December 1, 2024 09:41
@impaktor
Copy link
Member Author

impaktor commented Dec 1, 2024

OK, pushed.
Should perhaps squash the commits, no point in keeping them separate, I guess.
I wonder if there's some documentation one can add for the third variable, GalaxyExploredMix somewhere? max & min distance are self explanatory. the mix variable says something about the steepness when going from max to min distance, if memory serves.

@impaktor impaktor marked this pull request as ready for review December 1, 2024 09:43
Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general this is a good idea, there's just a few things that need to be cleaned up.

In addition to the comments below, src/GalaxyConfig.h/cpp needs to be moved to the galaxy subdirectory.

src/galaxy/SectorGenerator.cpp Outdated Show resolved Hide resolved
src/galaxy/SectorGenerator.h Outdated Show resolved Hide resolved
Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provisionally approved pending testing, thanks!

Expose parameters for explored space:
'min', 'max' range and 'mix' (drop off) parameters.

Note: any change to this file will break saves.
But we want it for modders.
@impaktor impaktor force-pushed the expose-galaxy-parameters branch from 4e5a58e to 84f6229 Compare December 4, 2024 09:22
@impaktor
Copy link
Member Author

impaktor commented Dec 4, 2024

Squishy-squashed to single commit now.

Any change to the parameters would potentially break saves / missions, I assume, as the universe becomes different. This will - for now - be an undocumented feature?

Ideally, one should perhaps insert some text at the top of galaxy.ini describing the parameters, and that it breaks saves?

@sturnclaw sturnclaw merged commit 61ceb71 into pioneerspacesim:master Dec 6, 2024
4 checks passed
@sturnclaw
Copy link
Member

Undocumented feature is fine. This is more of a power-user thing, as changes to the explored radius can potentially leave factions without homeworlds, leading to assertions. (I typically have to delete all factions beyond the "main three" when working on galaxy code...)

@fluffyfreak
Copy link
Contributor

omg, I went to look at the Factions code to see if I could fix that ... it's been over 12 years since I wrote them 🤯 I think I need a lie down

@fluffyfreak
Copy link
Contributor

On the plus side I could set those values to like 3,3,3 and it still didn't crash 👍 what kind of assertions do you hit?

@sturnclaw
Copy link
Member

On the plus side I could set those values to like 3,3,3 and it still didn't crash 👍 what kind of assertions do you hit?

If a faction's homeworld does not exist (set the system index to something like 99) the game will segfault/assert when attempting to compute whether systems are within the faction's influence radius. I don't remember the exact line offhand, but it's very easy to reproduce by modifying one or more faction files and starting a game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants