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:

  1. 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.
  2. 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.
  3. 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.
  4. The received symptoms influence the stats of the patients: Blood pressure, pulse and temperature is raised or lowered accordingly.
  5. 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.

Leave a comment

Log in with itch.io to leave a comment.