Author Topic: Questions Not Worth Their Own Thread: C# Edition  (Read 371827 times)

0 Members and 16 Guests are viewing this topic.

Offline Kaiser

  • Commander
  • *********
  • K
  • Posts: 329
  • Thanked: 42 times
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4005 on: May 22, 2024, 05:37:17 AM »
Stating the obvious probably, but often even the obvious escapes me ;D

The cheapest way to extract minerals: manual mines. Then, Orbital Miners, but they are restricted to small bodies (can the body be populated? AM are fine though). And finally, the costliest option, Auto-mines.

I'm asking because I'm just starting with OM and it seems like a good middle ground. Although you need tugs to move them, and they can't be refitted unless you have a shipyard for them, which I don't.

Well, there are downsides, AM fits better for big planets with high colony costs, they can be easily moved around with civilian cargos and get repaid after a while.
OM are usually huge ships which need to be built and it takes time, you need to move them ( I prefer having them equipped with some cheap engine rather then tug them) and they are at riders risk.
 
The following users thanked this post: vorpal+5

Offline Steve Walmsley

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11695
  • Thanked: 20561 times
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4006 on: May 22, 2024, 06:16:33 AM »
How are systems generated in Known Stars games? The wiki says "The game works through all the stars in order of increasing distance. There is a 20% chance of selecting the nearest star, then if that isn't selected, 20% chance of second nearest star, etc." I think this is from the old VB version, but I haven't seen any posts about changes to this. I ran some tests in a fresh game generating systems from Sol and they seemed to confirm the 20% number. However, in my games I've also seen systems with really distant neighbors, like HIP 31293 in the screenshot. Its neighbors have distances in real space of 54.1, 63.1, and 70 light-years, and as far as I can tell there are hundreds of closer systems that haven't been picked yet. So it seems very unlikely to me that this was generated purely by iterating through the closest systems.

Sometimes you link to an existing system, but not one you know about. In that case, its a lot easier to end up with a system a long way away, because the number of systems in the sequence is much smaller. Or you are already in someone else's known system and they made the connection from their end. Or you just got the long-shot that sometimes happens.

I'm willing to bet that the code somehow negates one set of coordinates when computing distances to pick new systems, so that the formula looks like
Code: [Select]
(x2 + x1)^2 + (y2 + y1)^2 + (z2 + z1)^2rather than
Code: [Select]
(x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2.Either the code is missing a minus sign, or it has an extra one somewhere.

I made a new game with no NPRs (attached if you want to play around with it) and generated a bunch of systems, then plotted their positions in 3d space and jump connections. The full plot is here (https://www.desmos.com/3d/6q3qs5wogh); in the screenshot I just plotted a single chain so it's easier to see. Look at how they zigzag back and forth -- this isn't at all what you'd expect if the distances were calculated correctly, but it's what you'd see if the coordinates get reflected! This leads to a pattern I see all the time in my games, where systems are much closer to systems two jumps away than to neighboring systems. (Sol usually connects to nearby systems because it's at the origin, so reflecting everything doesn't change distances to it!)

For some reason the distance measurements everywhere else seem normal, but this seems like the best explanation for these patterns. It's not even necessarily bad, maybe you generate more interesting galaxies this way than with correct distance measurements, but it would still be good to understand how it works. And if I'm wrong and there's some other explanation for the zigzagging, let me know!

Yes, you are correct.

Here is the relevant code:
   
                // get known systems already in the game
                List<KnownSystem> CurrentSystems = SystemList.Values.Select(x => x.RealSystem).ToList();

                // order systems by distance from start system
                List<KnownSystem> PossibleSystems;

                if (StartSystem.RealSystem == null)
                    PossibleSystems = KnownSystems.Values.Except(CurrentSystems).OrderBy(x => Math.Pow(x.X, 2.0) + Math.Pow(x.Y, 2.0) + Math.Pow(x.Z, 2.0)).ToList();
                else
                    PossibleSystems = KnownSystems.Values.Except(CurrentSystems).OrderBy(x => Math.Pow(x.X - StartSystem.RealSystem.X, 2.0) + Math.Pow(x.Y - StartSystem.RealSystem.Y, 2.0) + Math.Pow(x.Z - StartSystem.RealSystem.Z, 2.0)).ToList();

                int SelectionRange = 5;
                if (GlobalValues.RandomNumber(10) == 1) SelectionRange = 20;

                // cycle through potential systems until one is selected
                foreach (KnownSystem ks in PossibleSystems)
                {
                    if (GlobalValues.RandomNumber(SelectionRange) == 1)
                        return ks;
                }

                return null;

The + should be -, as you stated above. Its been like this since C# launched and you are the first person to figure it out :)

I think correcting it is better than leaving as is, as it will be easier to understand what is happening.
« Last Edit: May 22, 2024, 06:19:43 AM by Steve Walmsley »
 
The following users thanked this post: AlStar, Kiero, BAGrimm, BigBacon, ISN, gpt3

Offline ISN

  • Sub-Lieutenant
  • ******
  • I
  • Posts: 116
  • Thanked: 49 times
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4007 on: May 22, 2024, 02:37:41 PM »
I think correcting it is better than leaving as is, as it will be easier to understand what is happening.

I'm looking forward to seeing what the maps end up looking like with the change!
 

Offline vorpal+5

  • Commodore
  • **********
  • Posts: 661
  • Thanked: 145 times
  • Silver Supporter Silver Supporter : Support the forums with a Silver subscription
    2021 Supporter 2021 Supporter : Donate for 2021
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4008 on: Yesterday at 03:27:12 AM »
Questions, always questions!

1. Does water in the atmosphere do something special? I'm injecting some for good measure...
2. I don't see any tech I can research to create a Sector Command. Where is it hidden?
 

Offline Andrew

  • Registered
  • Commodore
  • **********
  • Posts: 698
  • Thanked: 132 times
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4009 on: Yesterday at 03:37:55 AM »
2.  Is Improved Command and Control, I think in Logistics but it could be construction
 

Offline pedter

  • Chief Petty Officer
  • ***
  • p
  • Posts: 47
  • Thanked: 29 times
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4010 on: Yesterday at 04:19:47 AM »
2. I don't see any tech I can research to create a Sector Command. Where is it hidden?
2.  Is Improved Command and Control, I think in Logistics but it could be construction

Confirming that it's in Logistics rather than Construction / Production.

1. Does water in the atmosphere do something special? I'm injecting some for good measure...

Water vapour in the atmosphere is part of the water cycle and shows up based on hydro extent, temperature, and total pressure; you can control hydro extent of a body by adding or removing water vapour with terraformers. Below -28C hydro extent and water vapour freeze solid and out of the atmosphere respectively, above +100C the hydro extent boils off and exists entirely in the atmosphere as water vapour, and between the two you'll have some vapour in the atmosphere and some on the ground as hydro extent with higher total pressure resulting in higher water vapour partial pressure.

You may still find different values than -28C (I've also seen -17C, -18C, and -27C, but Titan just melted at -28C) from older sources but that is the v2.5.1 temperature at which ice sheets spontaneously melt and begin to evaporate into the atmosphere as the water cycle takes over. Some of how water vapour, liquid water, and solid ice move about can be found in the change log: https://aurora2.pentarch.org/index.php?topic=12523.msg155204#msg155204
« Last Edit: Yesterday at 04:26:02 AM by pedter »
 
The following users thanked this post: vorpal+5

Offline skoormit

  • Rear Admiral
  • **********
  • Posts: 822
  • Thanked: 329 times
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4011 on: Yesterday at 10:18:54 AM »
Stating the obvious probably, but often even the obvious escapes me ;D

The cheapest way to extract minerals: manual mines. Then, Orbital Miners, but they are restricted to small bodies (can the body be populated? AM are fine though). And finally, the costliest option, Auto-mines.

I'm asking because I'm just starting with OM and it seems like a good middle ground. Although you need tugs to move them, and they can't be refitted unless you have a shipyard for them, which I don't.

Orbital Miners are the best way to mine.
You get the same productivity as a surface mine for the same cost, but it is 20% the size and does not require population to run.

The overhead cost to put the modules on an armorless space station is minimal.
The cost of a simple 5-module station is 86.7% modules. So the cost of overhead is about 15.3% of the cost of the modules.
The cost of a 50-module station is 88.6% modules. ~12.8% overhead.

The savings is in the cost of transportation.
To move a surface mine, you need 25kt of cargo hold, which runs empty in one direction.
To tug a 5-module orbital mining station, take the cargo hold off of your freighter, and replace the cargo shuttle bay with a tractor beam.
The outbound haul will be at roughly the same speed as before. The return trip will be faster. How much faster depends on the size of your tug relative to the station. Assuming roughly 1:1 size, the return leg is at 2x the speed of the outbound leg.
You now have a smaller and cheaper ship moving 5 times the mining capability in round trips that take ~25% less time, and which do not have to be accompanied by even more ships carrying population and infrastructure.
 

Offline skoormit

  • Rear Admiral
  • **********
  • Posts: 822
  • Thanked: 329 times
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4012 on: Yesterday at 10:28:59 AM »
for a system to be eligible for CMC spawning, it must have at least one colony with a population of at least 10M.
does this only count surface population? or does Ark module population count?
 

Offline paolot

  • Sub-Lieutenant
  • ******
  • p
  • Posts: 110
  • Thanked: 12 times
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4013 on: Yesterday at 07:02:38 PM »
Quote
To move a surface mine, you need 25kt of cargo hold ...

True. But you can use civilian shipping lines to move installations and colonists between colonies.
Apart starting Infrastructures and Colonists, and very few mines or AMs, I let civilians do so, while my cargo ships get minerals from bodies: when there are many mines or AMs on a location, I find the minerals flow towards the industry planets is higher using cargo ships than mass drivers.
 

Offline vorpal+5

  • Commodore
  • **********
  • Posts: 661
  • Thanked: 145 times
  • Silver Supporter Silver Supporter : Support the forums with a Silver subscription
    2021 Supporter 2021 Supporter : Donate for 2021
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4014 on: Yesterday at 11:27:16 PM »
Does water do anything special for the planet, to have some?
 

Offline pedter

  • Chief Petty Officer
  • ***
  • p
  • Posts: 47
  • Thanked: 29 times
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4015 on: Yesterday at 11:36:19 PM »
Does water do anything special for the planet, to have some?

Hydro extent (or lack thereof) contributes to colony cost if not above 20% and liquid: https://aurora2.pentarch.org/index.php?topic=8495.msg101987#msg101987

Above 75% hydro extent the population capacity of the body starts to suffer: https://aurora2.pentarch.org/index.php?topic=8495.msg100078#msg100078
 

Offline db48x

  • Commodore
  • **********
  • d
  • Posts: 642
  • Thanked: 200 times
Re: Questions Not Worth Their Own Thread: C# Edition
« Reply #4016 on: Today at 12:49:23 AM »
Yes, you are correct.

Here is the relevant code:
 
Code: [Select]

PossibleSystems = KnownSystems.Values.Except(CurrentSystems).OrderBy(x => Math.Pow(x.X - StartSystem.RealSystem.X, 2.0) + Math.Pow(x.Y - StartSystem.RealSystem.Y, 2.0) + Math.Pow(x.Z - StartSystem.RealSystem.Z, 2.0)).ToList();


The + should be -, as you stated above. Its been like this since C# launched and you are the first person to figure it out :)

I think correcting it is better than leaving as is, as it will be easier to understand what is happening.

Am I missing something? That looks like the right distance formula to me, with minus signs in the correct place.

As an aside, are you sure that you need to call ToList() there? OrderBy returns an IOrderedEnumerable, which you can directly enumerate over with a foreach loop. Calling ToList() will allocate a new List and copy the (sorted) elements into it. Then after the loop the List will be thrown away. Seems like wasted effort, but I have only a passing acquaintance with C# and could be wrong.