giving dogs a value might be quite difficult, maybe you can allow some online exchange between players. then the players would set the price.
who wouldnt pay thousands for something beautiful like this?
I really really love the idea of online dog trading, but I'm already worried about having bit off more than I can chew and I just don't think I can justify trying to add an online/connected component. I'm aiming to have dogs be sharable some way (possibly through just their genetic codes, but maybe eventually with some more compact method), but it won't really figure into the game itself, so I gotta approach this economy thing differently!
...
Thanks for the breakdown! I wanna avoid any sort of microtransactions or online connectivity stuff (this won't be a social game), but it's still really interesting to see this stuff talked about; I know these games exist but I've never really played them. I might check some of these out later to see what they do in more depth.
--
Blergh.
I've been rewriting existing systems, which is always fun.
Just a warning, I really butcher my "genealogical" terminology here...
So, I was starting to design the dog value system and quickly realized that I was gonna need it to work very closely with the genetics systems I have going on. Not all mutations should be worth the same amount, and the value of a mutation probably shouldn't just be tied to how different it is from the base value. Most of my genetics code has been around since the early days of this project, or at least built off systems that were around back then, and it's all kind of difficult to work with and very spread out. It would've been possible to re-use everything, but there were some features I had issues with and over the long run re-writing this stuff is gonna be a net positive.
The main things I wanted this updated system to be able to do that the previous system could not were:
- Have directly query-able genetic properties.
- Be at least somewhat backwards-compatible.
- Reduce complexity for adding new genetic properties.
Previous, I had a sprawling function with hard-coded generation values I had to update every time I added a gene. When I wanted to use this gene I had to unwrap it in the exact order I created it in and it was gross and finicky and I had all sorts of weird code to support this pattern.
The basic idea behind the new system is that I now define the gene like this.
There are various properties I can choose to change how each specific gene works. All gene types have a key (used for querying), a length, and the ability to auto-generate both positive and negative values. This last one is important because all my genes are modifiers, not direct setters. A gene of all zeroes needs to ALWAYS return a its minimum value, so for any genes that need to go positive as well as negative, I double them up and have both a positive and negative modifier. If I didn't do this, a single gene ranging from -1 to 2 would return a value of -1 when zeroed out. With my system, however, I have two genes, one going from 0 to 1 and one going from 0 to 2. Each returns 0 when zeroed out, and by subtracting the first's value from the second, I still have my full range.
Moving on, super genes are genes that have the ability to undergo super mutations. This is my solution for infinite properties. A gene that undergoes a super mutation has a bit added to it and a corresponding max value increase (defined by the "Super Add" property). When a super gene is queried, the game compares its current length to its expected length and returns an appropriate result.
Finally, looped genes are essentially genes that wrap around. They have a standard length and a corresponding number of loops (sometimes given through code, sometimes added through this tool). The gene's total length is its standard length multiplied by its loop number. Every time it's queried it increments an internal counter that moves the start index along. When it reaches the end, it loops back around. I use these heavily for patterns, along with a random genetic seed each dog carries with it, so they can generate near-infinitely without repeating. This is important because dog body sizes are unbounded.
All of these values are taken in by my new system when a dog is generated, and a gene is created from them. If a ready-made gene is passed in, the system checks it against these tuned values and fixes it up as best it can if it's missing anything. After all this, it goes through and maps out all the individual values so I can query them whenever I want.
The main issue is still backwards compatibility. Order is important because it affects how mutations work, whether certain traits are more likely to be carried along together or not, but once a gene is generated there's only enough information to figure out if it's missing properties, not to determine which properties are missing or if the order has changed. To that end, my genetic fixup code has no problem tacking on additional genetic properties, but absolutely cannot manage inserted properties or re-ordered properties. This is an easy problem to fix with a standard save system, but a hard one to fix when I'd ultimately like dogs to be sharable entirely through a single genetic string. For now I'm moving forward with the assumption that I'll just avoid re-org changes after ship, but it's something I'd like to come up with a real solution for at some point.
While making these changes I also discovered a few bugs and leftover debug paths that hadn't been removed, and the general flow is generally much cleaner and easier to follow now. I also finally went in and added the ability for genes to crossover multiple times during breeding. This means that it's now actually possible to get any conceivable mish-mash of properties when two dogs breed, whereas before crossover only happened once at most, so certain property combinations would never result.
After all this, I had to hook up this new system to my existing systems and rip out all the old stuff. While doing this I exposed some previously existing bugs with my leg generation systems. There was some very unfortunate stuff going on in there, just the worst. Really not good at all. After a near existential crisis trying to re-write this functionality, leg generation now works much better than before (though with a few caveats for feet I need to address later). I fixed a ton of issues with legs generating in uneven ways and with gaps between segments, and legs now also correctly enforce a minimum size.
I know this looks like chaos but you'll just have to trust me when I say this is all working exactly as intended.
Phew. Anyways, my reward for all this is I now get to go back to work on the dog value system I've been trying to start on since Monday.
Some misc gifs for your time.