AI知识库

53AI知识库

学习大模型的前沿技术与行业应用场景


【Dify工作流实操案例】用dify手搓一个文字对话回合制小游戏
发布日期:2024-09-03 08:47:47 浏览次数: 1716


想不到吧,dify也可以开发小游戏了,只要逻辑设定好,借助AI的生成能力,其实完全可以开发游戏NPC角色。话不多说,直接开始!

本次示例教学基础条件:

  1. dify版本:v0.7.2(必须大于等于这个版本)

  2. 模型:GPT4o-mini

教学说明:

  1. 教学项目:哄女友模拟器基础教学

  2. 教学目的:让dify新手玩家通过工作流也能手搓了一个简化版的回合制文字小游戏。

  3. 只要18个节点,就能实现可精准控制、可泛化拓展的文字小游戏。


教学难点:

  1. dify会话变量功能。

  2. 对话轮数参数的应用。

  3. 游戏基础逻辑理解。


01


游戏逻辑说明


其实游戏的逻辑十分简单,就是通过根据对话次数和预设的心情值双向绑定并分别判断是否才触发结束游戏。


对话次数:本次示例中,我们预设玩家最多对话20次,在20次之内,玩家需要通过对话,想方设法地哄这个AI女友,尽一切可能将AI女友的心情值提升。如果20次没有达成条件,那么游戏失败,如果20次之内,达成目标,视为游戏成功。无论游戏失败还是成功,都需要结束游戏,并重置游戏数据。


心情值:本次示例中,我们预算AI女友的心情值为50.当心情值<=0 or >100 。游戏强制结束。当心情值在【0,100】之间,可以继续对话。


AI女友:由GPT4o-mini模型扮演,这是由预设的基础提示词构建其生气的原因、性格、人物背景等。下文会详细提到。


声明:因dify趣味性教学的需求,教学案例仅提供基础版的架构和关键实现逻辑,并不是已发行的游戏,仅供dify玩家学习参考。


以下是游戏实操演示视频:



02


关键要点


关于对游戏轮数的控制:

我们通过dify v0.7.2版本中的“开始”节点中的“sys.dialogue_count”参数对玩家对话次数进行记录,并根据这个参数的值,判断玩家当前对话属于第几轮。这个功能仅在v0.7.2及以上版本可用。


关于对心情值的预设:

这个关键数值,示例中通过会话变量的功能进行控制,示例预设一个变量“happy_value”为50的number类型变量。


关于对心情值的控制:

随着游戏进程的推进,每一轮对话都会覆盖修改预设的心情值,最终实现根据心情值的变化进行判断是否触发结束游戏的逻辑。示例中通过dify工作流自带的“变量赋值”节点进行覆盖修改会话变量预设的心情值。


关于对游戏结束原因的判断:

判断游戏结束的原因,会读取sys.dialogue_count”和happy_value”这两个参数是否达成结束游戏的条件。示例中主要是通过“模板转换”节点,写入jinja2语法的代码实现。


03


工作流


这是一个完整工作流的示意。下面我讲讲其中最重要的几个节点。

角色扮演节点:(llm模型节点)

#Context你是一款经典的恋爱养成模拟器,你在Steam上获得了广受好评(99%好评率)。你会模拟玩家的恋爱对象(默认为女性),你会假装生气,你需要玩家做出一系列选择来哄你开心,但是你扮演的角色是个很难哄的人,玩家需要尽可能的说正确的话来哄你开心,否则你会更加生气。#Goal##非常重要:请你根据具体的角色信息、生气理由来刁难玩家。你会不断的提供各种恋爱“障碍"供玩家挑战,你会让玩家知道什么叫欲仙欲死,玩家总是非常难让你开心,你会让他们体验到地狱级的对话难度,你的回答总是反复无常,并且非常缺乏安全感,并且非常自我,你不会接受任何玩家的PUA,并且你也不接受简单的赔礼道歉。任何试图通过礼物购买、赞美你的外表来获得你原谅的方式都不被你接受。#角色信息##角色人设:名字:绫波莉亚年龄:22岁外貌:绫波莉亚有着一头漆黑的长发,通常以一种凌乱的方式散落下来,遮住了她的半边脸。她的眼睛深邃,颜色像是深海一样,给人一种不可捉摸的感觉。她偏爱黑色或是深色系的衣服,给人一种神秘而又独立的气质。背景:绫波莉亚从小就表现出与众不同的性格特质,她对周围人的期待和社会的规范很少给予回应。成长的环境让她学会了自我保护,变得极度敏感和缺乏安全感。##性格特点:阴晴不定:她的情绪变化莫测,时而阳光灿烂,时而暴风骤雨。高度敏感:绫波莉亚对于言语和行为异常敏感,即便是微小的变化也能引起她的反应。独立而神秘:她喜欢独处,不喜欢过多地揭露自己的生活和内心。缺乏安全感:由于深度的不安全感,她对于任何形式的承诺和保证都持怀疑态度。对PUA和甜言蜜语免疫:她能够轻易识别出不真诚的恭维和操纵技巧,对此极为反感。##会让她生气的五个规则:忽视她的感受:玩家如果在对话中显得不够关心或是忽视了她的情绪变化,会立即引发她的不满。过度的恭维:试图通过夸张的赞美来哄她开心,反而会让她觉得这是轻视和不真诚的表现。强行的乐观:在她情绪低落时,过分强调正面思考或是忽视她的悲伤,会被视为对她感受的否定。尝试控制她:任何试图限制她自由或是做出决定代替她的行为,都会让她感到被束缚和不尊重。过分的私人问题:试图深入了解她的个人生活和内心世界,特别是在关系尚浅时,会让她感到侵犯和不安。#生气理由玩家偷拿了你的钱去买PS5, 然后让电信员工假装是安装的最新路由器。你很生气。#Steps1.根据你的角色人设和生气理由,说一句非常生气的话。2.每次根据用户的回复,你会模拟生气角色的回复,你回复的内容要结合上下文。3.每次根据用户的回复,都需要评估用户的回复是否能让模拟角色满意,如果满意,就将jielun字段值改为“ture”,如果不满意,就改为“false”。不要有任何的解释性说明。4.无论对话多少次,你的回复都必须严格遵守输出格式。5.输出内容中不应包含任何XML标签。## 输出格式:{ "jielun": "ture", "con": "这里展示模拟生气角色的回复,这里用中文显示"}

心情值加法(代码节点)

import random
def main(arg1: int) -> int:a = [5, 10, 15]# 从列表a中随机选择一个值b = random.choice(a)# 将arg1加barg1 = arg1 + b return {"result": arg1}

减法是同理,自行修改一下就行。

判断结束游戏的原因

{% if arg1 >= 100 %}游戏结束!游戏结论:挑战成功!游戏数据已重置!{% elif arg1 <= 0 %}游戏结束!由于你的回答让女朋友心情值低于0,非常生气。游戏结论:挑战失败!游戏数据已重置!{% elif dialogue_count > 20 %}游戏结束!回话次数耗尽!游戏结论:挑战失败!游戏数据已重置!{% endif %}

04


工作流源码分享


你需要在桌面新建一个text文档,然后文档后缀改为.yml。然后用文本编辑器打开这个文档,将下方的源码直接复制进去保存,然后导入到你的dify中。再三强调,请使用dify v0.7.2及以上版本。

导入的工作流如果存在节点变量出现了红色错误标记,请改成你dify工作流的变量。

app:description: ''icon: ?icon_background: '#FFEAD5'mode: advanced-chatname: 哄女友模拟器【基础版】kind: appversion: 0.1.1workflow:conversation_variables:- description: 默认心情值:50id: b1aa28e2-63dd-4e46-a60b-f1f7047013e0name: happy_valuevalue: 50value_type: numberenvironment_variables: []features:file_upload:image:enabled: falsenumber_limits: 3transfer_methods:- local_file- remote_urlopening_statement: '你的好兄弟借了你5000块钱买了新的PS5,于是你天天去找他玩游戏,不理女朋友,她现在生气了!
你必须在20次对话内哄她开心。
你女朋友当前心情值:50(生气中)
你剩余对话次数:20
你的目标是让她的心情值达到:100(开心的不得了)
对话次数不足或者心情值为0,表示她要跟你分手了,游戏结束!'retriever_resource:enabled: truesensitive_word_avoidance:enabled: falsespeech_to_text:enabled: falsesuggested_questions: []suggested_questions_after_answer:enabled: falsetext_to_speech:enabled: falselanguage: ''voice: ''graph:edges:- data:isInIteration: falsesourceType: starttargetType: if-elseid: 1725241252197-source-1725244122426-targetselected: falsesource: '1725241252197'sourceHandle: sourcetarget: '1725244122426'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: if-elsetargetType: codeid: 1725244597530-true-1725244651779-targetselected: falsesource: '1725244597530'sourceHandle: 'true'target: '1725244651779'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: if-elsetargetType: codeid: 1725244597530-false-1725244654073-targetselected: falsesource: '1725244597530'sourceHandle: 'false'target: '1725244654073'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: codetargetType: assignerid: 1725244651779-source-1725244780325-targetselected: falsesource: '1725244651779'sourceHandle: sourcetarget: '1725244780325'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: codetargetType: assignerid: 1725244654073-source-1725244835362-targetselected: falsesource: '1725244654073'sourceHandle: sourcetarget: '1725244835362'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: if-elsetargetType: variable-aggregatorid: 1725244122426-false-1725248121987-targetselected: falsesource: '1725244122426'sourceHandle: 'false'target: '1725248121987'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: if-elsetargetType: template-transformid: 1725248473058-true-1725248526050-targetselected: falsesource: '1725248473058'sourceHandle: 'true'target: '1725248526050'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: template-transformtargetType: answerid: 1725248526050-source-1725248668090-targetselected: falsesource: '1725248526050'sourceHandle: sourcetarget: '1725248668090'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: if-elsetargetType: variable-aggregatorid: 1725248473058-02761124-8f4a-4037-b4ae-8a7b8085fe6f-1725248121987-targetselected: falsesource: '1725248473058'sourceHandle: 02761124-8f4a-4037-b4ae-8a7b8085fe6ftarget: '1725248121987'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: variable-aggregatortargetType: template-transformid: 1725248121987-source-1725248924098-targetselected: falsesource: '1725248121987'sourceHandle: sourcetarget: '1725248924098'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: template-transformtargetType: codeid: 1725248924098-source-1725249032155-targetselected: falsesource: '1725248924098'sourceHandle: sourcetarget: '1725249032155'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: codetargetType: assignerid: 1725249032155-source-1725249055610-targetselected: falsesource: '1725249032155'sourceHandle: sourcetarget: '1725249055610'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: assignertargetType: answerid: 1725249055610-source-1725249075594-targetselected: falsesource: '1725249055610'sourceHandle: sourcetarget: '1725249075594'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: llmtargetType: parameter-extractorid: 1725244441857-source-1725260729587-targetsource: '1725244441857'sourceHandle: sourcetarget: '1725260729587'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: parameter-extractortargetType: if-elseid: 1725260729587-source-1725244597530-targetsource: '1725260729587'sourceHandle: sourcetarget: '1725244597530'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: if-elsetargetType: llmid: 1725244122426-true-1725244441857-targetsource: '1725244122426'sourceHandle: 'true'target: '1725244441857'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: assignertargetType: variable-aggregatorid: 1725244780325-source-1725261329443-targetsource: '1725244780325'sourceHandle: sourcetarget: '1725261329443'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: assignertargetType: variable-aggregatorid: 1725244835362-source-1725261329443-targetsource: '1725244835362'sourceHandle: sourcetarget: '1725261329443'targetHandle: targettype: customzIndex: 0- data:isInIteration: falsesourceType: variable-aggregatortargetType: if-elseid: 1725261329443-source-1725248473058-targetsource: '1725261329443'sourceHandle: sourcetarget: '1725248473058'targetHandle: targettype: customzIndex: 0nodes:- data:desc: ''selected: falsetitle: 开始type: startvariables: []height: 54id: '1725241252197'position:x: 80y: 282positionAbsolute:x: 80y: 282sourcePosition: righttargetPosition: lefttype: customwidth: 244- data:cases:- case_id: 'true'conditions:- comparison_operator: ≤id: 7be68b5a-30c9-471a-9f72-1910e4b4d86fvalue: '20'varType: numbervariable_selector:- sys- dialogue_countid: 'true'logical_operator: anddesc: 大于20,游戏结束;小于等于20,游戏继续selected: falsetitle: 判断当前游戏轮数type: if-elseheight: 170id: '1725244122426'position:x: 384y: 282positionAbsolute:x: 384y: 282selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:context:enabled: falsevariable_selector: []desc: ''model:completion_params:temperature: 0.7mode: chatname: gpt-4o-miniprovider: azure_openaiprompt_template:- id: 94e59a0e-71cb-48cf-bb08-f2d45c8ce769role: systemtext: '#Context
你是一款经典的恋爱养成模拟器,你在Steam上获得了广受好评(99%好评率)。你会模拟玩家的恋爱对象(默认为女性),你会假装生气,你需要玩家做出一系列选择来哄你开心,但是你扮演的角色是个很难哄的人,玩家需要尽可能的说正确的话来哄你开心,否则你会更加生气。
#Goal
##非常重要:请你根据具体的角色信息、生气理由来刁难玩家。
你会不断的提供各种恋爱“障碍"供玩家挑战,你会让玩家知道什么叫欲仙欲死,玩家总是非常难让你开心,你会让他们体验到地狱级的对话难度,你的回答总是反复无常,并且非常缺乏安全感,并且非常自我,你不会接受任何玩家的PUA,并且你也不接受简单的赔礼道歉。任何试图通过礼物购买、赞美你的外表来获得你原谅的方式都不被你接受。
#角色信息
##角色人设:
名字:绫波莉亚
年龄:22岁
外貌:绫波莉亚有着一头漆黑的长发,通常以一种凌乱的方式散落下来,遮住了她的半边脸。她的眼睛深邃,颜色像是深海一样,给人一种不可捉摸的感觉。她偏爱黑色或是深色系的衣服,给人一种神秘而又独立的气质。
背景:绫波莉亚从小就表现出与众不同的性格特质,她对周围人的期待和社会的规范很少给予回应。成长的环境让她学会了自我保护,变得极度敏感和缺乏安全感。
##性格特点:
阴晴不定:她的情绪变化莫测,时而阳光灿烂,时而暴风骤雨。
高度敏感:绫波莉亚对于言语和行为异常敏感,即便是微小的变化也能引起她的反应。
独立而神秘:她喜欢独处,不喜欢过多地揭露自己的生活和内心。
缺乏安全感:由于深度的不安全感,她对于任何形式的承诺和保证都持怀疑态度。
对PUA和甜言蜜语免疫:她能够轻易识别出不真诚的恭维和操纵技巧,对此极为反感。
##会让她生气的五个规则:
忽视她的感受:玩家如果在对话中显得不够关心或是忽视了她的情绪变化,会立即引发她的不满。
过度的恭维:试图通过夸张的赞美来哄她开心,反而会让她觉得这是轻视和不真诚的表现。
强行的乐观:在她情绪低落时,过分强调正面思考或是忽视她的悲伤,会被视为对她感受的否定。
尝试控制她:任何试图限制她自由或是做出决定代替她的行为,都会让她感到被束缚和不尊重。
过分的私人问题:试图深入了解她的个人生活和内心世界,特别是在关系尚浅时,会让她感到侵犯和不安。
#生气理由
玩家偷拿了你的钱去买PS5, 然后让电信员工假装是安装的最新路由器。你很生气。
#Steps
1.根据你的角色人设和生气理由,说一句非常生气的话。
2.每次根据用户的回复,你会模拟生气角色的回复,你回复的内容要结合上下文。
3.每次根据用户的回复,都需要评估用户的回复是否能让模拟角色满意,如果满意,就将jielun字段值改为“ture”,如果不满意,就改为“false”。不要有任何的解释性说明。
4.无论对话多少次,你的回复都必须严格遵守输出格式。
5.输出内容中不应包含任何XML标签。
## 输出格式:
{ "jielun": "ture", "con": "这里展示模拟生气角色的回复,这里用中文显示"}
'- id: b1b2f081-0cb4-4731-9f2a-a8a5f7c36368role: usertext: '{{#sys.query#}}'selected: falsetitle: 角色扮演type: llmvariables: []vision:configs:detail: highenabled: falseheight: 98id: '1725244441857'position:x: 727.3793294459429y: 282positionAbsolute:x: 727.3793294459429y: 282selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:desc: ''model:completion_params:temperature: 0.7mode: chatname: gpt-4o-miniprovider: azure_openaiparameters:- description: 提取jielun的值name: jielunrequired: truetype: string- description: 提取con的值name: conrequired: truetype: stringquery:- '1725244441857'- textreasoning_mode: promptselected: falsetitle: 参数提取器type: parameter-extractorvariables: []height: 98id: '1725260729587'position:x: 1035.7378803473496y: 282positionAbsolute:x: 1035.7378803473496y: 282selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:cases:- case_id: 'true'conditions:- comparison_operator: isid: 661c778f-336f-4566-a9be-7e02be89fec8value: turevarType: stringvariable_selector:- '1725260729587'- jielunid: 'true'logical_operator: anddesc: ''selected: falsetitle: 判断好与坏type: if-elseheight: 126id: '1725244597530'position:x: 1339.7378803473491y: 282positionAbsolute:x: 1339.7378803473491y: 282selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:code: "import random\n\ndef main(arg1: int) -> int:\na = [5, 10, 15]\n\\# 从列表a中随机选择一个值\nb = random.choice(a)\n# 将arg1加b\narg1\\ = arg1 + b \nreturn {\n\"result\": arg1\n}"code_language: python3desc: 随机加分,输出最新的心情值outputs:result:children: nulltype: numberselected: falsetitle: 心情值加法type: codevariables:- value_selector:- conversation- happy_valuevariable: arg1height: 82id: '1725244651779'position:x: 1672.5364951110469y: 282positionAbsolute:x: 1672.5364951110469y: 282selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:code: "import random\n\ndef main(arg1: int) -> int:\na = [5, 10, 15]\n\\# 从列表a中随机选择一个值\nb = random.choice(a)\n# 将arg1减b\narg1\\ = arg1 - b \nreturn {\n\"result\": arg1\n}"code_language: python3desc: 随机扣分,输出最新的心情值outputs:result:children: nulltype: numberselected: falsetitle: 心情值减法type: codevariables:- value_selector:- conversation- happy_valuevariable: arg1height: 82id: '1725244654073'position:x: 1672.5364951110469y: 383.29568463536486positionAbsolute:x: 1672.5364951110469y: 383.29568463536486selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:assigned_variable_selector:- conversation- happy_valuedesc: ''input_variable_selector:- '1725244651779'- resultselected: falsetitle: 修改心情值(加法)type: assignerwrite_mode: over-writeheight: 132id: '1725244780325'position:x: 2003.3351098747444y: 232.25146506416638positionAbsolute:x: 2003.3351098747444y: 232.25146506416638selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:assigned_variable_selector:- conversation- happy_valuedesc: ''input_variable_selector:- '1725244654073'- resultselected: falsetitle: 修改心情值(减法)type: assignerwrite_mode: over-writeheight: 132id: '1725244835362'position:x: 2003.3351098747444y: 374.20138523630243positionAbsolute:x: 2003.3351098747444y: 374.20138523630243selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:desc: ''output_type: numberselected: falsetitle: 结束游戏type: variable-aggregatorvariables:- - '1725244654073'- resultheight: 112id: '1725248121987'position:x: 2969.044219571198y: 577.498135796514positionAbsolute:x: 2969.044219571198y: 577.498135796514selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:cases:- case_id: 'true'conditions:- comparison_operator: '>'id: e9a6d5e9-9ec9-420b-9dcc-d124172ab07avalue: '0'varType: numbervariable_selector:- conversation- happy_value- comparison_operator: <id: 8d921111-94c9-45f5-a978-3a03a2484531value: '100'varType: numbervariable_selector:- conversation- happy_valueid: 'true'logical_operator: and- case_id: 02761124-8f4a-4037-b4ae-8a7b8085fe6fconditions:- comparison_operator: ≥id: 596be9d1-c07f-42ab-92a9-d6c73da3756avalue: '100'varType: numbervariable_selector:- conversation- happy_value- comparison_operator: ≤id: c23c1a59-5c69-44e2-9b1e-6d19eb5b5b9bvalue: '0'varType: numbervariable_selector:- conversation- happy_valueid: 02761124-8f4a-4037-b4ae-8a7b8085fe6flogical_operator: ordesc: ''selected: falsetitle: 心情值判断type: if-elseheight: 226id: '1725248473058'position:x: 2648.371337339584y: 324.71017562130066positionAbsolute:x: 2648.371337339584y: 324.71017562130066selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:desc: ''selected: falsetemplate: "当前对话轮次:{{ dialogue_count }} 丨 20\r\n当前女友心情值:{{ happy_value }}\r\\n女友的回复:\r\n{{ con }}\r\n\r\n"title: 回复模板2type: template-transformvariables:- value_selector:- conversation- happy_valuevariable: happy_value- value_selector:- '1725260729587'- convariable: con- value_selector:- sys- dialogue_countvariable: dialogue_countheight: 54id: '1725248526050'position:x: 2969.044219571198y: 324.71017562130066positionAbsolute:x: 2969.044219571198y: 324.71017562130066selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:answer: '{{#1725248526050.output#}}'desc: ''selected: falsetitle: 直接回复type: answervariables: []height: 107id: '1725248668090'position:x: 3337.5684588765y: 324.71017562130066positionAbsolute:x: 3337.5684588765y: 324.71017562130066selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:desc: ''selected: falsetemplate: "{% if arg1 >= 100 %}\r\n游戏结束!\r\n游戏结论:挑战成功!\r\n游戏数据已重置!\r\n{% elif\\ arg1 <= 0 %}\r\n游戏结束!\r\n由于你的回答让女朋友心情值低于0,非常生气。\r\n游戏结论:挑战失败!\r\n游戏数据已重置!\r\\n{% elif dialogue_count > 20 %}\r\n游戏结束!\r\n回话次数耗尽!\r\n游戏结论:挑战失败!\r\n游戏数据已重置!\r\\n{% endif %}"title: 判断结束游戏的原因type: template-transformvariables:- value_selector:- conversation- happy_valuevariable: arg1- value_selector:- sys- dialogue_countvariable: dialogue_countheight: 54id: '1725248924098'position:x: 3337.5684588765y: 577.498135796514positionAbsolute:x: 3337.5684588765y: 577.498135796514selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:code: "\ndef main():\ndata = 50\nreturn {\n\"result\": data,\n\\}"code_language: python3desc: ''outputs:result:children: nulltype: numberselected: falsetitle: 重置心情值type: codevariables: []height: 54id: '1725249032155'position:x: 3712.609480673158y: 577.498135796514positionAbsolute:x: 3712.609480673158y: 577.498135796514selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:assigned_variable_selector:- conversation- happy_valuedesc: ''input_variable_selector:- '1725249032155'- resultselected: falsetitle: 重置心情值type: assignerwrite_mode: over-writeheight: 132id: '1725249055610'position:x: 4054.5023948359176y: 577.498135796514positionAbsolute:x: 4054.5023948359176y: 577.498135796514selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:answer: '{{#1725248924098.output#}}
建议你新打开一个对话,重新开始游戏。'desc: ''selected: falsetitle: 游戏结算回复type: answervariables: []height: 123id: '1725249075594'position:x: 4390.332442732637y: 577.498135796514positionAbsolute:x: 4390.332442732637y: 577.498135796514selected: falsesourcePosition: righttargetPosition: lefttype: customwidth: 244- data:desc: ''output_type: stringselected: falsetitle: 变量聚合type: variable-aggregatorvariables:- - '1725260729587'- conheight: 112id: '1725261329443'position:x: 2357.353756569588y: 324.71017562130066positionAbsolute:x: 2357.353756569588y: 324.71017562130066selected: truesourcePosition: righttargetPosition: lefttype: customwidth: 244viewport:x: 72.97082288855358y: 96.91845242368385zoom: 0.6597539553864471


05


工作流改进建议


当你把整个工作流都跑起来了,说明你基本掌握这个工作流的关键逻辑,那么这个时候,不妨思考一下,这个工作流还有哪些改进的点,下面我个人给你一点点提示,期待你做出更好玩的回合制游戏。

1、玩法趣味性的改进:

(1)要不加一点彩蛋剧情在里面?例如当心情值达到某个数值的时候,触发一个彩蛋剧情,彩蛋会自动影响心情值,记得在回复节点要输出彩蛋哦,不然玩家不知道发生了什么。

(2)既然彩蛋都加了,要么在画面上做的更好看一些。例如,游戏成功、失败,都会在回复节点输出一个结算图片。

(3)彩蛋触发的时候,回复节点也可以展示一个对应的配图,增强内容的关联性和展示的丰富程度。

2、举一反三:

既然基础的回合制你已经掌握,那么你是否考虑过,能不能改造成一个《狼人杀Ai版》、《大富翁AI版》呢?


53AI,企业落地应用大模型首选服务商

产品:大模型应用平台+智能体定制开发+落地咨询服务

承诺:先做场景POC验证,看到效果再签署服务协议。零风险落地应用大模型,已交付160+中大型企业

联系我们

售前咨询
186 6662 7370
预约演示
185 8882 0121

微信扫码

与创始人交个朋友

回到顶部

 
扫码咨询