Efa mieritreritra ny hamoronana sehatra multiplayer RPG web aho hatramin'ny andro nahatongavan'ny Flash. Misy safidy maro an-tserasera TTRPG any ivelany (olona lehibe!) fa tsy nisy izy ireo nahatsapa tena tsara ny fomba tiako hilalao.
Ve ianao nahitaNy lahatsaryizay Deborah Ann Woll mampiseho an'i Jon Bernthal hoe ahoana ny milalao D&D?
Izany dia tena mahafinaritra. Inona no azoko atao raha afaka mamorona zavatra izay mahatsapa toy izany?
Ny hevitra
Ny sehatra rpg an-tserasera an-tserasera, maro mpilalao, mora amin'ny fitsipika fa avo lenta amin'ny famoronana tantara, miaraka amin'ny vokatra voafaritra amin'ny dikan'ny D20.
Efa tia foana ahoNy modely D & DNy fampidirana mahatalanjona. ny fihaonambe sy ny tantara epika dia manome drafitra ho an'ny mpilalao mba hahafantarana rehefa manao ny lalana mankany amin'ny faran'ny toetr'andro.
Ary ahoana raha afaka mamorona fomba ahafahan'ny olona mamorona ny fanentanana modules, ho an'ny karazana RPG rehetra, dia aoka ny mpilalao hitarika ny sarimihetsika amin'ny alalan'ireny traikefa ireny?
Iza no hitarika ny lalao? Ny mpampianatra lalao dia sarotra ny mahita. Inona raha afaka mampiofana AI aho mba ho mpampianatra lalao? Ny tena mihazakazaka drafitry ny fanatanjahan-tena (amin'ny alalan'ny olona iray!) izay ho mahafinaritra ho an'ny mpilalao ary tsy vitsivitsy fotsinyNy slop?
Manomboka ny
Manana fahafinaretana aho amin'ny fananganana zavatra maro miaraka amin'ny AI (jereoNy tetikasa dia manombokaIzaho dia hampiasa ny safidiko tiako indrindra mba hamoronanaD20Adventures.com ao amin'ny tranonkala, ny Next.js web app miaraka amin'ny Tailwind ho an'ny UI (need it even be said?)Ny SDKAmpiasao ny Gemini sy nyNy angon-drakitra ConvexMandeha ho any amin'ny Vercel.
Ary nanapa-kevitra ny hanorina izany amin'ny aterineto, nanambara ny codeAo amin'ny GitHub.
Ny prototype dia
Ho an'ny prototype, dia manomboka amin'ny toe-javatra voalaza ao amin'ny podcast aho, ny ranger mandeha amin'ny hazo amin'ny alina dia mihaino fipetrahana any amin'ny lavitra, izay mitranga ho vorona.
Ny tanjoko dia ny mamorona traikefa fohy amin'ny fanafihana iray ary jereo raha afaka mampiofanana ny DM AI aho mba hanatanterahana serasera kely amin'ny dingana sy ny fifandonana ho an'ity hetsika ity.
The Midnight Summons Ny antso miavaka avy amin'ny namana Druid tranainy dia manintona ny mpiandry ondry ho any amin'ny haran-dranomasin'i Valkarr.
The Midnight Summons Ny antso miavaka avy amin'ny namana Druid tranainy dia manintona ny mpiandry ondry ho any amin'ny haran-dranomasin'i Valkarr.
Taorian'ny fanandramana sy fahadisoana be dia be dia be aho, farany dia afaka manao ny lalao feno ary namoaka izany tao amin'ny YouTube:
Ahoana no miasa
Landing Page
Ny pejin'ny fidirana dia sary lehibe (natsangana tao amin'ny Midjourney miaraka amin'ny famantarana ny "The Power of the D20"). Nampiditra fady tsotra amin'ny animation aho amin'ny fampiasana ny CSS vaovao @starting-style fitsipika:
.fade-in {
@apply opacity-100 transition-opacity duration-1000 ease-in-out;
@starting-style {
opacity: 0;
}
}
Authentication
Mba hilalao ny Quick Start, mila kaonty mpampiasa aho. Izany dia mba tsy hahazoana vola be noho ny olona tsy fantatra na bots mampiasa ny API.Ny mpanoratraIzany dia mahatonga ny fampidirana ny fitantanana ny mpampiasa tena tsotra, ary mampiasa azy ireo amin'ny tetikasa rehetra aho.
Ankoatra izany, manana ny fanaraha-maso ny fampiasana token aho, izay hampihena ny fampiasana amin'ny rafitra token, izay manomboka amin'ny token ampy ianao mba hahazoana lalao iray amin'ny demo, dia afaka mividy bebe kokoa rehefa mandeha ianao.
The First Turn
Rehefa tonga any amin'ny pejy fanentanana ny mpampiasa mba hanombohana haingana, ny zavatra voalohany izay mitranga dia mametraka ny angon-drakitra ho an'ny fanentanana demo, izay rakitra JSON tsotra (Toy izaoNy module na ny drafitry ny fanentanana ao amin'ny rafitrao dia ahitana andian-dahatsoratra, izay mifandray amin'ny hafa amin'ny torolàlana ho an'ny 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
Satria isika dia ao amin'ny fomba demo, dia tsy misy ny zava-nitranga tena natsangana tamin'ny backend. Izany dia mitranga rehefa ny mpilalao manao ny valiny voalohany. Amin'ny valiny tsirairay, dia mihazakazaka izany na dia iray azaformatNarrativeAction
Function izay mampiasa AI mba hanombohana ny valiny mba hahazoana antoka fa marina amin'ny fiteny izy, amin'ny olona fahatelo ary manampy ny dialoha na prosa hafa mba hahatonga azy io ho miasa tsara amin'ny fomba fanehoan-kevitra literatiora.
Taorian'ny fampiharana ny fametrahana, ny valiny dia alefa any amin'ny serivisy asa. Satria izany dia demo, isika no mamorona ny traikefa ao amin'ny tahirin-kevitra rehefa nahazo ity valiny voalohany ity.
Processing Player Responses
NyprocessTurnReply
Ny endri-javatra dia mametraka ny dingana ankehitriny avy amin'ny Convex, ny angon-drakitra avy amin'ny S3, ary mamantatra ny fihaonana manokana sy ny karazana manao ny hetsika.
Amin'ity kontekst ity, dia mampiasa AI izy io mba hahafantarana raha azo antoka ny hetsika (raha ny zanako tamin'ny fanandramana lalao dia nahazo ny ranger nanomboka nuke teo amin'ny voromaizina) ary, raha izany, raha ilaina ny kodiarana kodiarana (ohatra, "Attack Roll" na "Stealth Check"), anisan'izany ny karazana kodiarana sy ny fahasarotana.
Azontsika atao izany amin'ny alalan'ny antso fonosana, izay ahafahantsika manamarika ny AI fa tiantsika ny angon-drakitra voajanahary, amin'ity tranga ityrollRequirementSchema
:
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>;
Avy eo dia manana endri-javatra iray izay mandefa fangatahana amin'ny antsipiriany sy ny rafitragenerateObject
:
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;
}
}
Taorian'ny fametrahana ny valin'ny mpilalao amin'ny tantara amin'ny dingana, raha ilaina ny tsindrio, dia manatsara ny toe-javatra ny mpilalao ao amin'ny angon-drakitra Convex turn mba hampisehoana fa efa namaly izy ireo fa tsy feno ny dingana.
Rehefa mivezivezy ny mpampiasa, dia mananaresolvePlayerRollResult
Ny serivisy dia manatsara ny tantara amin'ny fanehoan-kevitra momba ny vokatra ary manoratra prosa mamaritra ny vokatra. Manana antso hafa amin'ny asa AI izahay mba hanatsarana ny fahasalamana sy ny toe-javatra ho an'ny mpilalao rehetra amin'ny andaniny.
NPC Actions
Rehefa mivantana ny NPCs mba hamaly, dia manaraka endrika mitovy amin'ny mpilalao isika, afa-tsy amin'ity tranga ity ny AI dia manoratra ny valiny. Ny fihaonana tsirairay dia ahitana fampahalalana momba ny fanentanana ny NPCs ary rehefa mifandray amin'ny fifandraisana amin'ny fampisehoana tantara hatramin'izao, manantena aho fa ny AI dia afaka mamorona valiny tsara, ary avy eo dia mamorona ny tsikelikely sy ny vokatra vaovao.
Training AI to Run RPGs
Raha efa miezaka ny manao lalao session amin'ny AI ao amin'ny chat ianao, fantatrao hoe haingana haingana izany dia afaka miala amin'ny lalana.
Manantena aho fa amin'ny alàlan'ny fametrahana ny toe-javatra mety, ny torolàlana manokana ary ny antso amin'ny endriky ny angon-drakitra, dia afaka mahazo traikefa mahafinaritra isika.
Misy mazava ho azy fa be dia be ny fanandramana sy ny fahadisoana, ny fisoratana anarana ao amin'ny console ary ny fanitsiana avy hatrany. Ohatra, rehefa manontany aho hoe nahoana ny AI dia tsy manaraka ny torolàlana amin'ny fihaonana tao amin'ny iray amin'ireo dingana fitsapana ireo, dia izao no nolazain'ny Cursor chat tamiko:
Amin'ny ankapobeny, ny LLM dia tsy manaraka ny torolàlana mazava ho an'ny fandehan-javatra rehefa tsy nahavita fanaraha-maso ny fahatsapana, na dia efa nanome porofo mazava momba ny fandehan-javatra toy izany sy ny fitsipika fandehan-javatra ho an'io toe-javatra manokana io.
Amin'ny ankapobeny, ny LLM dia tsy manaraka ny torolàlana mazava ho an'ny fandehan-javatra rehefa tsy nahavita fanaraha-maso ny fahatsapana, na dia efa nanome porofo mazava momba ny fandehan-javatra toy izany sy ny fitsipika fandehan-javatra ho an'io toe-javatra manokana io.
Mihevitra aho fa ny tsy fahita firy amin'ny AI tsy manao izay azo antoka dia mety ho ampahany amin'ny fahafinaretana.
Indro ny ohatra iray amin'nyNy iray amin'ireo lalao.
Azonao jerena ny fehezan-dalàna manontolo ho an'ity tetikasa ity amin'nywww.github.com / fandraisam-bahiny / fandraisam-bahiny / fandraisam-bahiny