This study delves into using AI in the narrative design of a 2D RPG centered on fortune-telling. The game stands out for departing from traditional narrative methods, employing AI to craft evolving storylines based on player choices. This integration offers an immersive and exploratory experience, granting players greater autonomy in shaping the game’s outcome. However, ethical concerns arise regarding the influence on player behavior and decision-making. The research explores a design approach for implementing AI-generated content in video games through practice-based research.
AIGC
Dialogue System (User Generated)
Historically-based fictional narratives in video games
Explore a Design Approach of AI-generated Content for Video Games
You are a psychic! Engage with your client to discover their stories and needs.
Choose a proper tool to divine their future.
Analyze the results with your instruction.
Craft a reply for your client.
Your client will write a mail back (AI generated based on your suggestion) to tell you where the story goes.
Note: The Vertical Slice is a complete cross-section of the final game and its purpose is to convince stakeholders, such as publishers and investors, to continue funding the game’s development.
“Write a mail back to the psychic with an unexpected ①extremely bad ending to the following story in realism ②in the perspective of Mila (7-year-old little girl): ③Mila is a little girl who one day can’t find her favourite doll. The doll was left to her by her brother, who died in the war, and was actually washed by her mother and hung up on the balcony to dry. She searched everywhere but to no avail, and finally undertook a divination. ④The divination suggested that she could go to the nearby river to look for it. What would be the outcome for her?”
public void SendData(string question)
{
StartCoroutine (GetPostData (question,CallBack));
}
private IEnumerator GetPostData(string _postWord,System.Action<string> _callback)
{
var request = new UnityWebRequest (m_ApiUrl, "POST");
PostData _postData = new PostData
{
model = m_PostDataSetting.model,
prompt = _postWord,
max_tokens = m_PostDataSetting.max_tokens,
temperature=m_PostDataSetting.temperature,
top_p=m_PostDataSetting.top_p,
frequency_penalty=m_PostDataSetting.frequency_penalty,
presence_penalty=m_PostDataSetting.presence_penalty,
stop=m_PostDataSetting.stop
};
string _jsonText = JsonUtility.ToJson (_postData);
byte[] data = System.Text.Encoding.UTF8.GetBytes (_jsonText);
request.uploadHandler = (UploadHandler)new UploadHandlerRaw (data);
request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer ();
request.SetRequestHeader ("Content-Type","application/json");
request.SetRequestHeader("Authorization",string.Format("Bearer {0}",m_OpenAI_Key));
yield return request.SendWebRequest ();
if (request.responseCode == 200) {
string _msg = request.downloadHandler.text;
TextCallback _textback = JsonUtility.FromJson<TextCallback> (_msg);
if (_textback!=null && _textback.choices.Count > 0) {
_callback(_textback.choices [0].text);
}
}
}
}
[System.Serializable]public class TextCallback{
public string id;
public string created;
public string model;
public List<TextSample> choices;
[System.Serializable]public class TextSample{
public string text;
public string index;
public string finish_reason;
}
}
Factors | Examples | ||||||
---|---|---|---|---|---|---|---|
Story background | “Mila is a little girl who one day can’t find her favourite doll. The doll was left to her by her brother, who died in the war, and was actually washed by her mother and hung up on the balcony to dry.” | “Radoslav is a retired soldier. Although he wanted very much to return to the army, he was unable to return to combat because of his physical disability. He is currently working as a bodyguard for a private investigator, but he thinks his life is too meaningless.” | |||||
Narrative tone | From Mila’s perspective | From the perspective of Mila’s mom | From a journalist’s point of view | ||||
Parameterization | Good ending | Bad ending | Realism | Fantasism | apathetic | emotional | unconventional |
Name | Code |
PalmistryManeger.cs |
|
Name | Code |
Weights |
|
Weights Manager | public class WeightsManager : MonoBehaviour
|
Name | Code |
IncenseManager.cs |
|
Name | Code |
DreamManager.cs |
|
– Props & UI
Documented the entire research and development process of this project.