Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
30a9996
Exclude nucleus from specialisation calculation
Accidental-Explorer Mar 13, 2026
f36185d
Switched to using hex counts instead of organelle number to normalize…
Accidental-Explorer Mar 13, 2026
54ff465
Removed the minimum size for specialisation
Accidental-Explorer Mar 13, 2026
0a005a0
Corrected usage of the nucleus check.
Accidental-Explorer Mar 16, 2026
49dbad2
Moved assignments of the nucleusDefinition to field in classes.
Accidental-Explorer Mar 16, 2026
f5cd750
Format
Accidental-Explorer Mar 16, 2026
65318e7
Removed assignement of nucelus definition from class in two cases
Accidental-Explorer Mar 16, 2026
5a9949b
Merge remote-tracking branch 'origin/changed-specialisation-calculati…
Accidental-Explorer Mar 17, 2026
199bf6e
Removed assignment of nucleus definition from class in two cases
Accidental-Explorer Mar 16, 2026
4ede9c1
Merge remote-tracking branch 'origin/changed-specialisation-calculati…
Accidental-Explorer Mar 17, 2026
2c22f7f
Merge branch 'master' into changed-specialisation-calculation
Accidental-Explorer Mar 17, 2026
7323510
Made cell specialisation bonus apply to positive effects on environme…
Accidental-Explorer Mar 18, 2026
10f8464
Merge branch 'master' into changed-specialisation-calculation
Accidental-Explorer Mar 18, 2026
434b9ec
post-merge adaptation.
Accidental-Explorer Mar 18, 2026
cd02bd6
Merge branch 'changed-specialisation-calculation' into expanded-cell-…
Accidental-Explorer Mar 18, 2026
f3178ff
WIP cell specialisation effect on storage capacity.
Accidental-Explorer Mar 19, 2026
7850aa4
Resolved ambiguity
Accidental-Explorer Mar 19, 2026
e272d8b
Applied cell specialization bonus to flagellum speed
Accidental-Explorer Mar 20, 2026
00bc5be
WIP add cell specialization Bonus to rotation speed from cilia
Accidental-Explorer Mar 20, 2026
9c91a69
Tried to correctly prepare for multicellular adjacency in one location.
Accidental-Explorer Mar 20, 2026
392deed
Store cell specialization bonus in new entity component, and use that…
Accidental-Explorer Mar 23, 2026
2f1a333
Line too long
Accidental-Explorer Mar 23, 2026
e457a7a
Format fix?
Accidental-Explorer Mar 23, 2026
c23ba30
Apply cell specialization bonus to digestion speed and efficiency fro…
Accidental-Explorer Mar 23, 2026
0a49ffa
remove forgotten TODO
Accidental-Explorer Mar 24, 2026
8995a5f
Ensure that flagella are also affected by cell specialization bonus i…
Accidental-Explorer Mar 24, 2026
be4c9cb
Apply cell specialization bonus to pulling cilia force and range. Als…
Accidental-Explorer Mar 24, 2026
37205a8
Merge remote-tracking branch 'origin/expanded-cell-specialization-eff…
Accidental-Explorer Mar 25, 2026
9f78133
Format fix.
Accidental-Explorer Mar 25, 2026
4e62d5b
Make cell specialization bonus affect slimejet emission amount, movem…
Accidental-Explorer Mar 25, 2026
78db62d
Fixed forgotten step in slime jets.
Accidental-Explorer Mar 25, 2026
2146f97
Merge branch 'master' into expanded-cell-specialization-effects
Accidental-Explorer Apr 22, 2026
100d06c
Fixed merge conflicts
Accidental-Explorer Apr 22, 2026
84cb4ee
line too long
Accidental-Explorer Apr 22, 2026
95ac28e
removed unused nucleusDefinition
Accidental-Explorer Apr 22, 2026
a534d43
Implemented specialization bonus for colony rotation speed in Microbe…
Accidental-Explorer Apr 22, 2026
d15526d
Updated comments
Accidental-Explorer Apr 22, 2026
1800451
made specialization bonus to digestion subjectively more readable
Accidental-Explorer Apr 22, 2026
e94333a
Format preference
Accidental-Explorer Apr 23, 2026
3487056
fixed the prey in GetPredationScore using the predator's score
Accidental-Explorer Apr 23, 2026
4e98197
Auto-evo emulation of specializationBonus effect on toxins
Accidental-Explorer Apr 23, 2026
5b69376
Make specialization bonus affect toxin fire rate
Accidental-Explorer Apr 23, 2026
2d8f2bf
Merge branch 'master' into expanded-cell-specialization-effects
Accidental-Explorer Apr 23, 2026
dac146c
Fixed broken merge
Accidental-Explorer Apr 23, 2026
4bcc552
Reduced amount of times CalculateSpecializationBonus is used for GetT…
Accidental-Explorer Apr 23, 2026
436021f
Fixed indentation
Accidental-Explorer Apr 23, 2026
c78225b
Line too long...
Accidental-Explorer Apr 23, 2026
9dbc729
Merge remote-tracking branch 'origin/expanded-cell-specialization-eff…
Accidental-Explorer Apr 23, 2026
6e77315
Re-applied formatting change
Accidental-Explorer Apr 23, 2026
7e2f510
removed one excessive application of specialization bonus
Accidental-Explorer Apr 23, 2026
5993a34
band-aid fix for player starting without glucose at game start.
Accidental-Explorer Apr 23, 2026
1802965
Merge branch 'master' into expanded-cell-specialization-effects
Accidental-Explorer Apr 27, 2026
f15f4c3
Added adjacency specialization bonus to relevant methods in CellBodyP…
Accidental-Explorer Apr 27, 2026
2f46b64
Removed already completed TODO
Accidental-Explorer Apr 27, 2026
e53360d
Revert "band-aid fix for player starting without glucose at game start."
Accidental-Explorer Apr 27, 2026
24fcf51
Calculate SpecializationBonus earlier in OnAttemptedInAutoEvo
Accidental-Explorer Apr 27, 2026
d4e5092
Moved CalculateSpecialization to before CalculateRotationSpeed in Cel…
Accidental-Explorer Apr 27, 2026
837621c
Changed CellType's SpecializationBonus to explicitly CellTypeSpeciali…
Accidental-Explorer Apr 28, 2026
14c823e
renamed SpecializationBonus in SpecializationFactor.cs to TotalSpecia…
Accidental-Explorer Apr 28, 2026
84750e3
Line too long.
Accidental-Explorer Apr 28, 2026
7ea8720
fixed one skipped field
Accidental-Explorer Apr 28, 2026
390d58b
Clarification of cariable names in Spawners.cs
Accidental-Explorer Apr 28, 2026
6744905
Clarified variables in OrganelleContainer.cs and fixed one usage of t…
Accidental-Explorer Apr 28, 2026
4c295f9
more explicit variable naming
Accidental-Explorer Apr 28, 2026
a5ca2d2
Fixed apparent bug with CalculateDayVeryingCompoundsFillTimes not usi…
Accidental-Explorer Apr 28, 2026
1762291
Yet more variable renaming and cleanup
Accidental-Explorer Apr 28, 2026
dee1c17
Format
Accidental-Explorer Apr 28, 2026
a209359
More format
Accidental-Explorer Apr 29, 2026
6298670
Even more format
Accidental-Explorer Apr 29, 2026
f86c9b8
Merge branch 'master' into expanded-cell-specialization-effects
Accidental-Explorer Apr 30, 2026
a37c96a
Merge branch 'master' into expanded-cell-specialization-effects
Accidental-Explorer May 4, 2026
5550608
Ensured systems are marked as needing to read the SpecializationFacto…
Accidental-Explorer May 4, 2026
bd961c8
Added brackets to fix calculation.
Accidental-Explorer May 4, 2026
66a347e
Removed debug print
Accidental-Explorer May 4, 2026
9ce0530
Correct linewrapping
Accidental-Explorer May 4, 2026
5915d2b
Removed specialization effect on pulling cilia range
Accidental-Explorer May 4, 2026
8e55bfc
removed already completed TODO
Accidental-Explorer May 4, 2026
1b69d5f
Use existing work memory instead of creating new dictionaries.
Accidental-Explorer May 5, 2026
cd1e089
Removed specialization calculation from HandleNightSpawnCompounds in …
Accidental-Explorer May 5, 2026
54ecf5e
added documentation for the multicellular version of CalculateTolerances
Accidental-Explorer May 5, 2026
4462a44
Added specialization and adjacency effect to Multicellular environmen…
Accidental-Explorer May 5, 2026
19ede9f
Add default SpecializationFactor components for old saves
hhyyrylainen May 6, 2026
d530cb5
Ensure OnReturnFromEditor updates the player cell with the appropriat…
Accidental-Explorer May 6, 2026
b5243a4
Fix duplicate cell property component read in type apply
hhyyrylainen May 6, 2026
a2bf00d
Merge branch 'master' into expanded-cell-specialization-effects
hhyyrylainen May 6, 2026
3567d1d
Have auto-evo re-use species specializationbonus instead of recalcula…
Accidental-Explorer May 6, 2026
ab71429
reduced recalculation of specialization bonus for auto-evo in the tol…
Accidental-Explorer May 6, 2026
95615c6
Corrected methods in MicrobeEditor.cs to use the correct set of organ…
Accidental-Explorer May 7, 2026
874a5dc
Calculate specialization bonus for GenerateRandomSpecies tolerance setup
Accidental-Explorer May 7, 2026
7d5704f
Removed checks I forgot to remove
Accidental-Explorer May 7, 2026
6496443
'Fix' the auto evo and suggestion systems by re-calculating the speci…
Accidental-Explorer May 7, 2026
d184064
Calculate specializationbonus on calculationSpecies instead of initia…
Accidental-Explorer May 8, 2026
dcbcd2a
Make ApplyCellEffectsOnTolerances for multicellular species use cache…
Accidental-Explorer May 8, 2026
4c885d2
Have editing the cell type in the MulticellularEditor also call to us…
Accidental-Explorer May 8, 2026
95e00ab
Revert "Have editing the cell type in the MulticellularEditor also ca…
Accidental-Explorer May 8, 2026
89b00cb
Ensure updating cell specializationbonus when finished editing a cell…
Accidental-Explorer May 8, 2026
6c0a6cb
Merge branch 'master' into expanded-cell-specialization-effects
Accidental-Explorer May 8, 2026
0336606
Fix broken merge
Accidental-Explorer May 8, 2026
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
4 changes: 3 additions & 1 deletion src/auto-evo/mutations/CommonMutationFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ public static MicrobeSpecies GenerateRandomSpecies(MicrobeSpecies mutated, Patch
MutationLogicFunctions.ColourNewMicrobeSpecies(random, mutated);
}

mutated.ModifiableTolerances.CopyFrom(forPatch.GenerateTolerancesForMicrobe(mutated.Organelles));
mutated.ModifiableTolerances.CopyFrom(forPatch.GenerateTolerancesForMicrobe(mutated.Organelles,
Comment thread
hhyyrylainen marked this conversation as resolved.
MicrobeInternalCalculations.CalculateSpecializationBonus(mutated.Organelles,
new Dictionary<OrganelleDefinition, int>())));

// Override the default species starting name to have more variability in the names
var nameGenerator = SimulationParameters.Instance.NameGenerator;
Expand Down
52 changes: 34 additions & 18 deletions src/auto-evo/simulation/SimulationCache.cs
Comment thread
hhyyrylainen marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,11 @@ public EnergyBalanceInfoSimple GetEnergyBalanceForSpecies(MicrobeSpecies species
// TODO: check if caching instances of these objects would be better than always recreating
var cached = new EnergyBalanceInfoSimple();

// Assume here that the species specialization factor may not be up to date, so recalculate here
var specialization = MicrobeInternalCalculations.CalculateSpecializationBonus(species.Organelles, workMemory1);
var totalSpecializationBonus = species.CellTypeSpecializationBonus;

// Auto-evo uses the average values of compound during the course of a simulated day
ProcessSystem.ComputeEnergyBalanceSimple(species.Organelles, biomeConditions,
GetEnvironmentalTolerances(species, biomeConditions), specialization, species.MembraneType,
GetEnvironmentalTolerances(species, biomeConditions), totalSpecializationBonus, species.MembraneType,
maximumMovementDirection, true, species.PlayerSpecies, worldSettings, CompoundAmountType.Average, this,
cached);

Expand All @@ -169,8 +168,13 @@ public float GetSpeedForSpecies(MicrobeSpecies species)
return speed;
}

var cached = MicrobeInternalCalculations.CalculateSpeed(species.Organelles.Organelles, species.MembraneType,
species.MembraneRigidity, species.IsBacteria, true);
var organelles = species.Organelles;

// For MicrobeSpecies, Cell Type Specialization = Total Specialization Bonus
var totalSpecializationBonus = species.CellTypeSpecializationBonus;

var cached = MicrobeInternalCalculations.CalculateSpeed(organelles.Organelles, species.MembraneType,
species.MembraneRigidity, species.IsBacteria, totalSpecializationBonus, true);

cachedBaseSpeeds.Add(key, cached);
return cached;
Expand Down Expand Up @@ -202,7 +206,12 @@ public float GetRotationSpeedForSpecies(MicrobeSpecies species)
// prey species by multiple predators might benefit ever so slightly, but it seems kind of unlikely).
// A more useful thing would be to cache this directly in the species when calculating other movement cached
// properties.
return MicrobeInternalCalculations.CalculateRotationSpeed(species.Organelles.Organelles);
var organelles = species.Organelles;

// For MicrobeSpecies, Cell Type Specialization = Total Specialization Bonus
var totalSpecializationBonus = species.CellTypeSpecializationBonus;

return MicrobeInternalCalculations.CalculateRotationSpeed(organelles.Organelles, totalSpecializationBonus);
}

public float GetCompoundConversionScoreForSpecies(CompoundDefinition fromCompound, CompoundDefinition toCompound,
Expand Down Expand Up @@ -390,9 +399,13 @@ public float GetPredationScore(Species predatorSpecies, Species preySpecies, Bio
}
}

// This will be used at several points to mimic the effect the specialization bonus has on organelles
var specializationBonus = predator.CellTypeSpecializationBonus;
var preySpecializationBonus = prey.CellTypeSpecializationBonus;

var predatorHexSize = GetBaseHexSizeForSpecies(predator);
var preyHexSize = GetBaseHexSizeForSpecies(prey);
var enzymesScore = GetEnzymesScore(predator, prey.MembraneType.DissolverEnzyme);
var enzymesScore = GetEnzymesScore(predator, prey.MembraneType.DissolverEnzyme, specializationBonus);
var canDigestPrey = predatorHexSize / preyHexSize > Constants.ENGULF_SIZE_RATIO_REQ && canEngulf &&
enzymesScore > 0.0f;

Expand Down Expand Up @@ -446,22 +459,25 @@ public float GetPredationScore(Species predatorSpecies, Species preySpecies, Bio
var preyToolScores = GetPredationToolsRawScores(prey);

var toxicity = predatorToolScores.AverageToxicity;
var macrolideScore = predatorToolScores.MacrolideScore;
var predatorSlimeJetScore = predatorToolScores.SlimeJetScore;
var pullingCiliaModifier = predatorToolScores.PullingCiliaModifier;
oxytoxyScore *= specializationBonus;
cytotoxinScore *= specializationBonus;
channelInhibitorScore *= specializationBonus;
var macrolideScore = predatorToolScores.MacrolideScore * specializationBonus;
var predatorSlimeJetScore = predatorToolScores.SlimeJetScore * specializationBonus;
var pullingCiliaModifier = predatorToolScores.PullingCiliaModifier * specializationBonus;
var strongPullingCiliaModifier = pullingCiliaModifier * pullingCiliaModifier;
var predatorToxinResistance = predator.MembraneType.ToxinResistance;
var predatorPhysicalResistance = predator.MembraneType.PhysicalResistance;

var preySlimeJetScore = preyToolScores.SlimeJetScore;
var preySlimeJetScore = preyToolScores.SlimeJetScore * preySpecializationBonus;
var preyMucocystsScore = preyToolScores.MucocystsScore;
var preyPilusScore = preyToolScores.PilusScore;
var preyInjectisomeScore = preyToolScores.InjectisomeScore;
var preyToxicity = preyToolScores.AverageToxicity;
var preyOxytoxyScore = preyToolScores.OxytoxyScore;
var preyCytotoxinScore = preyToolScores.CytotoxinScore;
var preyMacrolideScore = preyToolScores.MacrolideScore;
var preyChannelInhibitorScore = preyToolScores.ChannelInhibitorScore;
var preyOxytoxyScore = preyToolScores.OxytoxyScore * preySpecializationBonus;
var preyCytotoxinScore = preyToolScores.CytotoxinScore * preySpecializationBonus;
var preyMacrolideScore = preyToolScores.MacrolideScore * preySpecializationBonus;
var preyChannelInhibitorScore = preyToolScores.ChannelInhibitorScore * preySpecializationBonus;
var preyOxygenMetabolismInhibitorScore = preyToolScores.OxygenMetabolismInhibitorScore;
var defensivePilusScore = preyToolScores.DefensivePilusScore;
var defensiveInjectisomeScore = preyToolScores.DefensiveInjectisomeScore;
Expand Down Expand Up @@ -1222,7 +1238,7 @@ public PredationToolsRawScores GetPredationToolsRawScores(MicrobeSpecies microbe
return predationToolsRawScores;
}

public float GetEnzymesScore(MicrobeSpecies predator, string dissolverEnzyme)
public float GetEnzymesScore(MicrobeSpecies predator, string dissolverEnzyme, float specializationBonus)
{
// This is not cached as it is not useful at the present time (as this is only called from places that cache
// stuff)
Expand Down Expand Up @@ -1263,9 +1279,9 @@ public float GetEnzymesScore(MicrobeSpecies predator, string dissolverEnzyme)

// If not digestible, mark that as a 0 score
if (!isMembraneDigestible)
enzymesScore = 0;
return 0;

return enzymesScore;
return enzymesScore * specializationBonus;
}

public ResolvedMicrobeTolerances GetEnvironmentalTolerances(MicrobeSpecies species,
Expand Down
3 changes: 2 additions & 1 deletion src/general/GameWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ public static void SetSpeciesInitialTolerances(Species species, PatchMap map, Pa

if (species is MicrobeSpecies microbeSpecies)
{
species.ModifiableTolerances.CopyFrom(patch.GenerateTolerancesForMicrobe(microbeSpecies.Organelles));
species.ModifiableTolerances.CopyFrom(patch.GenerateTolerancesForMicrobe(microbeSpecies.Organelles,
microbeSpecies.CellTypeSpecializationBonus));
}
else if (species is MulticellularSpecies multicellularSpecies)
{
Expand Down
3 changes: 2 additions & 1 deletion src/general/base_stage/CreatureStageBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,8 @@ private void CheckPerformanceEnoughForSimulationSpeed()

private void AdjustTolerancesToWorkInPatch(MicrobeSpecies species, Patch currentPatch)
{
var optimal = currentPatch.GenerateTolerancesForMicrobe(species.Organelles);
var optimal = currentPatch.GenerateTolerancesForMicrobe(species.Organelles,
species.CellTypeSpecializationBonus);

var current = MicrobeEnvironmentalToleranceCalculations.CalculateTolerances(species, currentPatch.Biome);

Expand Down
2 changes: 1 addition & 1 deletion src/general/mutation_points/CellTypeEditsFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public bool IsBacteria
/// </summary>
public string? SplitFromTypeName => originalCell.SplitFromTypeName;

public float SpecializationBonus =>
public float CellTypeSpecializationBonus =>
throw new NotSupportedException("This class doesn't dynamically recalculate the specialization bonus");

// TODO: check that this is right (there might sometimes be too many items in removedOrganelles)
Expand Down
2 changes: 1 addition & 1 deletion src/general/mutation_points/MicrobeEditsFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public string CellTypeName
/// </summary>
public string? SplitFromTypeName => microbeSpecies.SplitFromTypeName;

public float SpecializationBonus =>
public float CellTypeSpecializationBonus =>
throw new NotSupportedException("This class doesn't dynamically recalculate the specialization bonus");

public int Count
Expand Down
2 changes: 1 addition & 1 deletion src/general/world_effects/AmmoniaProductionEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static float GetSpeciesModifiersForEffect(Species species, out ResolvedMi
resolvedTolerances = MicrobeEnvironmentalToleranceCalculations.ResolveToleranceValues(
MicrobeEnvironmentalToleranceCalculations.CalculateTolerances(microbeSpecies, biome));

specialization = microbeSpecies.SpecializationBonus;
specialization = microbeSpecies.CellTypeSpecializationBonus;
}
else if (species is MulticellularSpecies multicellularSpecies)
{
Expand Down
13 changes: 11 additions & 2 deletions src/microbe_stage/ICellDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public interface ICellDefinition : IReadOnlyCellDefinition, ISimulationPhotograp

public string FormattedName { get; }

/// <summary>
/// A multiplier starting from 1 and going up based on how specialized this cell type is. This is eventually
/// applied to <see cref="Components.BioProcesses.OverallSpeedModifier"/> and many other systems.
/// Does not include any adjacency bonus effects that may be applied later.
/// </summary>
public float CellTypeSpecializationBonus { get; set; }

/// <summary>
/// Repositions the cell to the origin and recalculates any properties dependent on its position.
/// </summary>
Expand All @@ -49,6 +56,8 @@ public interface IReadOnlyCellDefinition
public interface ICellTypeDefinition : ICellDefinition, IReadOnlyCellTypeDefinition
{
public new int MPCost { get; set; }

public new float CellTypeSpecializationBonus { get; }
}

public interface IReadOnlyCellTypeDefinition : IReadOnlyCellDefinition, IPlayerReadableName
Expand All @@ -66,7 +75,7 @@ public interface IReadOnlyCellTypeDefinition : IReadOnlyCellDefinition, IPlayerR
/// A multiplier starting from 1 and going up based on how specialized this cell type is. This is eventually
/// applied to <see cref="Components.BioProcesses.OverallSpeedModifier"/>
/// </summary>
public float SpecializationBonus { get; }
public float CellTypeSpecializationBonus { get; }
}

/// <summary>
Expand Down Expand Up @@ -127,7 +136,7 @@ public static void SetupWorldEntities(this ICellDefinition definition, IWorldSim
workMemory1, workMemory2)
{
// For visualization the bonus doesn't matter, but we need to set a valid value
SpecializationBonus = 1,
CellTypeSpecializationBonus = 1,
};

species.SetupWorldEntities(worldSimulation);
Expand Down
4 changes: 3 additions & 1 deletion src/microbe_stage/IOrganelleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public interface IOrganelleComponent
/// <see cref="UpdateSync"/>
/// </summary>
/// <param name="organelleContainer">Organelle container instance this organelle is inside</param>
/// <param name="specializationFactor">Organelle effect bonus cell from specialization and adjacency</param>
/// <param name="microbeEntity">Entity reference of the entity that contains this organelle</param>
/// <param name="worldSimulation">
/// The simulation this entity is in. Care needs to be taken on what operations are safe to perform here in an
Expand All @@ -28,7 +29,8 @@ public interface IOrganelleComponent
/// </param>
/// <param name="energyCostMultiplier">modifies the amount of ATP to be consumed by organelles</param>
/// <param name="delta">Time since the last update in seconds</param>
public void UpdateAsync(ref OrganelleContainer organelleContainer, in Entity microbeEntity,
public void UpdateAsync(ref OrganelleContainer organelleContainer, ref SpecializationFactor specializationFactor,
in Entity microbeEntity,
IWorldSimulation worldSimulation, float energyCostMultiplier, float delta);

/// <summary>
Expand Down
Loading