跳转至

修缮王国

这是一个RPG游戏,玩家扮演一位怪物工匠并收集素材、修理建筑、制造道具并探索新的区域。

这是我在阿伯泰大学的第三个项目,担任程序,负责叙事相关功能(对话、任务等)与游戏进程管理功能的实现,也实现了一些其他功能。

本次项目是在与来自Ninja Kiwi的客户不断报告、交付并得到反馈中完成

贡献

对话系统

DialogMap_Opt.gif

对话样式.drawio.png

每一个对话都包含了当前对话与下一个对话的索引值,即指向下一段或某一个特定的对话。如果一个对话完成且没有特殊条件,那么下一个对话的索引值就会被角色记录,当玩家下次与该角色对话,角色当前对话索引值所对应的对话就会被触发。这样的实现方式也可以让角色在被重复触发对话时,执行完不同对话之后重复执行同一段对话,如上图Dialogue 3所示。如果有特殊条件,例如任务被触发或者完成,角色的当前对话索引值可以被修改(指向)一段特殊的对话。这种结构使得修改对话内容与条件非常简单,添加新的对话只需要添加一段新的索引即可。

并且设计了一套JSON对话存储格式。对话系统实现了不同角色一起说话的功能。等等,稍后再补充。

酒馆

酒馆是一个让角色与酒馆老板产生对话并接取、完成任务的室内场所。

酒馆内的对话系统与外部略有不同。玩家进入酒馆时,系统会自动生成对话框和对话内容,以模拟NPC向角色问好的效果。由于酒馆内的对话框样式与外部不同,因此我对对话系统进行了一些修改,使其逻辑能够适应酒馆的需求。此外,在任务发布功能方面,还需要实现任务的读取、提交等更新功能,并且每个任务都需要检测完成条件并给予玩家奖励,这些内容将在后续的事件系统部分详细讨论。

酒馆功能实现中最复杂的部分是用户界面逻辑。每个不同的界面都对应着不同的用户界面逻辑。

在主界面,当玩家将鼠标悬停在图标上并点击时,需要获取玩家点击信息并打开相应的函数,然后再根据当前打开的页面使用对应的UI逻辑——在接受任务界面,当玩家点击某个任务时,任务详情会弹出;接受任务后,相应的空白区域会清空;如果可接受的任务超过十个,则会实时添加。但实际上可接受的任务不会超过十个;在提交任务界面,玩家将鼠标悬停在相应的任务上后,任务详情界面会立即弹出,玩家可以拖动左侧的任务列表来选择任务;而在对话界面,无论玩家做什么,都只能推进对话直到结束。

此外,为适配不同玩家的操作习惯、满足客户要求,专门为该酒馆制作了两套UI操作逻辑,使用鼠标或键盘均可在酒馆中执行操作。

事件系统

A quest as a unit, which contains multiple events, and contains within the event the effects that the event produces. A quest is initiated by something and reacts to all other things related to that quest when the corresponding event is triggered. A quest is issued with a corresponding event, and the Listener listens to the corresponding event and reacts differently to different Listener, for example, if NPC1 issues a Quest1 End event, then the player gets the quest reward, then triggers a dialog, the next dialog of NPC1 changes, and issues a Quest2 Start event, and then then trigger the corresponding event handler function to react differently.

每个任务作为一个单位,其中均包含数个事件,部分事件会影响游戏进程。当某个事件被触发时,相应的任务会被初始化,并且会对所有与该事件相关的事物产生交互。当一个任务被对应的事件触发时,Listener会保持listen相应的事件,并对不同的Listener作出不同的反应。例如,如果NPC1触发了Quest1结束事件,会触发以下事件:玩家得到任务奖励、触发一段对话、更改下次与NPC1对话时触发的对话、触发Quest2开始事件。

Through the event system, different systems can be linked, for example, after the completion of a mission, the player obtains the corresponding props, linking the props system and the mission system, and after triggering a certain mission, allowing the player to open the blueprint, and after completing the blueprint to complete the mission and trigger the dialog, so that the blueprint, the mission, the props, and the dialog system are all linked. And it can realize the advancement of the game flow, only after completing a specific quest and triggering an event can the next quest be carried out. It's also very easy to manage missions as a unit, and it's also very easy to add new events if they are unified by the event system, which also prevents the code from getting messed up. For example, if the player collects enough props, completes a specific blueprint, or arrives at a specific area and investigates a specific object, an event will be triggered, which will lead to the next quest, change the dialog state, get a reward, and many other events.

通过这个事件系统,不同的系统之间都可以发生联系。例如,当完成一个任务之后,玩家会得到对应的道具,如此让道具与任务系统以低耦合的方式关联起来,当触发一个特定任务时,玩家会打开蓝图(游戏解谜的主要玩法),完成蓝图之后,任务会完成,同时又会触发对话,这样蓝图、任务、道具以及对话系统都可以联系起来。

其他贡献

升级

升级功能使用事件系统作为框架。通过触发升级事件以提供奖励或解锁新任务。

升级.gif

玩家指引

指引功能使用在酒馆中实现的追踪框,可以用来自动追踪需要被高亮的物体以指引玩家。

升级.gif

UI动画

当玩家切换场景或开始聊天时,UI动画会被播放。与对话、切换场景有关UI动画均由我自己设计并实现。

UI专场.gif


最后更新: November 19, 2026 06:24:04