DevJournal: Developing A Life Sim Game Using Unity and Playmaker #1

Ricky Setiawan
4 min readAug 15, 2021

--

The Goal

I am learning C# and Unity for some time and currently looking for a way to build a quick prototype. I imagine it’s like Sketchup to 3dsMax in architecture. Although it’s not as good as I expected, I found Playmaker as the most exciting option.

What is Playmaker?

It’s a finite-state machine (FSM) package for unity that enable developers to create games using a flowchart-like system. FSM itself is one of many development design patterns available to be used.

Rather replacing Unity’s traditional scripting method, Playmaker is used as a complement. It enables fast prototyping and rapid MVP development.

Links:

The Game: Homeless?

I want to make is a simple life sim game where players can make choices and try to become rich. It’s a UI-based system and has no player controller. The benchmark for this game is Homeless?. I choose “Wibu Bawank” as the title.

Homeless? Page Structure

The main page of Homeless? provides basic information about the character.

  • Age: the age of the character, all decisions cost 1 day
  • Cash: money resources for the player, can be generated by doing jobs
  • Lodging: can be rent or bought to be able to get a better job
  • Transport: can be bought as a prerequisite to get a better job
  • Education: can be upgraded, also to get a better job

There are also two main stats that needs to be balanced, which are Hunger and Health.

Players can swipe the game and find the second page. Within the page, players can find ways to generate money. Almost all jobs require some kind of ownership, training, or education; except for the first jobs.

There is almost no difference between the regular “jobs” and the “criminal jobs” except the second one provides better income. Central bank provides income through a 100% interest paid every 30 days.

The third page is the shop page, where players can buy items to fulfil job requirements.

The last page is the skill page. Same as shop page, educations and skills are required to get a better job.

Homeless? Core Loop

The core loop of Homeless? is:

Core Loop of Homeless?

What can be improved from homeless?

Apart from its minimalist graphic, there is no randomness in Homeless? and virtually no challenges. The game can be completed easily in less than 30 mins.

Day 1: Creating Game Manager and Buttons

Basic Variables

Basic Layout of Wibu Bawank

The first task is to set main variables and create a game manager inside Unity.

The main variables are:

  • Food: between 0–100. Game will over if it’s lower than 0.
  • Health: between 0–100. Game will over if it’s lower than 0.
  • Money: between 0–unlimited. Game will over if it’s lower than 0.
  • Day: incremented for every action taken by the players

Variables are all set into global variables for easier setup.

The Game Manager

An empty object is created to be the game manager. The “playmaker FSM” component is added to the object and states are defined.

PlayMakerFSM component in the game manager

The main function of the GameManager object is to update UI by connecting text object to the global variables. One Event is defined (the Update UI event). A global event with the same name (Update UI) is also defined.

The global variables are defined in the Variables tab on FSM’s Edit mode.

The global variables

Continue To Part 2

In the next part, I will create buttons to firing up data to the UI.

--

--