Random Thoughts: Dietary Chemistry

I made you a biochemistry!

Apparently this is what I do in my free time now.

Apparently this is what I do in my free time now. Wikipedia FTW!

The above diagram still needs some work: I need to establish water, oxygen, fibre and enzyme requirements for the various metabolic processes. I might need to find better sources than wikipedia for that. I’d also like to simplify it: perhaps combine ATP, NADH, FADH2 and Quinol under the catchall of “energy” and eliminate the ATP Synthase and Citric Acid Cycle processes. Oh, and I need to work out how some bacterial colonies digest cellulose, and look into photosynthesis.

By now you’ve probably worked out what this is all about: at some point in the last few weeks I stopped thinking of “diet” and “dietary chemisty” as a game design problem, and started researching actual biochemistry instead. Turns out it’s fascinating. Who knew? Well, biochemists, probably. Slimy bastards been hogging all this fun to themselves.

In any case, the grubby fingerprints of evolution are all over the field of biochemistry. The entire metabolic system is built on progressively simpler but less efficient systems: you can elimate everything but glycolysis and anaerobic creatures can still get energy from ingesting glucose.

Researching it has also been an eye opener. I haven’t really learned any trivia I didn’t know before this, but I have tied together a large number of factoids I’d picked up via cultural osmosis and Attenborough documentries into a coherent, interelated web. “Termites and cows use bacterial colonies to digest plant matter”, “our muscles generate lactic acid when they can’t get oxygen fast enough”, “our body starts feeding on itself when we starve”, “animals breath in oxygen and breath out CO2”, those sort of things. Biochemistry links all these things together and tells us why they happen. Which is awesome.

This really is how I should have been designing these elements of the game from the very beginning. Although I still may not end up simulating biochemical evolution (doing so would violate the “seeing evolution happen” design goal), this bottom-up approach to diet provides us with several interesting elements that would otherwise be simulated seperately: oxygen and water requirements, as well as the… um… expulsion of CO2 and uh… undigestables. If we do include biochemical evolution, said… undigestables… might be digestable by other species, and could serve as as a… um… food… source…

Oh god what have I done. It’ll be just like that digimon I had as a kid.

SUBJECT CHANGE.

Of course, the requirement for water and oxygen (clean water! fresh oxygen! nothing to do with shit!) might have some impact on Primum Specium’s ability to survive. How’s PS going to get to water if it can’t even find food consistantly? The bottom-up approach states that problems are caused by the simulation not being accurate enough, so how do simple real-life organisms solve the oxygen and water problem?

The answer is diffusion: their cell membranes are thin enough to absorb the elements they require. Which means that the reason Primum Specium is having trouble surviving isn’t because it’s simple, but the opposite: it starts with a complex rough-skin texture (it’s actually rhino skin). This will have to be replaced by a transluscent membrane of some description. Which should be fun to do.

Displaying a complex, semi-accurate biochemical system like this to the user is going to be an interesting design challenge. Done right, it has the potential to be an interesting insight into how the creatures work, with the added bonus of providing bucketloads of tangential learning. Done wrong, it could very easily become an incomprehensible mess (like the flowchart above) that obscures why some creatures survive and others don’t.

To simplify it, one possibility is to treat it as a discreet process. Minecraft is a great example of discreet processes: you don’t craft 1.24kg of logs into 4.96kg of planks, you craft 1 log into 4 planks. It’s impossible to have less than 1 of any resource in minecraft, which is part of what makes the game so intuitive and satisfying: integers, especially small (two digit) integers, are much easier for most people to work with than fractions or decimals.

Thus, a discreet biochemistry system would involve 1 glucose being ‘crafted’ into 2 pyruvate. This mirrors the molecular reaction, where 1 molecule of glucose is broken down into 2 pyruvate molecules, which is a nice bonus.

In Species, of course, the majority of numbers are continuous. This is a matter of necessity, rather than game design: evolution is a continuous process. In fact, the numbers which have to be discreet (“head type”, “body covering”, etc) evolve very differently to the continuous ones: they operate under a “lucky monsters” system, where the rare mutants who have improved types have to actively survive and outcompete their brethren, rather than the entire population slowly changing on a statistical level.

The non-genetic numbers, though, don’t always have to be continuous. Some of them do: Kinetic energy and movement can’t be represented discreetly unless time is also represented discreetly, as in turn-based games like X-Comm. But diet is one place we could take things in the other direction: rather than continually absorbing energy from plants and meat, a creature’s feeding routine could easily be reconfigured to take discreet, periodic “bites”, with every number between there and energy being discreet.

It’s an interesting concept, and would make possible my ideal representation of the in-game metabolism: a functional infographic where you can actually watch each molecule being broken down into simpler molecules as it falls through the metabolic pipeline.

As always, much of this is long term stuff. Not as long term as some of these posts, though: as I wrap up my work on 0.6.0 I’m already thinking about what I’ll be including in the 0.7.0 release, and I’ll certainly be laying some of the foundations for this stuff.

Cheers,
Qu

PS: Random Screenshot.

Hi!

Hi!

“Called it.”

Advertisements
  1. #1 by Adam Benton on May 21, 2013 - 7:16 pm

    If you’re going to start giving them porous membranes will you take into account the fact such methods get less efficien as the organism gets larger?

  2. #2 by Anonymous on May 22, 2013 - 6:27 am

    I just recently found this game by watching an Indie Impressions video on YouTube. You truly have something absolutely remarkable here. As an aspiring student and scientist I must say that this is already quite appealing. Please continue to develop this game and demonstrate how technology can educate our minds and spark our curiosity.

  3. #3 by localSol on May 22, 2013 - 3:35 pm

    Now this sounds like good innovation! Congratulations on these ideas.

  4. #4 by Pierce Elliot on May 26, 2013 - 12:26 pm

    This sounds pleasantly complicated and I will definitely look forward to playing this with a Wikipedia page open in the background. Hope to also see some optimization (If any is possible on XNA, never worked with it so I don’t know what can be done) due to this idea I have of having several thousand creatures spread out over a large map. Maybe in a few years on better hardware hopefully.

    Anyways, I was digressing. Looking forward to the added dimension of a more in-depth metabolic system.

  5. #5 by Neovenator on May 28, 2013 - 7:42 am

    Since the main website is down, I’m just gonna ask a few questions and say a few things on the latest blog post.

    Is there any plans for an interactive biome editor, before or after map creation? I get very nice worlds, but it’s a bit hard to figure out what’s above or below waterline, or what the temperature will be. And if I want to add something afterwards, like split up some bits of land to make an island or merge some for some competition, I can’t really do that. Basically, map editors would give a bit of interactivity, so we can breed our favourite creatures away from competition or use Atlantis-style genocide on ones we think suck.

    Do you know about the worlds freezing on load? Not crashing, literally going sub-zero. When I reopen a world, it becomes a single, frigid glacier with shallow oceans. This can be solved with spam-clicking of ‘Fertilise’ and ‘Global Warming’, but it causes problems when we’ve managed to use natural islands to split up populations. It usually also causes a mass extinction event. From what I can gather, the bug is caused by the game forgetting the numbers for temperature and fertility, and going ‘screw this there must be none’.

    Can we have a mass-genocide button please? Again, for the purposes of wiping out species with giant buttocks (seriously, butt-monsters can become quite common) in favour of those awesome tusk-faced worms or whatever we want. This will probably be more easy than the whole map-editor thing.

    Is there a minimap button, and if not, would that sort of thing be easy to make? Being able to tell if something’s hot or cold or fertile or whatever would be very helpful.

    Finally, great game you’ve made! It’s finally satisfied my urge for evolution simulators, since those cell ones are visually boring and the 3D one is just setting parameters and having random flailing things follow them. This game actually feels like an evolutionary simulator, one that lives and breaths and makes extremely entertaining watching. My personal favourite thing to do is make a giant world, set my tree density very high, let stuff wander around, spam Fertilise and then flood the world so that I get a few populations. Before a crash (which is expected, it’s only 0.5), I managed to get a population, have it explode to a few thousand and eat itself to near-death, and then get saved by more Fertilising. (If you can’t tell I’m an avid user of Fertilise.)

    Keep up the good work! I’m having a blast with it, and once there’s some minor update to fix the whole ‘regular having to melt snowball earth’ thing, I’ll be on it even more often! (having to repeatedly recreate the population put me off a bit, so I might not play it too much until that happens) Since my laptop was made for gaming, I can run very large sims with relatively little lag (such as 5000 on a size-5 world), so say the word and I’ll be ready to test! Or just play until something notable pops up, but they’re basically the same thing.

  6. #6 by White parrot on May 28, 2013 - 8:07 am

    For now, how do you envision implementing drinking ?
    Could creatures dry the land in the same way that grazers currently drain fertility ?
    Would less permeable creatures rely on stealing the lifeblood on other beings or would they have little rivers of drinkable water ?

    You just opened a whole can of worms !
    Wriggling, delicious worms. 🙂

  7. #7 by Pierce Elliot on May 28, 2013 - 8:53 am

    @ Neovenator:

    Which is more important for this game? GPU, GPGPU (Why not?), or CPU power? I’m assuming CPU power as you mentioned you have 5000 creatures on a size 5 world. My Laptop has a decent GPGPU but in terms of CPU it’s lacking, verily much so (It’s a business laptop designed for the gamer on a business trip). But I was never on the forums so I figured this would be as good a place as any to ask that. I would LOVE to play a multi-thousand creature world and watch that evolve. Actually I guess I’ll go ahead and experiment with that.

  8. #8 by Pierce Elliot on May 28, 2013 - 9:07 am

    Alright, not to double post but yeah, ran this on a moderately fast quad-core with a terrible on board card. was able to run this at around 2500 creatures. Would’ve thought the GPGPU would’ve helped more than it did 😦

  9. #9 by ququasar on May 28, 2013 - 12:45 pm

    The neat thing about a bottom-up design approach is that these sort of relationships take care of themselves. If I implement diffusion as a function of surface area, and metabolism as a function of volume, the processes will scale naturally.

  10. #10 by ququasar on May 28, 2013 - 12:56 pm

    “Is there any plans for an interactive biome editor, before or after map creation?”

    0.6.0 will have a number of alternative world types (saltwater, freshwater and no water) and a number of different settings for temperature/fertility maps. Unfortunately, my terrain engine is optimised on the assumption that the heightmap doesn’t change, so geoforming is probably out of the question. OTOH, one thing we would definitely like to add is constructable fences.

    “Do you know about the worlds freezing on load?”

    Oh darnit, I thought we’d fixed that bug. Is anyone else reading this getting the same bug?

    Try running it in windowed mode, that sometimes had an effect on it.

    “Can we have a mass-genocide button please?”

    That’s what the temperature and water level controls are for! But for a more controlled form of mass genocide, 0.6.0 will have rovers capable of targeting creatures with specific statistics.

    It’s actually very close to release, I’m just finalising a few things and hoping my hosting provider gets the main site back up.

    “Is there a minimap button”

    0.6.0 will have a satellite map. Not a mini-one though, I’m afraid.

  11. #11 by ququasar on May 28, 2013 - 1:01 pm

    I expect most creatures will get enough water from their food: I want ‘drinking’ to be a specialisation rather than a necessity, because if they have to worry about both food and water they’ll have less time to do more interesting things, like hunt and mate and rebel against their creators.

    Rivers would be a nice touch, though. Jade had a few good idea’s about how we could simulate them, From Dust style. Given function rather than just being pretty I might be able to justify the time it’d take. Not in the short term, though.

  12. #12 by ququasar on May 28, 2013 - 1:05 pm

    CPU. Definitely CPU.
    Since every creature needs to be unique, we can’t implement the majority of tricks most games use to offload work to the gpu. We’re doing some things (the trees are completely hardware instanced, for example), but even with those measures there’s no realistic way to make the game anything but heavily CPU bound. Not in XNA, anyway.

  13. #13 by Neovenator on May 28, 2013 - 6:18 pm

    Okay, thanks! I’m really looking forwards to this new update, seems like it’ll really upgrade the game. I’ll go fiddle around to see if window/fullscreen changes the problem.

  14. #14 by Neovenator on May 28, 2013 - 6:22 pm

    Okay, it changed the problem from having everything freeze to a sudden unexplained drop in sea level. I would’ve print-screened, but that didn’t seem to work. I’ll go test it on an un-terraformed map now.

  15. #15 by Neovenator on May 28, 2013 - 6:28 pm

    Okay. Unchanged world iced over and crashed in both modes, dried-out world did the same, and three ice-over crashes seem to be enough to prove that those saves failed horribly for one reason or another.

  16. #16 by Neovenator on May 28, 2013 - 6:29 pm

    Tried another, that did the same.

  17. #17 by Neovenator on May 29, 2013 - 1:22 am

    Did another world, random creatures, size 1. Loaded it, didn’t crash, was still frozen. 10 temperature and fertility later, everything seems to be alive.

  18. #18 by Neovenator on May 29, 2013 - 1:28 am

    After more temperature fiddling and subsequent molten rock everywhere, I reloaded the original to test how much it would need to be a normal temperature.

    And everything was as I saved it. The game seems to enjoy making mutant hybrids of convenience and annoyingness.

  19. #19 by Neovenator on May 29, 2013 - 1:37 am

    After speeding it up a bit, I suspect it was already being terraformed when it reloaded. It crashed, reloaded the (frozen) autosave, then reloaded the (not-frozen) normal save.

  20. #20 by ququasar on May 29, 2013 - 12:59 pm

    Interesting. One thing you can do to verify the integrity of the saved worlds is to look at them in Windows Explorer. You’ll find them in \Species ALRE\Saves\. If the [mySaveName]_FMap.png file is has no red in it (if it’s entirely black or blue), then the saved world will be frozen.

    Otherwise something is going wrong during loading the game, which means one of two things: either your graphics card has some unique trait that causes an error during loading the file, or I effed up and uploaded the wrong hotfix to mediafire when the site went down. (I don’t *think* I did, but I’m not organised enough to dismiss the possibility. I’ll look into it)

  21. #21 by Neovenator on May 29, 2013 - 6:20 pm

    If you say how to find what type of card I have, I’ll go check that for you. While I’m waiting for that, though (unless it was the mediafire bug), I’ll check the maps.
    Well, the map I saved with fertility increase hasn’t had any problems; it’s deep blue with pink bits. TIME TO CHECK ANOTHER ONE. I’ll make a size 5, 6000 limit world. Land mass 0.4, temperature 0, variation 0.3, tree density 3. (Also, y’know that 5000 creatures, size 5 thing? I think I overestimated my laptop then. Probably about half that amount of creatures.)
    That one had deep blue, pink bits. However, I figured out that the problem is most likely to do with opening and loading worlds, since it froze over anyway.

  22. #22 by Neovenator on May 29, 2013 - 6:25 pm

    BTW, yeah, it’s more like 2000 creatures I can comfortably run at once.

  23. #23 by Neovenator on May 29, 2013 - 7:07 pm

    As a side note, I noticed a lot of cowardly creatures hugging the sealine in large numbers. Quite interesting. Not really sure why it happens, but it seems to be a success-right-now strategy, as there’s usually a mass-die-off for beachhuggers soon after they evolve.

  24. #24 by Pierce Elliot on May 30, 2013 - 5:01 am

    Yeah, I get the “ice age save” on occasion as well. Usually it’s not a problem and does a needed thinning out of the herd so I haven’t really been too upset by it. The frequency in which it occurs is very random. Can sometimes never occur on a world. But yes, it does have to do with the .png being completely black.

    On a side note, I’m very much looking forward to no longer having to play on an island.

  25. #25 by Pierce Elliot on May 30, 2013 - 5:07 am

    Oh and I guess that kind of spoils the idea of having the “GPGPU” thing which, as I was told, would offset work from the CPU to the GPGPU automatically. Which of course, can perform significantly more Gigaflops than the CPU. But doing some more research I found out, meh, I heard wrong.

    On another note, I did some research and from what I can conclude, XNA isn’t easily multi-threaded is it?

  26. #26 by skylimit on May 31, 2013 - 7:09 am

    the forum has been down for a while now… will it be back some day?

  27. #27 by Hancock on June 6, 2013 - 11:47 pm

    i’ve been suffering from the same ice age glitch.

  28. #28 by ASamaritakis on June 19, 2016 - 6:55 am

    Hey there, is it is possible for me to join the dev team? I want to help, and I have some awesome ideas! And graphical/programming skills.. 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: