Plan for converting special screens to slices

From OHRRPGCE-Wiki
Jump to: navigation, search

Right now, special screens such as Items, Status, Spells, Equipment, Order/Team, Save/Load, Shop Buy/Sell, and perhaps some others I am forgetting are hard-coded into the engine with no way to customize them. I want to switch them over to slice collections.

One lovely thing about this plan is that it would make it extremely easy for people to import/export/share slice collections for different types of special screens. Even people who are intimidated by the complexity of the slice editor could still benefit from this feature.

In this plan I use the term "Planks" for slice collections that are used to construct menus and lists. I was calling them "Tiles" at first, but that already means something else in this engine, and Planks is the only reasonably short reasonably descriptive name I can think of that isn't already being used to describe something else

  • Add support to the slice editor to specify colors as references to User-Interface Colors (done)
  • Make it possible to give the slice editor a list of built-in slice lookup codes that it is allowed to use. They will be shown in a nice menu when you pick lookup codes. (done)
  • Add support for some new string-insert codes. These would only be valid for specific special screens, and the slice editor should have an optional way of showing a list of the valid ones for the slice collection that you are currently editing a string in. (done)
    • Use codes like ${HP} ${MAXHP} ${HERONAME}
    • I need to handle the fact that the results of some of these codes will change while you are viewing the special screen, so they may need to be re-applied arbitrarily. It might pay to keep both the original and the rendered versions of the text strings hanging around so that the insert codes can be re-rendered repeatedly. (done)
      • It would probably be better and simpler if all text slices (on special screens or otherwise) re-process their embed codes (of any sort) every time they're drawn, as that would be quite useful. (currently this is possible, although in the existing implementations I am only re-applying embed codes when something changes)
  • Add ScrollSlice. This would be a container slice with the special property that if its children are larger than it, it will display a scrollbar. (done)
    • It would have clipping turned on by default.
    • It would have an option for how many grandchildren deep it cares to check the positions of. This could keep it efficient for the numerous situations where just checking immediate children, or just checking grandchildren is sufficient even though those grandchildren might have huge numbers of child slices. (done)
  • Add a SelectSlice. This would be a container slice that manages the visibility of its children. It would have a special integer property that indicates which child is selected. Only the selected child will be visible, and all unselected children will be hidden. (done)
    • This would make it easy to create compound slices that visually represent buttons, with children for Normal/Selected/Disabled states.
    • Standard states could be: 0=Normal, 1=Selected, 2=Disabled, 3=SelectedDisabled, 4=Special, 5=SelectedSpecial
    • When you are in the slice editor, focusing the menu cursor on a SelectSlice's child should make it selected one, making it easy to edit the different states. (done)
  • Add PanelSlice. This container has two children, and it can manage their sizes in terms of percentage or fixed pixels. (done)
    • Needed to re-create some existing layouts in a way that will work with screen resizing.
  • Add EndToEndSlice. This container arranges visible non-filling children end-to-end. It will make some layouts easier.
    • An EndToEndSlice could be useful in any place in this plan where a GridSlice is mentioned.
    • Perhaps use the term "Layout" slice to collectively refer to Grids and EndToEnds?
    • I like the name EndToEndSlice, but is it terrible?
  • Add the ability to make slices fill only horizontally or only vertically. (done)
  • Add features for slices being used as part of menu items. Do this with a lookup code, rather than hardcoding the features into each slice type
    • Text Slice should have an option to magically use MenuItem/Selected/Disabled/SelectedDisabled/Special/SpecialSelected (done)
      • Right now Special/SpecialSelected are only ever used in the items menu to indicate items that cannot be dropped. They are a re-use of other colors. I need to split them off into new uilook() entries (done, default behavior can be overridden by callbacks when needed)
    • Rectangle Slice should have the option to magically use a different background color depending on the needs of the menu (typically highlight A/B) (done)
  • Add a horizontal and vertical padding options for Grid Slice
  • Add an option to the slice editor to override the file extension used for import/export of slice collections, so that exported screens could be easily grouped by the lookup codes and text insert codes that they make use of. (not sure if this is still a good idea)
  • Make the slice editor aware of special lookup codes needed for particular collection types so it won't prevent import of collections with those codes. (done)
  • Make the slice editor able to revert a slice collection to its default
  • Add a tool that can convert a slice collection into FreeBasic code, so it can be used to embed the default layouts for each screen. (done)
  • For each built-in screen
    • Create a slice collection that matches the current layout (see details below)
    • Re-write the built-in screen to load the slice collection, and to use lookup codes for finding the elements which should be filled with special data
    • Add a menu in custom that lets the game author change the slice collection for that screen.
  • After everything else is done, ad plotscripting interfaces for the new slice features
    • uilook colors
    • ScrollSlice
    • SelectSlice
    • PanelSlice
    • EndToEndSlice

This plan does not make any of these screens scriptable, nor does it add mouse support to any of these screens, but it makes doing both those tasks easier later on.

Items screen[edit]

Items Main[edit]

  • A grid which would contain planks of item information. (done)
  • SelectSlices that represent the exit, sort, and trash buttons (done)
  • text insert codes for the global constants for exit, sort and trash labels (done)
  • text insert codes for information about the currently selected item, such as its description (done)

Item Plank[edit]

A slice that represents the information about a single item.

  • A switchslice who's selection indications whether this item is focused in the menu
  • Text insert codes for the item's name and other info such as ${ITEM} ${DESC} (done)
  • A lookup codes for slices that are hidden in under certain conditions
    • show when selected
    • show when use or move
  • In the future it would be relatively easy to add item sprites

Status screen[edit]

Status Main[edit]

  • Strings insert codes for name, level, experience, money, HP, MP, LMP, stats (done)
    • For example ${HP} ${HPMAX} ${LMP1} ${LMP2} ${LMP3} ${ATKCUR} ${AIMMAX} (done)
  • String insert codes for the labels for each of these. (done)
    • For example ${HPLABEL} ${EXPNEXTLABEL} ${ATKLABEL} ${AIMLABEL}
  • A portrait sprite (done)
  • A walkabout sprite (done)
  • A battle sprite (done)
  • A selectslice used to toggle between status pages (for example, stats on page 1, and elemental strengths/weaknesses on page 2) (done)
  • A text insert code for showing elemental strengths and weaknesses (done)
  • A lookup code for marking a Grid or EndToEnd to contain the list of stats (done)
  • A lookup code to mark slices that should be hidden if the hero has no MP (done)
  • A lookup code to mark slices that should be hidden if the hero has no LMP (done)
  • A lookup code to mark slices that should be hidden if the hero has reached max level (done)

Status Stat Plank[edit]

The slice marked to contain these will be filled with copies of this Plank formatted for each visible stat other than HP and MP

  • Text insert codes for the current stat, ${LABEL} ${CUR} ${MAX} ${BASE} (done)

All of these are optional. For example, if there is no insert code for ${MONEY} in any strings, then money will not be displayed. If there is no sprite with the lookup code for portrait sprite, then portrait sprite will not be displayed. Also, for disabled stats, both the stat and the label insert codes will be blanked.

Spells screen[edit]

Spell screen main[edit]

  • A grid for the list of spell lists
  • A grid for the list of spells
  • A switchslice for the cancel button to exit the spell list
  • A switchslice that toggles depending on whether you have selected a spell list
  • Text insert codes for hero name, MP stats (should everything available in the Status screen be available here too?)
  • Text insert codes for the currently selected spell's description and costs

Spell list Plank[edit]

  • Text insert code for a spell list name
  • If we ever wanted to add support for icons for spell lists, this would be the place to do it.

Spell Plank[edit]

These would be inserted into the grid in the main spell screen

  • Text insert codes for the currently selected spell's name, description and costs

Equip screen[edit]

Equip Main[edit]

  • A grid for the list of current equipment
  • A grid for the list of available equipment for a selected slot
  • A switchslice representing the button for exiting
  • A switchslice representing the button for emptying all slots
  • Text insert codes for hero name and all stats (all the same stuff that is available for Status?)
  • Text insert codes for the relative changes to a stat that would occur if a piece of potential equipment is going to be equipped
  • Text insert code for the currently selected item's description
  • Text insert code for the name of the currently selected equipment slot
  • A SelectSlice that toggles based on whether you have focused the list of slots or the list of available equipment

Equip slot Plank[edit]

  • Text Insert codes for information about the equipped item
  • Text insert code for the name of the currently selected equipment slot

Order/Team Screen[edit]

  • Text Insert codes for information about the equipable item
  • Text insert codes for the relative changes to a stat that would occur if a piece of potential equipment is going to be equipped

This should be divided into three collections

Order/Team Main Screen[edit]

  • A GridSlice into which the hero info Planks will be inserted representing the current party.
  • A GridSlice into which the hero info Planks will be inserted representing the unlocked reserve party
  • A SwitchSlice that would be used to toggle visibility of slices that should be hidden in Order mode and displayed in Team mode.
  • All the text insert codes and hero sprite codes available in the Status screen, which would apply to the currently selected hero

Order/Team Active Party Plank[edit]

This slice represents the small portion of the screen that displays a single active hero in the order/team menu.

  • All the text insert codes and hero sprite codes available in the Status screen, which would apply to the currently selected hero
  • A SwitchSlice for slices that should only be visible if this hero Plank is currently selected.

Order/Team Reserve Party Plank[edit]

This slice represents the small portion of the screen that displays a single reserve hero in the order/team menu.

  • All the text insert codes and hero sprite codes available in the Status screen, which would apply to the currently selected hero
  • A SwitchSlice for slices that should only be visible if this hero Plank is currently selected.

Hero Picker Screen[edit]

A simpler version of the same structure as the Order/Team menu, except that it would just let you pick heroes, not swap them.

It would also be awesome to add an option to Menus that cause the hero picker to be displayed, inactive underneath a menu. This would make it much easier to implement quick status on the main menu like most RPGs do, and it would merge nicely with the hero picker that is displayed before the Spells, Status, and Equip menus.

Save Screen/Load Screens[edit]

Save and Load would have different slice collections, but they are so similar in structure that I will describe them together. Like the Order/Team/Hero-Picker they would be divided into Planks.

Save/Load Main[edit]

  • A grid that would contain the save slots currently visible on screen (does not have to be 4 slots)
  • SwitchSlices for the Cancel, New Game, and Exit buttons, as appropriate

Save/Load Plank[edit]

A slice collection representing information about a single save slot. It would be inserted into the grid in the main screen.

  • Text insert codes for information about the save slot, such as play time and current map name
  • Text insert codes for information about the party leader (at least a subset of the info available on the Status screen)
  • An optional grid for party hero information

Save/Load Party Hero Plank[edit]

This collection would be inserted into the party hero information grid of a save/load Plank

  • The same subset of Status screen info text insert codes + sprite codes that is supported for the save slot party leader in the parent collection.

Other Special Screens[edit]

The screens describe above are not all of the screens that would benefit from this plan. Others include:

  • Main shop menu
  • Buying stuff
  • Selling stuff
  • Staying at an Inn
  • Spells in battle
  • Items in battle
  • OOB Attack/Cure targeting
  • In-app Purchases