theRAPTLab / gsgo

GEM-STEP Foundation repo migrated from GitLab June 2023
1 stars 1 forks source link

Help GUI Wizard Full Prototype - [merged] #710

Closed benloh closed 1 year ago

benloh commented 2 years ago

Merges dev-bl/feature-help -> dev-next

Branch: dev-bl/feature-help

Includes if !269

This is a first pass implementation of the full help system for the GUI Wizard scripting. It's rather complex and will need to be refined. It includes:

  1. Line Help -- (always visible) General non-keyword-specific help for editing a single line (e.g. "Click 'Save Line' to save changes to this line."). This is essentially static text that is the same for all keywords.
  2. Selected Keyword Help -- (always visible) General help for the whole line based on the selected keyword (e.g. "[prop] lets you set or modify a property value").
  3. Syntax Help -- (hover) Informational help that explains the gemscript role of each slot (e.g. hover over "method" to see "a method is an action that can be performed by a property or features"). Displayed when you hover over the slot label above each slot.
  4. Empty Slot Help -- (hover) Instructional help that explains what you should do to fill the empty slot. Once you select a symbol or input a value, the help changes to Filed Slot Help.
  5. Filled Slot Help -- (hover) Informational help that explains what the currently selected choice is (e.g. hover over the "prop" in the "keyword" slot to see "[prop] lets you set or modify a property value"). Displayed when you hover over the filled slot.
  6. Slot Instructions Help -- (always visible) General instructions for the currently selected slot (e.g. "Choose a property"). This is generally the same as #4, but always visible once you select the slot.
  7. General Choices Help Title -- (always visible) Informational short label that explains the choices, e.g. "SELECT A COMMAND KEYWORD".
  8. General Choices Help -- (always visible) Informational help that explains the gemscript role of each slot. Same as #3.
  9. Specific Choice Help -- (hover) Informational help that explains the option (e.g. when selecting a keyword, hover over "prop" to see "[prop] lets you set or modify a property value"). The intent is to help you decide which option to choose. Same as #5 when the choices match the current selection.
  10. Selected Choice Help -- (always visible) Info help that explains what the currently selected choice is (same content as #5 and #9) (e.g. "Sets the property to a value" for "setTo").

Much of the help content is actually the same, and what is displayed at any particular spot is dependent on what information is available and not available. Sometimes one type of help will override another type of help (e.g. for a slot, the selected slow item help is displayed by priority, if it is not available, we display the general slot help).

screenshot_1101

Other Changes

Testing

Fully QAing/Testing the Help system is a rather daunting task. Ideally, you would review:

Things to watch out for:

Review the big picture:


[for the wiki]

HELP AUTHORING

These are the Types of help fields that have been defined (not all are currently in use):

[These types have also been defined in the yaml file, but they are not currently being used. For simplicity's sake, we might leave them out.

]

Where help appears:

Location Visibility Type Description Example
1 Line Help static info General non-keyword-specific help for editing a single line. This is essentially static text that is the same for all keywords. Click 'Save Line' to save changes to this line
2 Selected Keyword Help static info General help for the whole line based on the selected keyword [prop] lets you set or modify a property value
3 Syntax Help hover info Informational help that explains the gemscript role of each slot. Displayed when you hover over the slot label above each slot. a method is an action that can be performed by a property or features
4 Empty Slot Help hover input Instructional help that explains what you should do to fill the empty slot. Once you select a symbol or input a value, the help changes to Filed Slot Help. Select a method (action). Available methods are determined by the property type or feature selected.
5 Filled Slot Help hover info Informational help that explains what the currently selected choice is. Displayed when you hover over the filled slot. [prop] lets you set or modify a property value
6 Slot Instructions Help static input General instructions for the currently selected slot. This is generally the same as #4, but always visible once you select the slot. Choose a property
7 General Choices Help Title static info Informational short label that explains the choices. SELECT A COMMAND KEYWORD
8 General Choices Help hover info Informational help that explains the gemscript role of each slot. Same as #3 a method is an action that can be performed by a property or features
9 Specific Choice Help static info Informational help that explains the option. The intent is to help you decide which option to choose. Same as #5 when the choices match the current selection. [prop] lets you set or modify a property value
10 Selected Choice Help static info Informational help that explains what the currently selected choice is (same content as #5 and #9). [prop] lets you set or modify a property value

NOTES:

Help Content Files

Most of the help text content are in files called codex-*.yaml:

In addition, help for GVAR methods are defined in each GVAR method:

Most of the current help text is rough still and needs a refinement pass. The easiest way to find where the help text is defined is simply to search for the text.

In general, you can safely modify the info: and input: fields. Watch for quotes and encoding issues.

Modifying any other parameters may break the indexing and require modifications across the system. So only do so with care.

Mapping GEMSCRIPT Symbols to Help Content

AKA "How do I figure out which help a particular symbol is using?"

Help is keyed off of two pieces of information that have been defined for each symbol: gsName and gsType.

Where are gsName and gsType defined? It depends on the symbol.

Feature Prop Subtype Syntax Label Help

Feature props often require specific entries that are not obvious. The generic string/number/boolean help is not sufficient for helping students figure out what they need to enter.

For example, for featProp movementType setTo 'wander' the argument for the featprop needs to be a specific identifier string (e.g. 'wander', 'stop', 'jitter', etc.). In order to provide this help, we need to set multiple things.

1. Set a custom subtype for the gvar method in the feature definition.

In the feature definition, change the generic GVAR symbol maping to a custom value.

For example, for movementType, we would:

a. Edit feat-movement.ts

b. Change this:

static Symbols: TSymbolData = {
    props: {
      movementType: SM_String.Symbols,

...to this...

static Symbols: TSymbolData = {
    props: {
      movementType: SM_String.SymbolizeCustom({
        setTo: ['movementTypeString:string']
      }),

What we're doing here is replacing the standard string setTo method gsName:gsType specification of string:string with a custom subtype movementTypeString:string. Now when the help system tries to look up help for the argument, instead of using the standard string help, it'll try to find a movementTypeStringhelp.

NOTE that we called it movementTypeSTRING to differentiate it from the movementType property name.

NOTE you have to do this for every method you want to replace. Though in general setTo is probably sufficient.

2. Add a custom subtype to codex-features.yaml

For every custom subtype you define, you need to add a corresponding entry in the codex-features.yaml file.

Look for the # prop args section for each feature.

IMPORTANT: The entry needs to come under the feature the subtype belongs to. e.g. if you add movementType under Physics:by accident, it will not be found.

For example:

Movement:
  info: 'Add different ways to move or be controlled'
  ...
  # Movement prop args
  movementTypeString:
    info: '"movementTypeString" value determines how a character will move'
    input: 'Valid movementTypes are: "stop", "wander", "edgeToEdge", "setLocation", "goLocation", "jitter"'

Help Authoring Incomplete Items

While most of the Help infrastructure is now in place, there are still some key places that need to be fleshed out.

See also !261 & !265 for original Merge Request.

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 2 commits

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 5 commits

Compare with previous version

benloh commented 2 years ago

@jdanish I feel like we now have basic coverage of help. I think it's worth testing the heck out of this and for you or your team to modify the codex-*.yaml files. As you do so, keep in mind each help element might have three pieces of information:

  1. info is the specific description/definition of the item -- it will always display if it's present
  2. input is essentially the instructions for the item -- it will display if info is not available
  3. name will display if both info and input are unavailable

As you edit the help text, it's VERY important that you test how it displays:

  1. As you enter a new line (with empty slots)
  2. As you edit an existing line (with filled slots)

Because of the complexity of all the interactions there are going to be edge conditions (specific combinations of selections/scriptlines) that are probably going to be broken and difficult to find.

benloh commented 2 years ago

In GitLab by @jdanish on Aug 24, 2022, 15:48

added 1 commit

Compare with previous version

benloh commented 2 years ago

In GitLab by @jdanish on Aug 24, 2022, 19:31

added 1 commit

Compare with previous version

benloh commented 2 years ago

In GitLab by @jdanish on Aug 25, 2022, 11:25

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 6 commits

Compare with previous version

benloh commented 2 years ago

Some major rewrites to simplify the help. Also, moved all the method help out of the codex and reading them directly from the validation tokens instead. In English, what this means is the help for prop methods and feature methods are defined in:

In the static Symbols definition at the bottom of each file.

Also, we've introduced a hack where feature props gsNames can be looked up as codex-type info. e.g. The Touches prop touchTypes can have its own help. More on this with the full documentation.

benloh commented 2 years ago

added 4 commits

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 6 commits

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

In GitLab by @jdanish on Sep 3, 2022, 07:26

@benloh I noticed you marked ifExpr as deprecated but I thought the intention was to leave it as an expert function until version 2.0 so that we can handle cases such as if agent.propx > agent.propy. Still a few of those that I'd hate to have to find workarounds for if wee don't have to?

benloh commented 2 years ago

Sorry, poor word choice. ifExpr still works, and is still usable via the wizard. The change was to move it to the "Expert" keywords.

benloh commented 2 years ago

added 3 commits

Compare with previous version

benloh commented 2 years ago

@jdanish Well that took forever, but I think the merge request shows how complicated it is...feel free to start playing with the system. It's more comprehensive than the previous version. But it also means there's a LOT more testing needed for every possible combination. I'm sure there are still things slipping through the cracks.

My plans is to review this with Sri tomorrow. We may very well end up with another round of refactoring.

Also, I will get the if branch merged into here (that will also be complicated).

benloh commented 2 years ago

added 17 commits

Compare with previous version

benloh commented 2 years ago

@jdanish NOTE that the help text currently has some debugging info attached to it to help us figure out the source of the help (e.g. "GSTYPE.info"). The intent would be to remove these before accepting the merge request and/or turning them into DBG mode only reports.

benloh commented 2 years ago

marked this merge request as draft

benloh commented 2 years ago

In GitLab by @jdanish on Sep 3, 2022, 15:50

Awesome, thanks!!

benloh commented 2 years ago

BUG: ObjRefSelector seems to mysteriously add "LOAD" as blueprint choice.

benloh commented 2 years ago

BUG: Inserting a reference to a wrong agent (e.g. in "Fish" enter a reference to "Algae" in a featProp call) will cause Main sim to stop with error.

(Not strictly a help issue)

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 2 commits

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

marked the checklist item BUG: ObjRefSelector seems to mysteriously add "LOAD" as blueprint choice. as completed

benloh commented 2 years ago

BUG: popup label for "x" is one letter wide. Where did the min-width go?

benloh commented 2 years ago

Not able to reproduce anymore?

benloh commented 2 years ago

marked the checklist item BUG: Inserting a reference to a wrong agent (e.g. in "Fish" enter a reference to "Algae" in a featProp call) will cause Main sim to stop with error. as completed

benloh commented 2 years ago

marked the checklist item BUG: popup label for "x" is one letter wide. Where did the min-width go? as completed

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

added 1 commit

Compare with previous version

benloh commented 2 years ago

marked this merge request as ready

benloh commented 2 years ago

Merging. Major infrastructure is in place and most bugs addressed.
Remaining help content work will take place in new branches.

benloh commented 2 years ago

mentioned in commit 6730d547e055db4591062edd09da48c2fbfa7be5