Systems like this are more about design than the raw programming implementation. First, take a step back and start thinking about the problem on paper. Design out how YOU would want a genetics system to work. For example, as hogwater suggested, perhaps the design is based on each creature having a list of traits. If this is the case, think about what sort of traits exist, how those traits could combine (for example, is it random chance that determines which traits are inherited, or does it pick a dominent/best one?
Alternatively, you can thin of how this information is represented, creating something more abstract by simulating a DNA style of thing. For example having a random string of characters, and subsequently deriving traits from patterns or sections in that string. Then, designing a scheme for merging two parent schematics.
All of this planning should be done on paper first, before you even think about how to program it. The same premise can be applied to any new problem that you come across. You may find that you don't know your way around GameMaker that well yet, or even if you tackle a brand new programming language, you may not know how best to achieve something there, however this does not take away from your ability to structure and design a plan for how things might work on paper
If you do this enough, you will quickly find that coming up with a design for a system gets easier, and then comparatively implementing it in code isn't as hard once you know what you are working towards.
This game design section of the forums is a good place to discuss these ideas more abstractly, but there's no need to think about the code yet, first, lets discuss ideas and designs for how something like this could work! Once you have come up with a plan, you can then start asking questions such as:
- What is the best way to give creatures a list of traits in gamemaker?
- How do I manipulate strings?
These will often be quite simple programming knowledge questions with simple solutions! Most of how you go about implementing systems is just about understanding what datastructures are available, you have a huge pool of resources to choose from. To give you a quick break down, as this may help generally, i'll run through a few I use every day:
-
Arrays: Great for storing lots of items of similar data. An array is basically a list of values which can be accessed with an index offset: score[0] = 10, score[1] = 20, you can then access a specific score by putting an expression inside the square brackets: score[player] = 10; (Where player is either 0 or 1 depending on which player it is).
-
Lists: Great for keeping a concise set of information where elements are added or removed more frequently. For example, implementing a deck of cards could use a list of cards still remaining in the deck. Once a card is removed, it is deleted from the list.
-
Maps: A map is a very versatile datastructure which "maps" an identifer to a value. This is often a string/text identifier. A map is great for something like a trait system, as you could do something like: map[? "Speed"] = 1.0; You can also check if something has a given element in a map using the ds_map_exists function. This is ideal for systems where some creatures may have special traits or properties, but others don't. For example, one creature of the same breed may have the "Timid" property, but another may not. A map is a great way of structuring information like this.
You'll also need to get a reasonable level of confidence with regular variables, and general ideas to do with instances having different properties/variables associated with them, and how using variables in place of values throughout an objects code allows it to be reactive to changes in its genetic signature.
So takeaway points here are to separate the design of the problem/game-mechanic away from the programming implementation, and only once you have worked out the details of what needs to happen, should you start worrying about the implementation in code.
Good luck with it