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

Tweak mutations algorithm #2293

Merged
merged 21 commits into from
Jun 7, 2021

Conversation

adQuid
Copy link
Contributor

@adQuid adQuid commented Jun 4, 2021

Brief Description of What This PR Does

I was thinking about the feedback I got from the AI PR that the cells weren't aggressive enough, and I realized we were thinking in terms of trying to make weak cells more likely to attack the player instead of making cells stronger so it made more sense to attack the player. I set out to tweak the mutation add and remove rates, and realized an odd (probably unintended) quirk of the code: adding an organelle had 6 chances to happen (one out of a loop and five in it, but at the same probability), while deletion had a chance of happening PER ORGANELLE. This brings microbes to a natural equilibrium of 6 organelles, beyond which they would be increasingly more likely to mutate down than up, notwithstanding (and eventually overpowering) and influences from auto-evo. This probably helped cause my experience that I would always be the biggest microbe around me, unless I intentionally chose to stay very small.

This PR edits the algorithm to have an equilibrium of (creation chance / delete chance) squared. I've set the two chances to have an equilibrium of 25. In my experience, they still don't get that big, but it seems to help increase the chance that there's something around that might be able to engulf you. I've used:

var i = 0;
		foreach (MicrobeSpecies toSpawn in CurrentGame.GameWorld.Map.CurrentPatch.SpeciesInPatch.Keys)
		{
			if (toSpawn != Player.Species)
			{
				SpawnHelpers.SpawnMicrobe(toSpawn, Player.Translation + new Vector3(4.0f * ++i, 0.0f, 0.5f * (float)Math.Pow(CurrentGame.GameWorld.Map.CurrentPatch.GetSpeciesPopulation(toSpawn), 0.35)),
				rootOfDynamicallySpawned, SpawnHelpers.LoadMicrobeScene(), true, Clouds,
				CurrentGame);
			}
		}

at line 496 of MicrobeStage.cs to see what microbe species there are without having to swim around and find all of them.

I also changed the logic for a new genus to change genus name whenever a new type of organelle evolves rather than just being on a flat chance, just as an indulgence.

Progress Checklist

Note: before starting this checklist the issue should be marked as non-draft.

  • PR author has checked that this PR works as intended and doesn't
    break existing features:
    https://wiki.revolutionarygamesstudio.com/wiki/Testing_Checklist
    (this is important as to not waste the time of Thrive team
    members reviewing this PR)
  • Initial code review passed
  • Functionality is confirmed working by another person (see above checklist link)
  • Final code review is passed and code conforms to the
    styleguide.

Before merging all CI jobs should finish on this PR without errors, if
there are automatically detected style issues they should be fixed by
the PR author.

@hhyyrylainen hhyyrylainen requested a review from athariqk June 4, 2021 06:02
@hhyyrylainen hhyyrylainen changed the title Cleanup mutations Tweak mutations algorithm Jun 4, 2021
Copy link
Member

@athariqk athariqk left a comment

Choose a reason for hiding this comment

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

Found few things that could be improved.

adQuid and others added 2 commits June 4, 2021 18:30
@hhyyrylainen

This comment has been minimized.

@athariqk athariqk added this to the Release 0.5.4 milestone Jun 6, 2021
@buckly90
Copy link
Member

buckly90 commented Jun 6, 2021

Seems to work alright. Divergent species are seemingly a bit more diverse in layout. Did not notice any apparent issues.

Copy link
Member

@hhyyrylainen hhyyrylainen left a comment

Choose a reason for hiding this comment

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

Some code style comments.

@@ -391,6 +333,41 @@ private OrganelleDefinition GetRandomOrganelle(bool isBacteria)
"for a new organelle");
}

private MembraneType RandomMembraneType()
{
var simulation = SimulationParameters.Instance;
Copy link
Member

Choose a reason for hiding this comment

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

This is already looked up in the function calling this, should be passed in as a parameter.

{
bool copy = true;
OrganelleTemplate organelle = (OrganelleTemplate)parentOrganelle.Clone();
Copy link
Member

Choose a reason for hiding this comment

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

use var

@hhyyrylainen hhyyrylainen requested a review from athariqk June 6, 2021 19:30
@hhyyrylainen
Copy link
Member

As far as I can tell, there's just two of my comments left to solve, then this can be merged (play testing didn't bring up any issues).

@adQuid
Copy link
Contributor Author

adQuid commented Jun 7, 2021

Whoops, missed that.

@hhyyrylainen hhyyrylainen dismissed athariqk’s stale review June 7, 2021 11:41

changes were made

@hhyyrylainen hhyyrylainen merged commit 2954b44 into Revolutionary-Games:master Jun 7, 2021
@adQuid adQuid deleted the cleanup_mutations branch June 7, 2021 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants