Devlogs
Log #6: Coding the patients
One of the main coding challenges when making this game is patient generation. Except for getting a random face, there are a number of parameters to each person. The main structure is as follows:
- The first step is the creation of a healthy person. They get a face, a first and last name, age and gender. Based on age and gender, stats are generated: Pulse, blood pressure, body temperature. These are generated randomly from a standard interval. They also get assigned a disease to be infected with.
- The disease has a number of guaranteed symptoms that the patient always receives, as well as some symptoms that have a certain probability to be applied. Symptoms can be generic, such as raised blood pressure or pulse, or unique for that disease, such as a craving for rodents or insomnia during a full moon.
- Then, the patient is infected with the disease: Any guaranteed symptoms are added right away, and the other symptoms are checked against a random number to see if the patient gets them.
- The received symptoms influence the stats of the patients: Blood pressure, pulse and temperature is raised or lowered accordingly.
- The patient's charts are generated, either as a string of text that will be displayed after an examination, or as an image, such as an X-ray image.
The last step, generating the charts, is not the most efficient as some charts will never be shown, but I would rather generate it beforehand so that it doesn't affect the gameplay when the timer is counting down.