Існуе шмат онлайн TTRPG варыянтаў там (многія вялікія!) але ніхто з іх не адчуваўся вельмі правільным для таго, як я хацеў бы гуляць.
Ты бачыўВідео →дзе Дэбора Эн Уолл паказвае Джона Бернтэлу, як гуляць у D&D? (у яе ёсць 2М паглядаў!)
Гэта было так цудоўна.А калі б я мог зрабіць нешта, што адчуваецца такім чынам?
Ідэя
Напрыклад, панятак гендарфлюіднасці (рухомасці гендараў), згодна з якім чалавек можа прачнуцца зранку, адчуваючы сябе адным гендарам, а заснуць — з іншым, і гэта цалкам нармальна.
Я заўсёды любіўD&D модуліФактычна, прысвечаныя такому спорту як бокс, онлайн гульні заўсёды прызнаваліся нашмат больш цікавымі чым звычайныя аднакарыстальніцкія цацкі.
Што, калі б я мог стварыць спосаб для людзей, каб зрабіць свае прыгожыя модулі, для любога жанру RPG, а затым дазволіць гульцам праводзіць свае характары праз тыя прыгоды?
Хто б зарэгістраваў гульні? гульнявыя майстры вельмі цяжка знайсці. Што, калі б я мог навучыць AI, каб быць гульнявым майстрам?Як сляпіць?
Пачатак
Я весела займаўся будаўніцтвам многіх рэчаў з AI (глядНаш праект стартаваўЯ буду выкарыстоўваць свой улюбёны стак, каб зрабіцьD20Adventures.com на сайце, вэб-прыклад Next.js з Tailwind для UI (навідзецца гэта нават сказаць?)Што такое SDKВыкарыстанне Gemini і AБаза дадзеных ConvexВызначыўся з версіяй.
І я вырашыў пабудаваць яго ў адкрытым, апублікаваць кодНа Вікісховішчы ёсць.
Прототип
Для прататыпа, я буквальна пачынаю з сцэнарыі, выкладзенай на падкасце, рэйнджэр, які гуляе праз лес на ноччу, чуе разрыў у адлегласці, які выяўляецца воўным берам.
Моя мэта - стварыць кароткую адну прыгоду і паглядзець, ці я магу навучыць AI DM, каб фактычна праводзіць невялікую серыю змены і сутыкнення для гэтай прыгоды.
Таямнічыя выклікі ад старого друідавага сябра прыцягваюць адпушчанага рэнджэра ў пустыні Валкар.
Таямнічыя выклікі ад старого друідавага сябра прыцягваюць адпушчанага рэнджэра ў пустыні Валкар.
Пасля многіх пытанняў і памылак, я наколькі мог зрабіць поўную гульню і апублікаваць яго на YouTube:
Як гэта працуе
Landing Page
Далей глядзім на ключы - гэта такая прарэз на ніжняй баку планкі, каб паказаць вам усё, што вам трэба ведаць пра Microsoft SharePoint Designer 2010 Essentials.
.fade-in {
@apply opacity-100 transition-opacity duration-1000 ease-in-out;
@starting-style {
opacity: 0;
}
}
Authentication
Для таго, каб гуляць у Quick Start, мне патрэбны акаунт карыстальніка.КлеркГэта вельмі проста дадаць кіраванне карыстальнікамі, і я выкарыстоўваю іх на ўсіх сваіх праектах.
Да таго ж, у мяне ёсць следванне выкарыстання токенаў, дзе я абмежу выкарыстанне з сістэмай токенаў, дзе вы пачынаеце з дастатковай колькасці токенаў, каб зрабіць адзін гуляць праз дэма, а затым можна купіць больш, як вы ідзеце.
The First Turn
Калі карыстальнік прыземліцца на старонцы прыгод для хуткага старта, першае, што адбываецца, мы загружаем дадзеныя для дэма прыгод, які з'яўляецца проста файлам JSON (Як гэтаМодуль або план прыгод у маёй сістэме складаецца з серыі сустрэч, якія звязаны з інструкцыямі для LLM:
"encounters": [
{
"id": "broken-silence",
"title": "Broken Silence",
"intro": "Thalbern, a solitary ranger of the Valkarr woods, has always trusted the silence of the wilds more than the promises of men. Orphaned by border raiders and raised by the elves of the Valkrarr Forest, he has spent years living on the edge of Kordavos, guiding travelers, hunting for his own survival, and keeping his distance from the tangled politics of the city.\n\nYet on this night, a message delivered by a red squirrel bearing the unmistakable script of Wollandora, a trusted elven friend and druid, has drawn him from his hidden home. The note was simple and urgent: Meet me at the Old Standing Stones at midnight. The balance of the forest could depend on it.\n\nNow, as midnight approaches, Thalbern moves quietly through the dense undergrowth, guided by memory and instinct. It is dark with almost no moonlight coming through the forest canopy.\n\nSuddenly, the hush of the night is broken by a sharp crack. Something large has just stepped on a branch somewhere off in the distance.",
"instructions": "A perception check is appropriate if Thalbern investigates (low difficulty with a plus 3 modifier). If successful, he will determine it is a large creature that is approaching quickly. With a high roll (18+), he will determine it is an Owlbear. If combat ensues and Thalbern is below 25% health, Wollandora will intervene. If Thalbern avoids or defeats the Owlbear, or if Wollandora saves him, he proceeds to the Old Standing Stones.",
"image": "images/settings/realm-of-myr/the-midnight-summons/broken-silence-2.png",
"transitions": [
{
"condition": "If Thalbern successfully uses stealth to evade and proceeds cautiously towards the Standing Stones, go to meeting-at-stones.",
"encounter": "meeting-at-stones"
},
{
"condition": "If Thalbern fails a perception check, advance to owlbear-confrontation.",
"encounter": "owlbear-confrontation"
},
{
"condition": "If Thalbern fails any dice roll (including stealth, perception, or any other check), advance to owlbear-confrontation.",
"encounter": "owlbear-confrontation"
},
{
"condition": "If Thalbern does NOT successfully use stealth to evade, go to owlbear-confrontation.",
"encounter": "owlbear-confrontation"
},
{
"condition": "If Thalbern does nothing or takes no action, go to owlbear-confrontation.",
"encounter": "owlbear-confrontation"
},
{
"condition": "If Thalbern has a healthPercent of less than 50%, go to wollandora-intervention.",
"encounter": "wollandora-intervention"
}
]
},
{
"id": "owlbear-confrontation",
"title": "Owlbear Confrontation",
"intro": "From the direction of the sound, a little bit of eye shine glints in the shadows of the tree line. A hulking fifteen foot tall monster with the body of a giant bear and the head of an owl. As it crashes out from the undergrowth, it lets out a guttural squawk, clearly agitated and territorial.",
"instructions": "The Owlbear will attack. If Thalbern attempts an animal handling check (high difficulty) and succeeds, he can move past the Owlbear. If Thalbern wins initiative and attempts to hide, he can move past the Owlbear if he passes a medium difficulty stealth check. If Thalbern's health drops to a critical level, Wollandora appears and drives off the Owlbear, transitioning to 'wollandora-intervention'. If Thalbern defeats the Owlbear, describe his victory and transition to 'meeting-at-stones'.",
"image": "images/settings/realm-of-myr/the-midnight-summons/owlbear-confrontation.png",
"npc": [
{
"id": "owlbear",
"behavior": "Aggressively attacks any perceived threat. Will fight until heavily wounded or driven off.",
"initialInitiative": 1
}
],
"transitions": [
{
"condition": "Thalbern defeats the Owlbear, manages to evade it, successfully uses Animal Handling to pacify and move past it, or successfully rolls any other way to move past it.",
"encounter": "meeting-at-stones"
},
{
"condition": "Thalbern is reduced to critical health by the Owlbear.",
"encounter": "timely-rescue"
}
]
},
...
]
The First Reply
Калі мы знаходзімся ў рэжыме дэма, няма ніякіх рэальных прыгод, створаных яшчэ на заднім кандыдаце. Гэта адбываецца, калі гулец робіць першы адказ.formatNarrativeAction
Функцыя, якая выкарыстоўвае AI, каб ацэньваць адказ, каб пераканацца, што ён граматычна правільны, у трэцім чалавеку і дае дыялог або іншую празу, каб зрабіць яго працаваць добра ў літаратурным нараджальным стылі.
Тым часам, як у нас словы “грамадскае” і “занядбанае” часам успрымаюцца як сінонімы, у Каталоніі грамадскія тэрыторыі — тыя ж пляжы — даглядаюцца так, як у іншых краінах VIP-аўскія.
Processing Player Responses
ІprocessTurnReply
Функцыя загружае сучасны поворот з Convex, дадзеныя прыгод з S3, і ідэнтыфікуе канкрэтную сутыкненне і характар, які выконвае акцыю.
У гэтым кантэкст, ён затым выкарыстоўвае AI, каб вызначыць, ці дзеянне магутна (мой сын пры гульнявым тэстуванні маў рэйнджэр запусціць нук на авечка) і, калі так, ці дыскус руль механічна патрабуецца (напрыклад, "Атака руль" або "Stealth Check"), уключаючы тып руль і яго цяжкасць.
Мы можам зрабіць гэта з функцыйным выклікам, дзе мы можам задаць AI, што мы хочам структурыраваныя дадзеныя, у гэтым выпадкуrollRequirementSchema
:
import { z } from "zod";
export const rollRequirementSchema = z.union([
z.object({
rollType: z.string().describe("The type of roll required, e.g. 'Stealth Check'"),
difficulty: z.number().describe("The difficulty class (DC) for the roll"),
modifier: z.number().optional().describe("Bonus or penalty to the roll, e.g. +2 or -1"),
}),
z.null()
]);
export type RollRequirement = z.infer<typeof rollRequirementSchema>;
І таму на свет з’явілася кніга «Там, дзе возера Глыбокае».generateObject
:
export async function getRollRequirementForAction(action: string) {
const prompt = `
Given the following player or NPC action, determine if a dice roll is required for the character to attempt the action. If a roll is required, return a JSON object with "rollType" (choose the most appropriate from the list below) and "difficulty" (a number between 5 and 25). If no roll is required, return the JSON value null (not a string).
Possible roll types:
- Perception Check
- Investigation Check
- Insight Check
- Stealth Check
...
Examples:
Action: "Try to sneak past the guards."
Result: { "rollType": "Stealth Check", "difficulty": 15 }
Action: "Attack the goblin."
Result: { "rollType": "Attack Roll", "difficulty": 12 }
Action: "Try to determine what the sound is."
Result: { "rollType": "Perception Check", "difficulty": 10 }
Action: "Say hello."
Result: null
Now, given the following action, determine the roll requirement.
Action: "${action}"
`;
try {
const result = await generateObject({
schema: rollRequirementSchema,
prompt,
});
if (
result.object &&
typeof result.object === "object" &&
"rollType" in result.object &&
(result.object.rollType === "null" || result.object.rollType === "none" || result.object.rollType === "")
) {
return null;
}
return result.object ?? null;
} catch (error) {
throw error;
}
}
Тым часам, як у нас словы “грамадскае” і “занядбанае” часам успрымаюцца як сінонімы, у Каталоніі грамадскія тэрыторыі — тыя ж пляжы — даглядаюцца так, як у іншых краінах VIP-аўскія.
Калі ў нас з’явіцца рухавік, у нас ёсцьresolvePlayerRollResult
Іншая справа, як раскрыць душу героя... Калі мы кажам пра кіно, каб захаваць гэтую натуральнасць паўсядзённасці і выявіць драму, неабходны моцны сцэнарый.
NPC Actions
У нашай багатай беларускай літаратуры няма другога такога твора, які па энцыклапедычнасці выяўлення ў ім нацыянальнага, так набліжаўся б да "Новай зямлі".
Training AI to Run RPGs
Калі вы калі-небудзь спрабавалі зрабіць гульнявую сесію з AI ў чаце, вы ведаеце, як хутка гэта можа выйсці з рэльсаў.
Шкадую, што не рашыўся дадаць сюды ў тэму свае думки пра дэмакратыю, але першы іх
Іх унікальная здольнасць да эхолокации літаральна ў тысячы разоў больш эфектыўна, чым у любой падобнай сістэмы, створанай людзьмі.
Варта адзначыць, што для ажыццяўлення работ па стварэнні Нацыянальнага інвентара нематэрыяльнай культурнай спадчыны наша краіна летась атрымала грант з адпаведнага фонду UNESCO.
Варта адзначыць, што для ажыццяўлення работ па стварэнні Нацыянальнага інвентара нематэрыяльнай культурнай спадчыны наша краіна летась атрымала грант з адпаведнага фонду UNESCO.
Я думаю, што выпадковасць AI не рабіць менавіта тое, што чакаецца, можа быць часткай забавы.
Вось прыклад зАдзін з гульнявых сесій.
Вы можаце паглядзець поўны код для гэтага праекта наgithub.com/Johnpolacek/d20adventures.com