In survival games, coding is used to create and manage the game's systems, mechanics and variables. This can include anything from the AI to the inventory system. Coding in a survival game can be very complex, as there are often many different systems that need to interact with each other. For example, the player's health needs to be tracked, as well as their hunger and thirst levels. The environment also needs to be coded, so that it can generate resources that the player can collect.