Wednesday, April 30, 2014

GuildCraft Dev Diary: Part II

In part I of this dev diary I mentioned that my immediate goal was to build a character generator. Some of the features I wanted to include were:
  1. Choices made are immediately reflected on a standard character sheet
  2. As the player is making choices, relevant information about them is shown
  3. Ability to make and change character choices in any order
A character sheet is a complicated UI control. It presents a lot of information about a character and contains dozens of dynamic labels and buttons depending on the player's character choices.

Since I knew I might need to swap the GUI framework I was using for a more advanced one later, I decided to adopt a modified version of a Model-View-Controller pattern that would allow me to test and prototype but also ensure a change to my View or Controller would not force changes to my Model.

Modified MVC Pattern

The "messy" API calls for the Unity engine and the DaikonForge library are contained within the Controller classes. Event-binding was set up between the view and the controller in the Unity editor.

  • DaikonForge tip: Stick to event-driven property bindings for updating UI elements. Polling is expensive and expression bindings are both slow and difficult to work with.

To show the player relevant information about their choices, I hooked the name of UI objects the player clicks on into the Codex I built. The Codex has not been populated yet, so the standard "missing entry" text is shown in the screenshots below.

To complete the final feature of the character creator, I developed a strategy that involved defining a series of choices. Each choice object had to implement an interface that:

  • Prepare a model object for the GUI controller
  • Process choice prerequisites
  • Can instruct the character object to add the choice's effect
  • Can instruct the character object to remove the choice's effect AND all sub-choice effects

[Standard disclaimer about images used for educational purposes. No artwork is final.]
Choices can be made and changed in any order.

For usability, only choices for the current level-up are presented.

Most games restrict multiclassing to 4 classes at most. With this approach, there is no limit.

Although I never set a timeline, my first milestone has been met. Level 20 characters can be built and all of the appropriate choices and sub-choices are part of the character builder. Many of the passive abilities also reflect their changes on the character sheet, but none of the spells do anything other than sit in a spell book right now.

The next step will be developing character actions - attacks, spells, reactions, etc. Similar to the character sheet, I believe I can improve upon existing games in one specific area. Most RPGs use either a World of WarCraft-style action bar that you drag abilities onto, or offer a radial menu similar to Temple of Elemental Evil or Blackguards. A future dev diary will elaborate on those systems and how I plan to supersede them.


No comments:

Post a Comment