The Broken Hourglass Weekly Update

Planewalker Games’ official website has received its usual weekly update for The Broken Hourglass, this time discussing the code that powers the game’s level paths.

There are a number of engine functions which govern the spending of experience points on character abilities. _attribute_upgrade causes a character to spend XP to purchase points in a valid skill or attribute, while _toggle_trait adds a trait to that character. Supporting functions like _can_toggle_trait (to ensure that there are no unmet prerequisites for the trait) and _attribute_upgrade_cost can help us determine whether the purchases we want to make are possible.

But rather than reinvent the wheel and apply this logic every single time a character levels up, we have a function which performs the skill buying and experience bookkeeping automatically. This makes the creation of a new level path extremely easy by following just a few simple rules.

The function is called _generic_level_path and its arguments are listed below:

_generic_level_path

buyer : thing ->
max_num_of_traits : int ->
trait_percentage : int ->
non_trait_percentage : int ->
trait_list : string list ->
non_trait_list : string * int list ->
unit

While this may look daunting, the arguments are in fact quite simple to understand and all of them are easily identifiable as part of the leveling process.

Share this article:
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments