Hello, I'm interested in making a breeding game that has realistic genetics. When I search though, I notice that all guides point to a genetic algorithm being the way to go. But the genetic algorithm seems to be...for example, Red parent x blue parent = purple. What Im wanting to do is more like a punnet square, Parent 1 is RrBb and Parent 2 is rrBb. Offspring can be Red (RrBB, RrBb, Rrbb) Blue (rrBB, rrBb) or Nonblue (rrbb) with recessives carrying through generations. Whats a good starting point for learning how to do this? Thank you
Read different sources on genetic algorithms. There is no reason red x blue should ever = purple (unless you specifically want it to be that way).
I'm not sure if this is what you're asking or not, but I read your post and immediately thought it might be fun to try writing real quick. Dunno if this is how genes work or not, but it may get you started on the right path, anyway. Note this is untested code written while very distracted in a meeting. Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class GeneSimmons : MonoBehaviour { private char[] parent1 = new char[] {'R', 'r', 'B', 'B'}; private char[] parent2 = new char[] {'r', 'r', 'B', 'b'}; void Start() { for (int i = 0; i < 100; i++) { char[] child = HaveChild(parent1, parent2); Debug.Log("Child: " + child.toString()); } } private char[] HaveChild(char[] parentA, char[] parentB) { if (parentA.length != parentB.length) { Debug.LogError("Genetic anomaly!"); return null; } char[] child = new char[parentA.length]; for (int i = 0; i < child.length; i++) { child[i] = Random.value > 0.5f ? parentA[i] : parentB[i]; } return child; } }