Carioca

Game Description

Carioca is a first person RPG which simulates a dangerous Brazilian favela where players can choose the course of actions which suits their self-imposed goals. The game tries to generate an emergent narrative by embedding narrative cues in the environment as well as presenting a tactile gameworld. Via their interaction with the game and its characters, the players can change the meaning of life in the favela - for better or worse.

NPCs as well as players are able to perform certain set of basic actions that can be associated to life in a favela - eat, sleep or recreate. These actions can be performed only in specific spaces like food places (eat), bars (recreation), legal working spaces (legal work), houses (sleep) and garbage heaps (scavenging).

All characters in the game (including the player) are controlled by statistical values that define their needs. For example, a character’s hunger value increases over time making it hungry enough to warrant eating twice a day. In order to satisfy these needs, characters can simply step into a certain kind of space. A hungry bot would eat food by stepping into a food area. According to the type of NPC (civilian, druggie or gangster), they can beat, mug, kill, buy/sell drugs, have legitimate jobs or scavenge among garbage. The action to be performed by NPC is decided by prioritizing its various needs and picking the most important action at that moment.

These actions can be categorized into legal actions (i.e. working in legal places), violent actions (i.e. beatings, killings) or drug related actions (i.e. drug trafficking). The player himself has the possibility to perform any of these actions. These categories are used in order to formulate a visual feedback schema for the game environment. If violent events or drug related acts take place in the game then the environment changes and portrays which category’s actions are performed. If the game world is prosperous (earnings from legal spaces) and the violence/drug-dealing events are at low levels then the environment remains intact and nice looking.

An important element of the game is that NPCs rate their relationships with every other character in the game - including the player. Having good relationships with NPCs can unlock dialogue options and features for the player, while having a bad relationship can result in them not talking to the player at all. Players interact with NPCs through a dialogue system, that has consequences on the player’s and NPC’s stats. For example, the player can talk to a gangster and choose to threaten him, steal money and beat him (repeatedly till death) - all through the dialogue system. The dialogue data is retrieved from a SQLite database depending on the bot type and player stats.

The game simulation is setup in such a way that the gameworld will start spiralling into a violent state. It is left up to the player to choose whether he wants to accelerate that process by taking part in the violence and make money, or try to help the situation and save civilians by donating money to the church. The game however, does not compel the player to do either; he can decide to simply stand around and look at the favela go up in flames (metaphorically speaking).

Programming Challenges

While the Unreal Engine provides loads of functionality for the programmers, some of its foundation features are not accessible in the free version (UDK). At times this lack of access hampers developers in understanding the optimal workflow process and loopholes that need to be avoided. One such problem I faced was regarding the use of Navigation Meshes. In the best case scenario, the navigation mesh would work in case of controlling one AI bot. However, when more bots were introduced, the procedure would end up returning an error state for the navigation method. This is an outstanding error and a migration to waypoint based navigation method might come up with better results.

Another big challenge was the use of Scaleform based bot action symbols. Since our development team was highly restricted in its animation skills, some method had to be devised to illustrate the bot’s actions to the player. The solution was to render SWF (Flash) texture on a dynamically spawned static actor over the bot’s head.

Features

  • Game data stored in SQLite database
  • Dynamic bot spawning based on number of entities in the game database
  • Three different Bot classes - Civilian, Druggie, Gangster
  • Six action spaces - Home, Restaurant, Work, Garbage Pile, Bar, Drug Selling Area
  • Navigation Mesh based bot pathfinding
  • Prioritized bot actions executed using UnrealScript states
  • Custom “District” volumes to collect gameplay stats
  • SQLite Gameplay logger
  • Custom HUD (using Scaleform)
  • Scaleform based dialogue screen
  • Scaleform based bot action placard
  • Church building where player can donate money to reform a criminal bot

Publications

  • Prakash Prasad, Orestis Tsafarakis, Søren E. Andersen. Carioca - The Game. ACE 2011 - Game Competition. November 2011, Lisbon.

Video

Screenshots

Code Sample

Bots populating each game level are stored in the SQLite database. These are loaded on game start and placed at their appropriate home space, as directed by the database entry. Here is the function from unreal's gametype class, which activates each bot by looking it up in the database.

function ActivateBots(int aPreFabNumber)
{
    local int id, isalive;
    local string lName, lType, lSex, lHome, lDrugHome;
    local ENPCType eType;
    local float lHealth, lMoney, lFatigue, lDrugDosesTaken, lMenace, lHunger;
    local name lstate;
    local Vector loc, dbloc;

    if( NumBots==0 )
    {
        mDatabase.ClearRowsHistory();
        while(mDatabase.GetNextCharacterInfo(id, lName, lType, lSex, lHealth, lMoney, lFatigue, lDrugDosesTaken, lMenace, lHunger, lHome, lDrugHome, dbloc, isalive, lstate))
        {
            if( dbloc.X==-1 && dbloc.Y==-1 && dbloc.Z==-1 )
                loc = GetHomeVectorLocation( name(lHome) );
            else
                loc = dbloc;

            eType = NPCTYPE_All;

            if( loc.X!=0 && loc.Y!=0 && loc.Z!=0 )
            {
                switch( Caps(lType) )
                {
                    case "CIVILIAN":
                        eType = NPCTYPE_Civilian;
                        break;
                    case "DRUGGIE":
                        eType = NPCTYPE_Druggie;
                        break;
                    case "POLICE":
                        eType = NPCTYPE_Police;
                        break;
                    case "GANGSTER":
                        eType = NPCTYPE_Gangster;
                        break;
                    case "KINGPIN":
                        eType = NPCTYPE_Kingpin;
                        break;
                }
                if( eType!=NPCTYPE_All )
                    if( isalive==1 )
                        WakeupCarioca( id, lName, eType, lSex, lHealth, lMoney, lFatigue, lDrugDosesTaken, lMenace, lHunger, loc, name(lHome), name(lDrugHome), lstate);
            }
        }
    }
}

Download

Click here to dowload the playable version of the game

Installation Instructions:

  • Run the downloaded file.
  • Follow the onscreen instructions and finish the install process.
  • Run "C:\UDK\UDK Carioca\Binaries\Windows\UE3Redist.exe".
  • Run the file "C:\UDK\UDK Carioca\Carioca Masters Thesis Game" to play the game.
  • If prompted by EULA agreement, click yes to proceed.
  • Once the game has started, you'll see the main menu with 2 button. Both will say "Start Game", but the 1st one is to start the game, whereas the 2nd button is to quit the game.
  • Enjoy the game!

Click here to dowload the ACE 2011 paper submitted about the game's narrative model