Mutations/traits and bionics: Thoughts and rambling

I had some thoughts and looked at the code. Coding this would probably be way too big undertaking for me so I am just putting the thoughts here.

Bionics are practically completely hardcoded. They are working based on the ID of the bionic.

The bionic code is basically a big list of if( has_active_bionic( bionic_name) ) and if( has_bionic( bionic_id( " bionic_name" ) ) ) statements. The easiest fast fix would be to add flags to the bionics and then check for those flags instead of the names.
But for some effects a flag+magnitude combo would be needed. For example power storage would need to say how much power storage it adds.
The problem is that these if statements are also scattered outside the bionic.cpp. They are pretty much everywhere.

But then I thought about mutations.

What is the difference between mutations and bionics?
In-game the difference is only that mutations are listed in one list and bionics are listed in another list.
So it would make sense if they were the same thing in code. A mutation that adds +10% speed is same as a bionic that adds +10% speed.

Well mutations are hard coded just same as bionics are. Bunch of if( has_trait( trait_name) ) statements scattered everywhere.

Merging the mutations and bionics in a single system would instantly allow any new bionics to use effects that currently are in a mutation and vice versa. But merging the two systems would be massive project.

Being hardcoded really hinders changing these two systems. JSONized things like items and maps get regular small updates but bionics and mutations rarely get any updates.

2 Likes