Asteroids may have fewer ore deposits than intended

Vox Serico shared this bug 3 years ago
Reported

While trying to understand how asteroid generation works, I found this bit of code where the two lists (m_coreMaterials and m_depositMaterials) have randomly-selected items removed twice with two separate "rarities" where the first limit (4 to 2) never applies and is always overridden by the second limit (2 to 1) when version >= 4.

Sandbox.Game.World.Generator.MyCompositeShapes.MyCompositeShapes(int, int, int) : void @060059F3

private MyCompositeShapes(int generatorSeed, int asteroidSeed, int version)
{
	this = default(MyCompositeShapes);
	if (version > 2)
	{
		this.m_coreMaterials = new List<MyVoxelMaterialDefinition>();
		this.m_depositMaterials = new List<MyVoxelMaterialDefinition>();
		this.m_surfaceMaterials = new List<MyVoxelMaterialDefinition>();
		using (MyRandom.Instance.PushSeed(generatorSeed))
		{
			MyRandom instance = MyRandom.Instance;
			this.FillMaterials(version);
			MyCompositeShapes.FilterKindDuplicates(this.m_coreMaterials, instance);
			MyCompositeShapes.FilterKindDuplicates(this.m_depositMaterials, instance);
			MyCompositeShapes.FilterKindDuplicates(this.m_surfaceMaterials, instance);
			MyCompositeShapes.ProcessMaterialSpawnProbabilities(this.m_coreMaterials);
			MyCompositeShapes.ProcessMaterialSpawnProbabilities(this.m_depositMaterials);
			MyCompositeShapes.ProcessMaterialSpawnProbabilities(this.m_surfaceMaterials);
			if (instance.Next(100) < 1)
			{
				this.MakeIceAsteroid(version, instance);
			}
			else if (version >= 4)
			{
				int maxCount = (instance.NextDouble() > 0.800000011920929) ? 4 : 2;
				int maxCount2 = (instance.NextDouble() > 0.40000000596046448) ? 2 : 1;
				MyCompositeShapes.LimitMaterials(this.m_coreMaterials, maxCount, instance);
				MyCompositeShapes.LimitMaterials(this.m_depositMaterials, maxCount, instance);
				using (MyRandom.Instance.PushSeed(asteroidSeed))
				{
					MyCompositeShapes.LimitMaterials(this.m_coreMaterials, maxCount2, instance);
					MyCompositeShapes.LimitMaterials(this.m_depositMaterials, maxCount2, instance);
				}
			}
		}
	}
}

The intent I interpret from this is:

  • 20% of all (version >=4) asteroids would have had 4 deposits
  • 48% of all (version >=4) asteroids would have had 2 deposits
  • 32% of all (version >=4) asteroids would have had 1 deposit

Which would play nicely into the "defined by exploration" part of the game, where there's a low chance that you would find a figurative gold-mine of an asteroid every now and then with twice the ore.


What we have instead is that all asteroids have a 60% chance to have 2 deposits, and 40% have 1.


Replies (2)

photo
1

Having done more research on the asteroid generation, "have had X deposits" should be "have had X types of ore".

It appears edits are time-limited.

photo
1

Hello, Vox,

thanks for sharing this with us. This issue was put into our internal system.

Kind Regards

Keen Software House: QA Department

Leave a Comment
 
Attach a file