Wednesday, April 12, 2017

Digestion Game Work, Typing Outloud

hey all,

Still slaving away at the digestion game. Those horrible redundancies I found last week are now all cleared away, but I am left with the design decision of how to keep track of the player's nutrients.

In a nutshell, it has to do with time. Right now, in the mouth level the player is in control of when food spawns in for chewing and swallowing. Because of this the player could just hit the space key a bunch of times and have chicken, pizza, and whatever shot at their face over a few seconds. If the player successfully chews and swallows all that food in such a short time, under the current rules, the player will just go to the next stage of digestion in the stomach. Or the player could start the level, go away and do something else, letting game time tick by, basically starving the avatar to death. But because I'm not keeping track of efficiency in this level, nothing will really change in either case. The question is: should I be keeping track of this?

In the stomach, the player is not in control of when or how often food appears. I've already spent a lot of time developing a cyclic function that ramps up and then ramps down the appearance of food chunks from the esophagus. This is supposed to mimic meal time, with peak food ingestion occurring every X seconds. One course of action would be to rig the function so that meals occur at 8AM, 12PM, and 6PM, and then fast forward through the night to 8AM again. Or maybe force the player to spend the night digesting the day's food. This second option seems to match reality more.

The same problem occurs in the small intestine. The player is not in control of when the nutrients appear any more, but again there is a cyclic function. Based on my gut feelings (haha) of the above, I think saving the game time from the stomach level and continuing the digestive process from there seems most logical. After all, if the goal is to make the player understand digestion, seeing how much time it takes for food to be processed by their body sounds like a good learning goal.

The big issue lurking behind all this discussion of time and energy is player health. A large part of one's health is determined by the ratio between how much energy is coming in and how much energy is being used up. If more is being used up, the player should starve, right? And if more is coming in, the player should get fat, right? So far, at least, I have focused my time and thinking about the latter more than the former, and actually I'm not sure if it would be a good idea to include the first option. I mean, if you are not getting enough food, there is not much digestion going on, so what can you learn about the process of digestion, right?

In any case, I have been thinking that I will need some way to keep track of game time, and of displaying the game time to the player. Also, I'll need caloric values for my food chunks and nutrients. Then, I'll need an upkeep value for the human body. Luckily, we already have the figure of about 1,500 ~ 2,500 Calories/day for the average adult. Based on the player's initial choice of diet (only meat, random, food pyramid, etc), I can change what foods appear. This will lead to differences in what food chunks appear in the stomach, and later to differences in what nutrients appear in the small intestines. I think I will use the small intestine as the place to show how the player's choices have affected their body, since it is in the small intestine where nutrients are actually absorbed by the body. Since I know how much energy the body needs, it should be a relatively simple matter to figure out if the player's choices are producing more, less, or an appropriate amount of energy for the body to use. Here's a little snippet of what I've been working on:

for (int i = 0; i < totalFoodChunks.Count; i++) { totalCarbs += totalFoodChunks[i].GetComponent().carbAmount; totalProteins += totalFoodChunks[i].GetComponent().proteinAmount; totalFats += totalFoodChunks[i].GetComponent().fatAmount; } carbPercent = totalCarbs / (float)(totalCarbs + totalFats + totalProteins); fatPercent = totalFats / (float)(totalCarbs + totalFats + totalProteins); proteinPercent = totalProteins / (float)(totalCarbs + totalFats + totalProteins); integralPart = (int)(carbPercent * 100) + (int)(fatPercent * 100) + (int)(proteinPercent * 100); decimalPart.Add(new NutrientRatio(NutrientType.Carbohydrate, (carbPercent * 100) - (int)(carbPercent * 100))); decimalPart.Add(new NutrientRatio(NutrientType.Protein, (proteinPercent * 100) - (int)(proteinPercent * 100))); decimalPart.Add(new NutrientRatio(NutrientType.Lipid, (fatPercent * 100) - (int)(fatPercent * 100))); remainder = 100 - integralPart; if (remainder != 0) { decimalPart.Sort(); decimalPart.Reverse(); for (int i = remainder; i >= 0; i--) { decimalPart[i % decimalPart.Count].amount++; } }

This is one of my functions that at the start of a level loops through all the food pieces and gets the values for its protein, carbohydrate, and lipid content, then computes the percentage of each, and lastly uses the same Hamiltonian method for converting a floating point percentage into a representative integral one that I used in my personality code months ago. I'm using this, again, only at the start of the level to set the chance of spawning a protein, carbohydrate, or lipid based on the food pieces the player ate before. Since the amount of energy for a gram of lipid, carbohydrate, and protein is pretty well-known (9 Calories, 4.5 Calories, and 4.5 Calories respectively,) from these I can compute how much energy the player is receiving. Cheers,

Tuesday, April 4, 2017

Yet More Digestion Game Work

hey all,

I've been working even more on the digestion game. Specifically, I have been implementing a scenario menu which allows the player to choose what kinds of food they will be eating. For example, they could follow the food pyramid, eat totally random foods, only eat meats, sweets, fruits, vegetables, or fruits and vegetables. At the moment, this choice is much like many of the choices in Fallout 4: it really has no meaning. However, I have started to set up some simple body outlines that (in the near future) will change based on the amount of food and the types of nutrition the player is digesting. Eat only sweets, which contain high amounts of carbohydrates and lipids, and the body will store all that excess energy as fat. Eat a balanced selection of goodies, and you'll be fine.



I've also been thinking about other consequences that I could implement. We all know that you need to get enough of each of a few dozen nutrients, including vitamin A, the 8 B vitamins, vitamin C, etc. But did you know that you can actually go blind due to vitamin A deficiency? Apparently, it is a major cause of blindness for children in several less-well-off nations around the world. Or maybe I could make the player's teeth get cavities if they eat too many sweets, causing them to fall out, and making eating more difficult. There are really a large number of things to try out.

I've also stumbled across some not surprisingly amateurish coding mistakes in how I'm checking the player's score in the stomach level. For some reason, by the time I got around to coding the other levels, I must have had a better idea of what I was doing. In any case, there are something like five separate entities which either duplicate or make unnecessary references to the player's score, which seems to be stored in all of those five places, as well. So I've also been working on refactoring this, basically by creating one object with one script that controls the score, and using delegates (yay!) to allow other scripts to receive notification about changes in the score.

The other upside is that this should reduce the per-frame overhead of many of those scripts, since I was literally checking what the score was every frame (more than 60 times a second) in five places.

I've stopped doing my nightly Let's Plays of Total War: Warhammer, but I have been playing the above mentioned Fallout 4. I hope to post a game analysis of it in the coming weeks. Overall, Bethesda has produced another deeply flawed yet somehow enjoyable open world game.

Thursday, March 30, 2017

More Digestion Game WOrk

hey all,

I'm still hard at work on the digestion game. I've completed several of the improvements that I mentioned in the previous post, but of course there remains months of work, especially since the company promises their clients 10 hours of educational content. I've made some small steps towards reaching that goal, but a lot more design, and art, and of course programming work remains to be done.

In the mean time, please enjoy the video showing my progress in updating the game.



More to come next week.

Thursday, March 23, 2017

Digestion Game Work

hey all,

So for the last week I have been hard at work going back to my game about the human digestive system. I've been mostly trying to fix the problems with the mouth level and small intestine level, such as the performance when lots of nutrients build up in the small intestines, or the complexity of the controls for the mouth, or the fact that food and food pieces seem to be able to go where ever they want to, even inside your tongue or brain sometimes.

The performance issues, in the small intestine level at least, are cleared up, I believe, but I am going to add back some of the features that I cut in order to test which ones were the real problem. For the mouth level, I am thinking of combining the epiglottis and tongue into one controller action, which will make swallowing food much easier. It will, however, remove some of the possibility of choking.

I've also redesigned the positioning of the epiglottis, larynx and esophagus to more closely match human anatomy. This also should reduce some of the possibility of choking, since I think it was a little too easy to choke before.

Part of the feedback I got from the interested company was that the basic levels did not have tutorials of any kind in them, so I am also at work on some flashing messages that will tell the player what the goal for each level is.


Saturday, March 18, 2017

Fallout 4 Machinations

hey all,

I've been playing through Fallout 4 for several weeks now, and overall it is fun. I wanted to share some of my analysis so far, so please check out the video below.


In addition to observations I made in the video, there are level requirements for the abilities, so that a player cannot actually just invest 10 points in Luck, and then unlock the rank 10 Luck ability. Instead, the player might be forced to invest in other abilities until they reach level 40, for example, and then they might be allowed to invest in the rank 10 Luck ability, whatever it may be.

This acts as a kind of gating or even Stopping mechanism, preventing the game from becoming too easy too soon. These restrictions also create opportunities for the player to strategize about which attributes and which abilities to invest in, a form of long-term planning which increases player engagement.

Stay tuned for more analyses.


Thursday, March 16, 2017

Digestion Game

hey all,
Below is a video of the digestion game that I made about a year ago. I've had a Skype meeting with a company that is interested in selling it to schools to use as an educational tool, after it has received a healthy dose of polish, of course.

So, in the next few days I hope to finish up following the node editor tutorial videos, and then take a look under the hood of my digestion game and see if I can make it run smoother, play in a more engaging way, and look nicer.




Thursday, March 9, 2017

GDC

hey all,

GDC 2017 is over, and my oh my, how overwhelming, wonderful, boring, and fascinating it was. I've never been to San Francisco, so just that was pretty interesting for me. I was able to do a little sightseeing the day before GDC started, but after that I was in seminars and meetups almost the whole day every day after that. I have no idea how many people attended this year, but I read that in 2016 about 27,000 people attended, and it would not surprise me to know that around the same number did so this year.

I only went for the Educational pass, which although well worth it for the money, does severely limit what seminars you can attend. So, for the first two days, I participated in the Game Design Workshop, which was focused around working in small groups to design mechanics and themes for games. Really fun to finally work in a group, although I was lucky and most of the time my group was filled with great people from academia, the industry, and amateurs/hobbyists like myself.

The other days were spent running from room to room and building to building to attend the next seminar. In between those, I got to chat with random people and check out the expo, which featured games being developed by teams all around the world.

That's all for now, but expect more news soon.