Achievement

*achievement 命令用于定义一个或多个成就,可在游戏中因玩家完成值得称道的壮举或成就而授予——例如解决谜题或谜团;克服或成功渡过特别艰难的挑战;发现“隐藏”元素或难以发现的路线;又或者仅仅是在某次特定游戏过程中达到极高的属性值。实际上,只要是您游戏中完全值得大力称赞的任何内容都可以。

Achievement System 成就系统

Achievements are declared in the Startup.txtarrow-up-right file and must be placed immediately following the list of *create commands, using one *achievement command for each and assigning to each a unique codename for reference. Once properly declared, an Achievement may then be awarded to the player at any point in your actual Scenearrow-up-right files using the simple *achievearrow-up-right [codename] command. The absolute maximum number of Achievements possible to include in any single game is 100. 成就需在 Startup.txt 文件中声明,必须紧接在 *create 命令列表之后,使用一个 *achievement 命令为每个成就指定唯一的 codename 以供引用。一旦正确声明,即可在任意场景文件中使用简单的 *achieve [代码名] 命令向玩家授予成就。单个游戏最多可包含 100 项成就。

Achievement screen 成就界面

A game featuring Achievements will automatically have a button of that name visible at the top of the screen, alongside the usual 'Show Stats' and 'Restart' buttons. As with the 'Show Stats' button, the player may click the 'Achievements' button at any point in the game to view a separate page containing all of their known Achievements information, before returning to the current page in the game with a 'Next' click. 包含成就的游戏会在屏幕顶部自动显示同名按钮,与常规的“显示状态”和“重启”按钮并列。与“显示状态”按钮类似,玩家可在游戏任意时刻点击“成就”按钮,查看包含所有已知成就信息的独立页面,随后通过点击“继续”按钮返回游戏当前页面。

Unlike the 'Show Stats' button, however, there is no separate game file (e.g. 'choicescript_stats') required for including Achievements in your game - i.e. the page the player views is automatically generated by ChoiceScript itself, and is based entirely on the data provided by your comprehensive *achievement declarations in the Startup file. 与“显示状态”按钮不同,在游戏中加入成就系统并不需要单独的游戏文件(例如 choicescript_stats),也就是说玩家查看的页面是由 ChoiceScript 自动生成的,完全基于您在启动文件中通过 *achievement 声明提供的数据。

Visible and hidden achievements 可见与隐藏成就

As part of the declaration process, Achievements must be defined as either 'visible' or 'hidden'. All Achievements marked as visible are listed on the Achievements page from the very start of the game, with a title and short, "pre-earned" description. When that Achievement is awarded, its entry on the Achievements page is changed to show the "post-earned" description provided in the declaration. 在声明过程中,成就必须被定义为“可见”或“隐藏”。所有标记为可见的成就都会从游戏一开始就列在成就页面上,并附带标题和简短的“获得前”描述。当该成就被授予时,其在成就页面上的条目将更改为显示声明中提供的“获得后”描述。

Conversely, a 'hidden' Achievement is not listed on the Achievements page at all until it is actually awarded, at which point the precise details are revealed. At the start of a game, a player is only told how many hidden Achievements actually exist in the game. Future visits to that page will inform the player how many yet remain undiscovered. 相反,"隐藏"成就在实际获得之前,完全不会在成就页面列出,届时其具体细节才会揭晓。游戏开始时,玩家仅被告知游戏中实际存在多少隐藏成就。之后每次访问该页面,系统都会告知玩家还有多少成就尚未被发现。

Achievement points 成就点数

Both 'visible' and 'hidden' Achievements must also be given a numerical points value as part of the declaration. The more difficult an Achievement is to earn, the higher this value should be relative to lesser Achievements. A game's Achievements page informs the player of both the total points possible and the total current 'earned' value, giving them yet another reason to replay it in an attempt to achieve the maximum possible. 无论是“可见”还是“隐藏”成就,在声明时都必须赋予数值化的点数。成就获取难度越高,其点数相对于较低成就就应设置得越高。游戏的成就页面会向玩家展示可能获得的总点数以及当前已获得的点数总值,这为他们重玩游戏以追求最高成就提供了又一个动力。

The maximum points value you can assign to any single Achievement is 100, while the total value of all Achievements in the game must not exceed 1,000 points. It is probably wise to stay well clear of either maximum for a first publication of your game - as well as far below the maximum of 100 actual Achievements in total - thereby granting you the freedom to add more and / or better-value ones in a possible future update. 你可以为任何单一成就分配的最大点数值为 100,而游戏中所有成就的总价值不得超过 1000 点。对于首次发布游戏而言,明智的做法可能是远低于这两个上限——同时也远低于实际成就总数 100 个的上限——这样你就能在未来的更新中自由添加更多和/或更高价值的成就。

Declaring Achievements 声明成就

Achievements are declared in the Startup file - immediately below all *create commands - in the following format. 成就声明位于启动文件中——紧接在所有 *create 命令之后——格式如下。

Note that the codename is used to reference the Achievement within your actual scripting when using the *achieve command, and so must be unique (in much the same way as variable names). Unlike the actual 'title' text on the end, however, the 'codename' is never displayed to the player. 请注意,代号用于在脚本中使用 *achieve 命令时引用该成就,因此必须是唯一的(与变量名的要求类似)。然而,与末尾的实际“标题”文本不同,“代号”永远不会向玩家显示。

For a 'visible' Achievement, a declaration might look something like this: 对于一个“可见”成就,声明可能如下所示:

At the very start of the game this would be listed on the Achievements page as follows: 在游戏开始时,它将在成就页面上如下列出:

Lost Souls: Investigate what became of the missing villagers. (10 points)

After the Achievement has been earned in-game, its listing on the Achievements page would change to: 在游戏中获得该成就后,其在成就页面上的列表将变为:

Lost Souls: Discovered the fate of the hapless villagers. (10 points)

A 'hidden' Achievement declaration is slightly different. As it is not actually listed on the Achievements page prior to being earned, it does not require a pre-earned description. Use the place-holder 'hidden' for that line instead, as follows: “隐藏”成就的声明略有不同。由于在获得之前它实际上不会列在成就页面上,因此不需要预获得描述。请在该行使用占位符“hidden”,如下所示:

Once a 'hidden' Achievement has been earned in-game, its entry will finally appear on the Achievements page as follows: 一旦在游戏中获得一个“隐藏”成就,其条目最终会如下所示出现在成就页面:

The Grand Grimoire: Recovered the Lost Mysteries of the Ancients. (25 points)

Awarding Achievements 授予成就

Achievements properly declared in the Startup file may be awarded to the player within your actual game scripting at any point in the story, using the *achievearrow-up-right command to simply reference the Achievement codename, as follows 在启动文件中正确定义的成就,可以在故事的任何节点通过游戏脚本授予玩家,只需使用 *achieve 命令并引用成就代码名即可,如下所示:

Awarding the same achievement multiple times 多次授予同一成就

There is no limit to the number of times that - or points in the story where - any single Achievement may be awarded, and each such occasion will trigger a pop-up banner announcement to that effect. From a technical point of view, however, it should be noted that Achievements are more or less the same as simple true / false booleans, meaning that once it has been set true (i.e. has been earned) it remains true with each successive *achieve referencing that same codename. By the same token, neither do multiple awards of the same Achievement add any additional 'points value' to the current total earned. 单个成就的授予次数或故事授予节点没有限制,每次授予都会触发相应的弹出横幅通知。然而,从技术角度来看,需要注意的是,成就本质上与简单的真/假布尔值类似,这意味着一旦被设为真(即已获得),之后每次引用相同代码名的 *achieve 命令都会保持其为真状态。同理,同一成就的多次授予也不会为当前获得的总“点数价值”增加任何额外数值。

Repeated Achievements 重复成就

It is, however possible to allow a particular Achievement to potentially be in multiple places, but for only the very first such occasion to actually trigger a pop-up banner announcement. This is possible using the related *check_achievementsarrow-up-right command. 不过,可以通过相关 *check_achievements 命令实现:允许某个特定成就可能在多个位置达成,但仅在实际首次达成时触发弹出横幅公告。

This command effectively creates a new true / false boolean *temp variable for each Achievement declared in the game, with the variable name - 该命令会为游戏中声明的每个成就有效创建一个新的真/假布尔型 *temp 变量,变量名为——

  • where 'codename' will be the actual codename originally declared for that Achievement, e.g.

  • 其中 'codename' 将指代该成就最初声明的实际代号,例如:

(etc.)

The *temp variables for Earned Achievements will contain a value of 'true', while not-yet-earned Achievements will of course be 'false', thereby allowing the actual *achieve command to be made conditional on the latter state, as follows: 已获得的成就对应的 *temp 变量将包含 'true' 值,而尚未获得的成就自然为 'false' 值,这使得实际的 *achieve 命令可以根据后一种状态进行条件判断,如下所示:

In this example, the Achievement with the codename 'mystery1' will be visibly awarded to the player at this point in the game only if that Achievement has not already been earned. 在此示例中,只有当玩家尚未获得代号为 'mystery1' 的成就时,该成就才会在游戏的这一节点被显式授予玩家。

Do bear in mind that *check_achievements creates (or overwrites) temporary variables - which are of course lost from memory with each new scene file load - so that command must be repeated before each and every conditional check of this nature, exactly as shown above, to avoid a 'non-existent variable name' error. 请务必注意,*check_achievements 命令会创建(或覆盖)临时变量——这些变量在每次加载新场景文件时自然都会从内存中丢失——因此必须如上所示,在每次进行此类条件判断前重复执行该命令,以避免出现“不存在的变量名”错误。

Advanced Achievements 高级成就

Using *check_achievements we can also award new Achievements based entirely on Achievements already earned. These are known as Meta Achievements and are awarded as follows: 通过使用 *check_achievements 命令,我们还可以完全基于已获得的成就来授予新成就。这些被称为元成就,其授予方式如下:

In this example, the Achievement with the codename 'code4' will be awarded to the player at this point in the game if the Achievements 'code1', 'code2' and 'code3' have all been earned by the player at any point in the past, during this or any previous playthrough. 在此示例中,如果玩家在游戏过程中或之前的任何一次游戏历程中已获得 "code1"、"code2" 和 "code3" 这三个成就,那么代号为 "code4" 的成就将在游戏进行到此处时授予玩家。

Achievements Persistence 成就持久性

Achievements are mostly persistent (i.e. they are not actually reset with each subsequent playthrough), so as well as being congratulatory they are also a good way to encourage more replays of your game in an attempt to earn that "perfect score" - if not simply in an effort to discover what those remaining 'hidden' Achievements actually are... 成就大多是持久性的(即它们实际上不会在每次后续游戏时重置),因此除了表示祝贺外,它们也是鼓励玩家多次重玩游戏以尝试获得“完美分数”的好方法——即便仅仅是为了发现那些尚未解锁的“隐藏”成就究竟是什么……

The persistence of ChoiceScript Achievements does however depend on the method used by the player to play your game. On iOS devices and Steam, Apple and Valve - respectively - provide official mechanisms for storing permanent Achievements, and ChoiceScript takes full advantage of this. On Android devices and the Chrome Web Store, however, earned Achievements will persist only so long as the app remains installed. And on the web, of course, it's very easy to lose any and all game Achievements (e.g. if the player wipes all cookies and local storage). Overall, however, it's definitely worth taking the time to include Achievements in your Choice Game as the pros definitely outweigh the cons... in the opinion of most players, at least. 然而,ChoiceScript 成就的持久性确实取决于玩家游玩游戏的方式。在 iOS 设备和 Steam 平台上,苹果和 Valve 分别提供了存储永久成就的官方机制,ChoiceScript 充分利用了这一点。但在 Android 设备和 Chrome Web Store 上,已获得的成就仅在应用保持安装期间才会保留。至于网页端,丢失所有游戏成就则非常容易(例如玩家清除所有 Cookie 和本地存储时)。不过总体而言,为你的 Choice 游戏投入时间添加成就绝对是值得的——至少在大多数玩家看来,其利远大于弊。

Notes 注意事项

Some would say it's probably best to avoid awarding Achievements at the mere drop of a hat - as has become all too common in some sectors of the games industry but is increasingly frowned upon by actual players. 有人认为最好避免轻易授予成就——尽管这在游戏行业的某些领域已司空见惯,但实际玩家对此越来越反感。

The argument goes that Achievements should feel like they've been deservedly earned, otherwise their regularity and very ordinariness simply devalues the impact of genuine Achievements for the player when those tougher feats are actually managed. For a Choice Game especially, consider aiming for quality over quantity, not just a thoughtful balance where relative points values are concerned. Where possible, you might try eliciting the opinion of beta testers to help achieve and maintain a fair balance - and maybe also ask them to keep an eye out for places in the story where they felt they fully deserved a pat on the back but where none was actually forthcoming! 有人认为,成就应当让人感觉是应得的奖励,否则其频繁出现和平庸性质只会贬低玩家真正达成艰难壮举时获得的成就感。对于选择类游戏而言,尤其应当注重质量而非数量,不仅要考虑相对分值设置的合理平衡。在可能的情况下,可以尝试征求测试玩家的意见来帮助实现并维持公平的平衡——或许还可以请他们特别留意故事中那些他们认为完全值得嘉奖却未获得相应认可的环节!

It's also worth bearing in mind that some players actually intensely dislike the very notion of Achievements in interactive fiction, feeling that a pop-up Achievement award can sometimes spoil their immersion in the role they're playing in the story, essentially making the whole thing too "gamey" for their particular tastes. For this reason, it might be worth considering making all of your actual *achieve awards conditional on yet another true / false boolean, and simply ask the player their personal preference - and *setarrow-up-right that boolean accordingly - at the very start of the game. 同样值得记住的是,有些玩家其实非常反感互动小说中的成就系统,他们认为突然弹出的成就奖励有时会破坏他们在故事中所扮演角色的沉浸感,本质上会让整个体验变得过于“游戏化”,不符合他们的个人口味。因此,或许值得考虑将所有的实际 *achieve 奖励设置为基于另一个真/假布尔值,并在游戏一开始就询问玩家的个人偏好——并 *set 相应地设置该布尔值。