Go directly to:


Casino Inc is a project I did for my graduation on IGAD.
It is a top-down management simulation game, where the player builds his own casino.


Data:

  • Platform
    • PC
  • Genre
    • Management
    • Simulation
  • Time
    • January 2019 - June 2019
  • Team
    • just myself
  • Engine
    • Unreal


General

Casino Inc is a project I worked on for 6 months as graduation project for IGAD.

It is a Game where you build and manage your own casino.
The player starts from almost nothing, and has to build up their own casino to a place where they are making as much money as they can.

This project has been heavily inspired by games as Prison Architect, Another Brick In The Mall, and Academia: School Simulator.
Each of these games are top-down tile based management simulations of their respective theme's.

A 30 minute powerpoint presentation (with voice over) that I used for the defence can be downloaded using the following links: powerpoint, script

Additionally, the full source can be found on github using this link.
And the latest builds can be found here.

Project Goals

The goals I've set myself for this project where to make a playable game, and get experience with more advanced AI systems.
Both of these goals where to add a new piece of work to my portfolio, and to give me more programming experience.
For the AI systems I wanted to use a Goal Orientated Action Planner (GOAP) as I've not used that before, and it's often used in games I like to play.

Preview

Specifications

The specifications for the game I made are the following:

Planning

With this size a project, I needed to plan a lot. I did this by deviding the project in the following 10 milestones: Milestones

  1. 2D tile map
  2. Basic player interaction
  3. Pathfinding
  4. AI task manager
  5. GOAP planner
  6. Casino management
  7. Builders
  8. Poker, Blackjack, and Slot Machines
  9. Guests
  10. Dealers

Each of these milestones where planned to be between 1 and 3 weeks of work, and to be in such a order that they would build on one another.
Expansion on the planning has been done using the scrum boards of HackNPlan.
Using the planning tools given by HackNPlan I scheduled all different milestones and smaller tasks within these milestones.

Tilemap

2D tilemap

The tilemap is the part of the game that shows everything, as the name implies it’s a map made of a grid of tiles.
I’ve used this as this is the style that the preview games use to, and it’s a staple of a lot of different other management games.
For this I use a combination of Unreals build in tilemap, and my own made tilemap.
This combination is made because the unreal tilemap is purely cosmetic, so only draws the tiles, but for this game I need separate behaviours for different type of tiles.
The system I made myself to give different tiles different behaviours consists of a list of actors with the bare minimum, which have all information about what type of tile it is, and some shared info like if its walkable and which sprite to use for it. With added on top of this are actor components for the tiles that need additional behavior.

Pathfinding

For Pathfinding of the characters walking around I've implemented a A* algorithm, which is a widely used best-first search.
The combination between this algorithm and the tilemap was straight forward, and it uses the tiles as nodes.
To make it that the game still has a normal fps, I needed to make this pathfinding multi-threaded which is not the most easy thing to do in unreal engine.
The biggest problem for this is that there's barely any documentation on this, and the biggest sources are outdated and incorrect.
As a thread safe way of returning the found paths to the main thread, I first got to the Delegate's that unreal has build in, that according to multiple sources are thread safe, but ended up not being safe.
Instead of this I needed to use a TQueue, which is a queue that is thread safe, as long as you only take out of it from the main thread, but you're still allowed to put things onto it from any sub thread you want.
Source code for the pathfinding can be found at this link.

TaskManager

AI Task Manager

To keep track of which tasks the player gives to the AI’s, there’s also the need of a AI Task Manager.
This consists of a actor with as main function 2 hybrid First in first out queue’s, with the addition that it will take the first task allowed for the AI in question, so not always the very first task.
Example of this is when there’s a queue of building 2 walls, cleaning trash, building another wall, and working at a poker table.
The returned task for a dealer will be the work at a table task and not the build wall task, because he can’t do any of the others.
Another thing that I wanted to have added to the task queue is a way to take tasks to the front of the queue to prioritize them, this was done by simply adding a 2nd queue which will be worked in a similar way, but always checked before the normal queue.

GOAP

For the AI decision making I wanted to use a system I’ve not used before, which is a Goal Oriented Action Planner, or GOAP for short.
GOAP is a system where the AI plans a set of actions that will take it from its current state till a specified goal state.
For example, a builder wanting to build a wall would need building tools, and building materials.
An AI using GOAP will then be able to think out itself that it needs to pickup these tools from a tool storage, and materials from a storage room before it can go to the build location.
But if the AI already has tools, it creates a plan of action with only getting materials before going to the build task.
For this action planning I’ve used an algorithm very close to A star pathfinding, but instead of location nodes, it’s using the actions as nodes.
The start and end of the path are the states that the AI needs/has, and using the difference between this as heuristics you can create a path from action to action between the goal and start.

Staff

The staff is currently made up of builders and dealers, but written in such a way that its easily expandable to include other jobs like janitors, guards, or waiters.
They do their respective tasks using the before explained manager and GOAP systems.
The player has to hire each person in staff, and is in full control to give them different working times and lenghts.

Guests using Utility Theory

The main element to make the game a simulation, The guests walk around the casino playing different games that make the player money.
They're setup with a Utility Theory setup to decide on what they want to do. The way this is setup is that each type of interactable has their own score, with a calculation based on the current stats of the guest to influence this score further.
When each score is calculated, the results are used as a weighted chance for what the guest is actually going to do.
This way, the behaviour of the guests is expandable, but keeps being very light weighted, and won't impact the games performace much.

Results

This all has come together in a small game I’ve been calling Casino Inc.
I am very happy with how it all ended up working and looking, and think I’ve made a very fun little game. Which also works very well.
The player is able to fully build and run their own casino, and watch the guests go around it playing the games.
This also gives a good basis which can still be expanded massively, for example with the guests needing food and drinks, more games, and more types of AIs such as janitors to keep everything clean.
All with all, I am very proud of what I’ve managed to do in the alloted time, and how it all went without very big disappointments.

A 30 minute powerpoint presentation (with voice over) that I used for the defence can be downloaded using the following links: powerpoint, script

Additionally, the full source can be found on github using this link.
And the latest builds can be found here.