Character Trait Model: How Unhappy Is Unhappy

Modelling character traits can be tricky: an example problem has been presented by Jon Ingold in this GDC talk. I discuss the problem below and present a sample model that solves it. I provide an implementation in a C# class.

For character trait one may think of say the character happiness, or a relationship-with-X trait.

The problem is presented from minute 36 of the talk: the first idea that comes to mind in modelling a character trait is by using a number. Greater the number, better the state of the trait. This doesn’t work very well.

How Unhappy is Unhappy

From Jon Ingold GDC talk.

Then Ingold quickly jumps to a proposed solution, which consists in tracking two numbers, positive and negative experiences:

Unhappy vector

From Jon Ingold GDC talk.

Apart from the fact that changes are modelled more appropriately using two variables, what was exactly the problem with using one number?

Here is how I understood the problem: suppose you want to model the happiness of a character in a gameplay. You say that the variable HappinessLevel determines HappinessState according to these values:

HappinessLevel >= 5 = VERY_HAPPY
0 < HappinessLevel < 5 = HAPPY
-5 < HappinessLevel <= 0 = SAD
HappinessLevel <= -5 = SUICIDAL

The character goes through many episodes in two different game-plays: in one the character has 2 positive episodes, and 8 negative ones, and so goes SUICIDAL: 80% of the episodes were negative.

In another gameplay, the character has 20 positive episodes and 25 negative ones. Character is still SUICIDAL, but actually only  55% of episodes were negative! Something clearly does not work :-(

Taking the hint from the talk above, I’ve implemented a generic class model for Character Trait that considers the whole set of the episodes. The set of states and their level can be injected; moreover you can have a “decay %” so that for each new episode, all previous ones have a decay, so older the episode less relevant it gets :-) (by default decay is 1 so its turned off).

You find the class and a test (for Unity) in this zip. It can clearly be refined ad infinitum in function of specific needs, e.g. having episodes that are both positive and negative and so on.

A couple tests:

First test no decay test 1 output
Second test with decay Log with decay

Thanks to Daniele Giardini for campaigning for LINQ removal from the code.

Follow me on Twitter where I post about game design, game development, Unity3d 2D, HTML5, applied / serious games.

Social Share Toolbar

Applied And Persuasive Applications For Museums

I recently gave a workshop and talk at the Museum Digital Transformation conference.Thank you for all who came, it was great fun. [Read more…]

Social Share Toolbar

A visualization of Liz England’s The Door Problem

An attempt at visualizing Liz England’s useful operational explanation of what a game designer does: The Door Problem.

 

Social Share Toolbar

Learning With Games: Fail And Retry, Not Simulations

A short post on Gamasutra on the topic of learning with games and fail-and-retry.

Social Share Toolbar

A post on Gamasutra: In-between Spaces And Their Design

I wrote a longish post on Gamasutra which they were so kind to feature on focusing attention on designing in-between spaces in games. See it here.

Social Share Toolbar

Games loved in 2016

These are the games I recall playing for the first time in 2016 that I really liked. I often discussed them with Daniele Giardini, whose list also follows. The games are not in order of preference after the first two.

We both give the first prize to Firewatch. We both were greatly disappointed by VA-11 HALL-A.

One Night Stand

My loved ones:

  • One Night Stand
  • Reigns
  • Clash Royale
  • Archon
  • Quadriga
  • Soccer Physics
  • The Sea Will Claim Everything
  • Her Story

Soma

Daniele’s:

  • SOMA
  • Shenzen I/O
  • Necropolis
  • DOOM
  • Invisible INC
  • XCOM 2
  • Oxenfree
  • Ori And The Blind Forest
  • Her Story
  • Grim Dawn

Cheers!

Social Share Toolbar

A game for learning about cancer therapy: help us crowdfund it!

 

I have been recently working in defining a new applied game with the association Noi Per Voi, called Feel Better: the game will support kids and young adults in cancer therapy at the kids hospital Meyer in Florence.

It will be a tool used by the kids to learn more about their context and how to deal with it; it will be co-designed by medical therapy specialists and also by the kids themselves.

There is an open crowdfunding campaign for this tool here:

https://www.eppela.com/en/projects/10856-feel-better

The campaign goal is 20.000 Euro, but it will reach its basic goal at 10.000 Euro funding (we are not far) as then the pledges will be doubled by a local foundation (Fondazione Cassa di Risparmio di Firenze). Going beyond the basic goal will allow us building an application that could be used in a wider spectrum of situations.

Any help in pledging and / or sharing the news about our initiative would be great.

Thank you,

Pietro Polsinelli

Italian version

Recentemente ho lavorato al design di un nuovo gioco applicato con l’associazione Noi Per Voi: il gioco si chiama Feel Better ed è per bambini e giovani adulti malati di cancro in terapia presso l’ospedale Meyer di Firenze.

Sarà uno strumento utilizzato dai bambini per apprendere sul loro contesto e come gestirlo; sarà disegnato collaborativamente da medici, psicologi e dai bambini stessi.E’ ora attiva una campagna di crowdfunding per questo strumento:

https://www.eppela.com/it/projects/10856-feel-better

L’obiettivo della campagna è di 20.000 Euro, ma l’obiettivo sarà raggiunto a 10.000 Euro dato che l’importo sarà raddoppiato dalla Fondazione Cassa di Risparmio di Firenze.

Andare oltre l’obiettivo base ci permetterà di costruire una applicazione che possa essere usata in uno spettro più ampio di situazioni.

Dateci un aiuto economico e / o nel condividere la campagna! Grazie.

Pietro Polsinelli

 

 

Social Share Toolbar

Towards my book “Explaining With games”

I am working on a book on applied games: “Explaining With Games”.
It will be a handbook, focused on the analysis of the applied games I have worked on in the last five years.

For information about the projects I worked on, here is a page dedicated to my projects and my profile.

Some images from the games I will examine:

This is how my draft of a book begins at the moment:

Games can be designed to teach and facilitate learning processes. In this book I present several real world cases where games have been applied as teaching tools, and through those cases I introduce concepts of game design used in applied games.

This book on applied games is a bit unique because it is mostly focused on teaching you on how to contribute creating such games.

The focus of this book is on how to create interactive experiences that facilitate learning. How can people with different skills contribute? How can the field experts and the game developers somehow work together?

It is easy to get lost in the field of game design and development: here I try to keep the focus on the projects I worked on as real world examples that should help in keeping things manageable.

Some of the questions that I try to (partially) answer along the way are:

How to use games to approach complexity and learning?

How can games be used for learning and teaching?

And why should one use games for that?

Any examples? What is the state of the art?

What is required for creating a game? Which expertise, tools?

How is the process managed? How are results measured?

How can I learn more beyond this book?

The book will be progressively released on LeanPub, which is a wonderful platform for collecting early feedback on the writing process.

 

 

 

 

Social Share Toolbar

Is Unity WebGL loading? A simple loader

F = (When you publish your Unity application or prototype in WebGL a problem that your testers or players may have is that while the browser is loading the application, no progress bar appears and so they may be tempted to reload the page again and so… F() ).

A simple fix to reassure them is to paste this script at the bottom of the index.html file that Unity produces at build:

<script>
  /**
   * Created by
   * Matteo Bicocchi @pupunzi
   * Pietro Polsinelli @ppolsinelli
   * Follow us as we are creating a game on #football 
   * with a story: "Football Voodoom" :-)
   * */

  var appName = "<b>" + Module.codeUrl.replace("Release/", "").replace(".js","") + "</b> ";
  var canvas = document.getElementsByTagName("canvas")[0];
  var canvasRect = canvas.getBoundingClientRect();

  var loader = document.createElement("div");
  loader.id = "loader";

  var loaderWidth = canvas.offsetWidth;
  var loaderHeight = canvas.offsetHeight;

  document.body.appendChild(loader);

  loader.style.position = "absolute";

  loader.style.top = 0;
  loader.style.bottom = 0;
  loader.style.left = 0;
  loader.style.right = 0;
  loader.style.margin = "auto";
  loader.style.width = loaderWidth + "px";
  loader.style.height = loaderHeight + "px";
  loader.style.background = "transparent";
  loader.style.color = "#fff";
  loader.style.opacity = 0.8;
  loader.style.fontSize = "16px";
  loader.style.letterSpacing = "3px";
  loader.style.fontWeight = "100";
  loader.style.textAlign = "left";
  loader.style.padding =  "30px";
  loader.style.boxSizing = "border-box";

  var dotCount = 0;
  var checkDisplay = setInterval(function(){

    if(Module.progress.progress > 0) {
      loader.style.display="none";
      clearInterval(checkDisplay);
    } else {

      loader.innerHTML = "Loading " + appName;

      for (var x = 0; x<dotCount; x++){
        loader.innerHTML+= ".";
      }
      
      dotCount = dotCount >= 40 ? 0 : ++dotCount;
    }
  },100)
</script>

This will show immediately “Loading…” and will animate it until the app loader appears. See it here:

Unity WebGL custom loader

Cool no? The JavaScript is really basic and should work wherever WebGL does.

 

 

 

Social Share Toolbar

Tips For The Pragmatic Unity Developer

In the video below I’ve presented several productivity tips / hacks for the great Unity3d developer, that cultivates his / her essential qualities (impatience laziness hubris):

 

Sources & References

The three most essential plugins are DOTween, Text Mesh Pro and Console Pro.

Jet Brains IDE for C# preview here.

The “auto-save on play” script is here, The “no more hot reload script” is here, both by the same cool guy.

The scene object enable and disable script is this:

public class TheScene : MonoBehaviour
    {
        public GameObject[] activateOnStartup, deactivateOnStartup;
        
        void Start()
        {
            foreach (GameObject go in activateOnStartup)
            {
                go.SetActive(true);
                if (go.GetComponent<CanvasGroup>() != null)
                    go.GetComponent<CanvasGroup>().alpha = 1;
            }
            foreach (GameObject go in deactivateOnStartup)
            {
                go.SetActive(false);
                if (go.GetComponent<CanvasGroup>() != null)
                    go.GetComponent<CanvasGroup>().alpha = 0;
            }
        }
    }

Follow me on Twitter where I post about game design, game development, Unity3d 2D, HTML5, applied / serious games.

Social Share Toolbar