AI: Part 1 (Education, Jobs, Moving, Retirement, Death)
Plan
As mentioned in a previous post, there are 3 stages to the game:
- Setup
- AI
- Player Interaction
Aging
The game is turn based, with each turn being a year in game. This is similar to other life simulations, such as Real Lives and BitLife. I thought this would be an appropriate turn length, as both a month and season seemed to frequent.
1 year per turn is also easier to implement, as everyone is aging on the same turn.
Implementing aging was simple, as it only requires looping through each peep and adding 1 to their age attribute.
Health
A baby peep is born with 100 health. This value decreases every turn, depending on health conditions. When a peep's health hits 0, they die. Consequently, decreasing health every turn was simple to add.
AI Interaction
Now that the prerequisite variables have been adjusted, the peeps can interact with one another. If the peeps did not perform actions, then the game would be far more dull and the world would feel empty. This makes way for the implementation of the "story progression" part of the game.
Story progression is the idea from The Sims 3, where neighbours would age, get married, have children, work on their career, grow old and die. It makes the town feel alive and balanced. You can think of this like free will, or peep autonomy. This also helps with the balance of the game, as peeps are constantly moving around and growing old, being replaced by their children and subsequent grandchildren.
Introduction
Peeps are often hard working creatures, desiring the best career and life they can afford. Some peeps are more careless, wasting their hard earned money and becoming the town fool.
Education
A good life starts with a good education. In Pocket Life, this is split into 2 parts: school and university, the former being compulsory; latter optional. After some back and forth, I finally settled on creating an array called "aiEducation", which would be separate from the player's education. This allows for a simplistic "tree" for the AI to climb, making coding simpler.
Array for AI education (aiEducation) |
Essentially, each year each peep checks their age against the value in y5. If they reach this age, they move to the next educational facility.
University is similar, with the difference being that it is optional. Every peep in the game has an aspiration, this comes with a "subject of interest". This is the subject that a peep will choose to study in university.
You'll also notice that there is no middle, elementary school or master's degree. This is to reduce complexity and also make the game more internationally relatable.
Jobs
Once a peep has completed their formal education, they can get a job. A peep will choose either to be a stay at home parent or go to work. The former choice is only available to married peeps. Different careers have different levels of progression. Some jobs have no progression and are called "dead end careers".
A peep will choose a job that they are interested in and then move up the career ladder if they are qualified.
A hard-working or ambitious peep will move up the ladder faster than others.
At the moment in time, very few jobs have been implemented, but the algorithm will work for careers added in the future.
Moving
A peep will earn money from work, which will enable them to move out. The more money a household earns, the nicer dwelling they can afford.
Some houses will cost more than others, and will be tiered depending on price (inexpensive, average, expensive).
Retirement
When peeps get too old, they may decide to retire. They will earn no more income but assume a pension instead. Their career changes from the name of the career to retired name of career. For example, a "Manager's Aide" when retired, will become a "Retired Manager's Aide".
Death
As perhaps as depressing as it is, even in Pocket Life, peeps eventually die. This can be from old age, an illness, or a sudden circumstance.
A peep who dies from a terminal illness will often die younger, and their cause of death will be that specific illness.
Sudden death can also occur, such as dying from a car crash. Neither illnesses nor sudden death have been implemented yet.
When a family member dies, the peeps in the family will become upset, and perhaps even depressed. Detached peeps are more likely not to care or be affected.
Overall
In conclusion, many of these features have been implemented thus far. Some more advanced features are still in the pipeline. Now that the peeps have financial autonomy, they now need familial autonomy.
Comments
Post a Comment