Replay Virtual Opponent (Implementation)


How can I use prerecorded data (locally stored) to create a virtual opponent for people to play against??

One of the most important tasks to start of with this internship is to create a virtual opponent. My fellow graduate Jasper created a way to save playthroughs and store them locally. It is my job to implement these playthroughs in the game for people to play against them.


Research Methods


Field

  • Document analysis

In the previous devlog entry Replay Virtual Opponent (Concepting), I talked about how I created a document to help me give myself an idea of how the feature would have to be implemented in Unity. This was obviously the first thing I did so I could follow my own guidelines correctly.


Workshop

  • Prototyping
I can first get all the replay profiles with the chosen Diabetes type with the LoadReplayProfiles() method. I then pick a random replay profile out of this list and that will be the virtual opponent. This is done in the AddOpponent() method. This is also the place where the LoadReplayProfiles() method is called.

As seen below, the data gets saved using a list of turns which is created by another intern[1]. Every turn I can fetch this data to be able to automatically make the opponent:

  • Throw dice
  • Move pawn
  • Enter bag to do stuff (eat, walk, drink, etc.)

It will show all these actions to the player so they know what happened.

Making this feature as intended consisted of quite some steps to be able to fully implement it. One of the reasons it was hard to integrate was because code was the exact opposite of SOLID. After realizing it had to change, I decided to work together with another intern to clean up the entire project. My part of this cleanup can be found in the entry: Project Rework.

After making the project a lot clearer for myself, I was able to fix the bugs to make the virtual opponent work exactly as intended


Results & Validation

The end result (excluding some minor bugs that I fixed afterwards) is clearly visible in the form of a video I created for the stakeholders to have a clear idea of how the virtual opponent works. This video can be found on the page: Virtual Opponent.

I got positive feedback on this. Harm really liked the fact that the player got well notified of the virtual opponent actions and in general Harm and Pieter felt like this was what they meant.


Usage

The virtual opponent is used for people to play against to learn from either their own playthroughs or to learn from others how they manage their diabetes. The player can easily select which playthrough they want to play against.


Sources 

Daan van Eijl | Fontys Graduation Internship | Spring 2022
Mogelijk gemaakt door Webnode Cookies
Maak een gratis website. Deze website werd gemaakt met Webnode. Maak jouw eigen website vandaag nog gratis! Begin