Skip to content
Draft
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions simulation_parameters/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,14 @@ public static class Constants

public const float CLOUD_CHEAT_DENSITY = 16000.0f;

public const float TERRAIN_GRID_SIZE = 200;
public const float TERRAIN_GRID_SIZE_INV = 1 / TERRAIN_GRID_SIZE;
// public const float TERRAIN_GRID_SIZE = 200;
public const float TERRAIN_GRID_SIZE_X = 300;

public const float TERRAIN_GRID_SIZE_Z = 275;

// public const float TERRAIN_GRID_SIZE_INV = 1 / TERRAIN_GRID_SIZE;
public const float TERRAIN_GRID_SIZE_INV_X = 1 / TERRAIN_GRID_SIZE_X;
public const float TERRAIN_GRID_SIZE_INV_Z = 1 / TERRAIN_GRID_SIZE_Z;
public const float TERRAIN_EDGE_PROTECTION_SIZE = 1;

/// <summary>
Expand All @@ -202,7 +208,16 @@ public static class Constants
/// If too low, then pop in is visible and the spawn system can spawn stuff in that then gets covered
/// by the terrain.
/// </summary>
public const int TERRAIN_SPAWN_AREA_NUMBER = 4;
public const int TERRAIN_SPAWN_AREA_NUMBER = 1;

public const int TERRAIN_VENT_SEGMENTS = 6;
public const int TERRAIN_VENT_RINGS_MAX = 5;
public const int TERRAIN_VENT_RINGS_MIN = 2;
public const int TERRAIN_SECOND_VENT_RINGS_MIN_THRESHOLD = 3;
public const float TERRAIN_SECOND_VENT_CHANCE = 0.4f;
public const int TERRAIN_VENT_OVERLAP_MARGIN = 2;
public const int TERRAIN_VENT_RING_HEIGHT_REDUCTION = 10;
public const int TERRAIN_VENT_OUTER_RING_HEIGHT = -27;
Comment on lines +201 to +208
Copy link
Member

Choose a reason for hiding this comment

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

I haven't read all the code yet, but my impression is that these would be nice to configure from the JSON.


public const int MEMBRANE_RESOLUTION = 10;
public const int MEMBRANE_VERTICAL_RESOLUTION = 7;
Expand Down
177 changes: 28 additions & 149 deletions simulation_parameters/microbe_stage/biomes.json
Original file line number Diff line number Diff line change
Expand Up @@ -543,11 +543,12 @@
}
},
"Terrain": {
"MinClusters": 0,
"MaxClusters": 5,
"MinClusters": 2,
"MaxClusters": 8,
"PotentialClusters": [
{
"RelativeChance": 1,
"SpawnStrategy": 1,
Copy link
Member

Choose a reason for hiding this comment

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

Please use enum value names here in the JSON so that it is easy to read.

"TerrainGroups": [
{
"RelativePosition": {
Expand All @@ -559,32 +560,18 @@
{
"Visuals": "PyriteTerrain1",
"CollisionShapePath": "res://assets/models/microbe_terrain/PyriteTerrainChunk1.shape",
"Radius": 14.6,
"Radius": 13,
"RelativePosition": {
"x": 0,
"y": 0,
"z": 0
},
"RandomizeRotation": true
}
]
}
]
},
{
"RelativeChance": 1,
"TerrainGroups": [
{
"RelativePosition": {
"x": 0,
"y": 0,
"z": 0
},
"Chunks": [
},
{
"Visuals": "PyriteTerrain2",
"CollisionShapePath": "res://assets/models/microbe_terrain/PyriteTerrainChunk2.shape",
"Radius": 18,
"Radius": 13,
"RelativePosition": {
"x": 0,
"y": 0,
Expand All @@ -598,6 +585,7 @@
},
{
"RelativeChance": 1,
"SpawnStrategy": 1,
"TerrainGroups": [
{
"RelativePosition": {
Expand All @@ -616,21 +604,7 @@
"z": 0
},
"RandomizeRotation": true
}
]
}
]
},
{
"RelativeChance": 1,
"TerrainGroups": [
{
"RelativePosition": {
"x": 0,
"y": 0,
"z": 0
},
"Chunks": [
},
{
"Visuals": "ChalcopyriteTerrain2",
"CollisionShapePath": "res://assets/models/microbe_terrain/ChalcopyriteTerrainChunk2.shape",
Expand All @@ -647,7 +621,8 @@
]
},
{
"RelativeChance": 1,
"RelativeChance": 2,
"SpawnStrategy": 1,
"TerrainGroups": [
{
"RelativePosition": {
Expand All @@ -666,25 +641,11 @@
"z": 0
},
"RandomizeRotation": true
}
]
}
]
},
{
"RelativeChance": 1,
"TerrainGroups": [
{
"RelativePosition": {
"x": 0,
"y": 0,
"z": 0
},
"Chunks": [
},
{
"Visuals": "SerpentiniteTerrain2",
"CollisionShapePath": "res://assets/models/microbe_terrain/SerpentiniteTerrainChunk2.shape",
"Radius": 17.5,
"Radius": 13.5,
"RelativePosition": {
"x": 0,
"y": 0,
Expand All @@ -697,7 +658,7 @@
]
},
{
"RelativeChance": 1,
"RelativeChance": 7,
"TerrainGroups": [
{
"RelativePosition": {
Expand All @@ -716,21 +677,7 @@
"z": 0
},
"RandomizeRotation": true
}
]
}
]
},
{
"RelativeChance": 1,
"TerrainGroups": [
{
"RelativePosition": {
"x": 0,
"y": 0,
"z": 0
},
"Chunks": [
},
{
"Visuals": "BariteTerrainChunk2",
"CollisionShapePath": "res://assets/models/microbe_terrain/BariteTerrainChunk2.shape",
Expand All @@ -747,7 +694,8 @@
]
},
{
"RelativeChance": 1,
"RelativeChance": 3,
"SpawnStrategy": 1,
"TerrainGroups": [
{
"RelativePosition": {
Expand All @@ -766,21 +714,7 @@
"z": 0
},
"RandomizeRotation": true
}
]
}
]
},
{
"RelativeChance": 1,
"TerrainGroups": [
{
"RelativePosition": {
"x": 0,
"y": 0,
"z": 0
},
"Chunks": [
},
{
"Visuals": "CalciteTerrainChunk2",
"CollisionShapePath": "res://assets/models/microbe_terrain/CalciteTerrainChunk2.shape",
Expand All @@ -797,7 +731,8 @@
]
},
{
"RelativeChance": 1,
"RelativeChance": 3,
"SpawnStrategy": 1,
"TerrainGroups": [
{
"RelativePosition": {
Expand All @@ -816,21 +751,7 @@
"z": 0
},
"RandomizeRotation": true
}
]
}
]
},
{
"RelativeChance": 1,
"TerrainGroups": [
{
"RelativePosition": {
"x": 0,
"y": 0,
"z": 0
},
"Chunks": [
},
{
"Visuals": "QuartzTerrain2",
"CollisionShapePath": "res://assets/models/microbe_terrain/QuartzTerrainChunk2.shape",
Expand All @@ -841,25 +762,11 @@
"z": 0
},
"RandomizeRotation": true
}
]
}
]
},
{
"RelativeChance": 1,
"TerrainGroups": [
{
"RelativePosition": {
"x": 0,
"y": 0,
"z": 0
},
"Chunks": [
},
{
"Visuals": "QuartzTerrain3",
"CollisionShapePath": "res://assets/models/microbe_terrain/QuartzTerrainChunk3.shape",
"Radius": 13.1,
"Radius": 12,
"RelativePosition": {
"x": 0,
"y": 0,
Expand Down Expand Up @@ -3265,11 +3172,11 @@
}
},
"Terrain": {
"MinClusters": 4,
"MaxClusters": 8,
"MinClusters": 2,
"MaxClusters": 7,
"PotentialClusters": [
{
"RelativeChance": 1,
"RelativeChance": 3,
"TerrainGroups": [
{
"RelativePosition": {
Expand All @@ -3288,21 +3195,7 @@
"z": 0
},
"RandomizeRotation": true
}
]
}
]
},
{
"RelativeChance": 1,
"TerrainGroups": [
{
"RelativePosition": {
"x": 0,
"y": 0,
"z": 0
},
"Chunks": [
},
{
"Visuals": "CalciteTerrainChunk2",
"CollisionShapePath": "res://assets/models/microbe_terrain/CalciteTerrainChunk2.shape",
Expand All @@ -3319,7 +3212,7 @@
]
},
{
"RelativeChance": 1,
"RelativeChance": 2,
"TerrainGroups": [
{
"RelativePosition": {
Expand All @@ -3338,21 +3231,7 @@
"z": 0
},
"RandomizeRotation": true
}
]
}
]
},
{
"RelativeChance": 1,
"TerrainGroups": [
{
"RelativePosition": {
"x": 0,
"y": 0,
"z": 0
},
"Chunks": [
},
{
"Visuals": "BasaltTerrainChunk2",
"CollisionShapePath": "res://assets/models/microbe_terrain/BasaltTerrainChunk2.shape",
Expand Down
2 changes: 2 additions & 0 deletions src/engine/common_components/CollisionShapeLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public struct CollisionShapeLoader : IArchivableComponent

public string CollisionResourcePath;

public bool SkipCollisionLoading;
Copy link
Member

@hhyyrylainen hhyyrylainen Dec 20, 2025

Choose a reason for hiding this comment

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

I think it would be clearer to just not set this component for stuff that doesn't want to collide...

Edit: and of course it would be more efficient as well to not create the physics component either for purely visual stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm pretty sure I tried it and I was getting an error because of it but I'll try

Copy link
Member

Choose a reason for hiding this comment

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

With the new ECS framework, you need to tell it the list of components beforehand, so you'll need a variant of the spawn method that uses a different component list, otherwise it'll blow up. For example for the normal chunks I needed to write quite a complex component list selection algorithm but this should be a simpler case that can be done with a single if branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay thanks, I have created new spawn variant


/// <summary>
/// Density of the shape. Only applies if <see cref="ApplyDensity"/> is true.
/// </summary>
Expand Down
7 changes: 5 additions & 2 deletions src/engine/common_systems/CollisionShapeLoaderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ private void Update(ref CollisionShapeLoader loader, ref PhysicsShapeHolder shap
density = 1000;
}

// TODO: switch to pre-processing collision shapes before the game is exported for faster runtime loading
shapeHolder.Shape = PhysicsShape.CreateShapeFromGodotResource(loader.CollisionResourcePath, density);
if (!loader.SkipCollisionLoading)
{
// TODO: switch to pre-processing collision shapes before the game is exported for faster runtime loading
shapeHolder.Shape = PhysicsShape.CreateShapeFromGodotResource(loader.CollisionResourcePath, density);
}

if (!loader.SkipForceRecreateBodyIfCreated)
shapeHolder.UpdateBodyShapeIfCreated = true;
Expand Down
1 change: 1 addition & 0 deletions src/microbe_stage/MicrobeCamera.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ backgroundPlane = NodePath("BackgroundPlane")
current = true

[node name="BackgroundPlane" parent="." instance=ExtResource("2_yrakl")]
transform = Transform3D(1.1, 0, 0, 0, 1.1, 0, 0, 0, 1.1, 0, 0, -10)
Copy link
Member

Choose a reason for hiding this comment

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

What's this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like I said in the description, I lowered the background image a bit

Copy link
Member

Choose a reason for hiding this comment

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

Ah, okay.
Did you test with the max multicellular zoom out distance to see if the edges of the plane are visible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I also increased the size of the background to negate it but I will have to check

Copy link
Member

Choose a reason for hiding this comment

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

Somehow I missed that. Otherwise I would have made sure the size to UV ratio is the same so that the visuals aren't stretched differently than before.

Loading