Help with Breeding Roller

Hey guys! 

I dabble in coding every now and then, never for any sort of profit or commissions...mainly for personal use. 

The HTML/CSS stuff I've learned has mostly been from messing around with DeviantArt journal skins and I'm fairly good at problem solving with it now. 

I am starting an ARPG Species on DeviantArt and I'm attempting to do all of the work 100% myself (because I like a good challenge). 

Are there any coders out there that might be willing to take on a young grasshopper and help me code my own breeding roller? 

I understand Java enough to be able to read it. I just don't know where exactly to start. Even if I could just have someone help me with the first portion that controls the base coats in the genetics, I SHOULD be able to do the rest with very minimal questions. 

Alternatively, if someone is bored and just wants to code the whole thing and teach me how to do it as you go, that's fine as well. :)


Basics of what I need: 

The breeding roller will be a tool for admins of the ARPG to roll the resulting litter of a breeding request from a player. Players will send in a comment with links to the two parents. I will need something that I can enter the genotype and a few other options into (such as if they have a breeding item that changes the chances for something). This breeding roller will need to randomly generate a number of pups between 1 and 8. It will then need to randomly generate genders for the resulting pups. It will then need to give genos for each pup based off of the genos from the parents, as well as a few random mutations and defects that have small chances of popping up in any breeding. 

I FEEL like this would essentially be a fairly simple project if someone were a master in Java, but I am nowhere near a master and don't even know where to start. It's like I can read the language, but I can't speak it. Lol. 

 
Lol, breeding and genetics is not a simple thing! It's actually one of the harder things to code, especially when you get into highly realistic genetics.

The basic idea is that you take each gene and you make a punnet square for the cross of each parent, compute all the possible outcomes from the mix of each gene combination -- and there you go, there are the random outcomes you can choose from for each pup.

Hiring a coder to do it for you is a better solution than counting on someone who will just volunteer their time and energy to do it for you for free.

 
Lol, breeding and genetics is not a simple thing! It's actually one of the harder things to code, especially when you get into highly realistic genetics.

The basic idea is that you take each gene and you make a punnet square for the cross of each parent, compute all the possible outcomes from the mix of each gene combination -- and there you go, there are the random outcomes you can choose from for each pup.

Hiring a coder to do it for you is a better solution than counting on someone who will just volunteer their time and energy to do it for you for free.
I thoroughly understand how genetics work, and I thoroughly understand how punnet squares work. I don't need help with the genetics portion at all, I just need help with how to get the genetics into the JavaScript. 

I also never asked for someone to do the entire thing for free, I asked if someone wouldn't mind teaching me, but stated if someone WANTED to do the entire thing I'm fine with that too. 

 
Last edited by a moderator:
So you have to apply the logic of the pungent square to javascript code. Take variables with the genes of both parents, split the genes into an array of their combinations, then generate a random number from 0 to length of the array-1 and select that index as the gene for your puppy. 

 
Last edited by a moderator:
Hiya!

I'm a beginner coder myself. I wanted to create my own pet generator imaging program, but I used python instead of javascript. I know it's not exactly what you're looking for, but maybe the concepts will be the same and it'll help you figure out an equivalent in js. So I created gene 'dictionaries'. Dictionaries allow for a key and a value paired up. In my code example, I currently have 5 primary genes listed in a dictionary like so primaryGene: { 1: 'basic', 2: 'tiger'... etc} 

If you're looking for the program to calculate children~ the user says mom has 'basic' and dad has 'tiger', then the program is set up to select a random number between 1 and 2 since 'basic' = 1 and 'tiger' =2. So say it picks 1 (this child takes after mom), then the 1 gets put back into the dictionary and outputs 'basic'. You create a function that holds this script so you can call it every time you want the program to pick the baby's genes. 

I also applied this same concept to my pet colors. I've created a library of 55 colors, each assigned a name and a RGB value. I'm an artist that's trying to learn how to code so I wanted to hand pick which colors I thought looked best. Anyways, I run the same code I mentioned before about getting mom and dad's inputs and randomly selecting a value within the set parent range. Having the dictionaries and selection code separate allows for you to edit the dictionaries without having it affect the function code itself... hopefully this makes sense. 

Again, I'm not a professional. I'm just doing this as a hobby and wanted to make my own pet thing, but hopefully this helped. 

If you'd like to mess around with what I've created, I made a test site here: http://skyflu.pythonanywhere.com/makekids
It's a bit slow at calculating the children results because I have python actually coloring and processing the pet images. So it has to do that four times for each baby. I set it up with one template and let the code do all the work. 

 
Last edited by a moderator:
Hi. I've worked on breeding and image generating code in PHP/MySQL. I haven't done anything like that with Javascript, but the concepts might be similar. You provide the genetics of each parent, it randomizes between the two, and then outputs a genotype for the offspring based on Mendelian law. 

Then we have another script that determines which genes are expressed based on a ladder of dominance for each allele. This part of the code assigns a name to each different type of expression. If A == agouti pattern and a == self, but A is dominant, then Aa expresses as agouti. The program then applies the agouti image and name.

 
Last edited by a moderator:
Back
Top