Giter Club home page Giter Club logo

merino's Introduction

merino

Merino is a narrative design tool that lets you write Yarn scripts inside the Unity Editor, built on top of Yarn Spinner and Yarn (a Twine-like script language)

NEWS, 21 Dec 2021: with the full release of Yarn Spinner 2.0, I've decided to archive this repo. The editing experience in VS Code has become much better: the official YS extension has node map and basic syntax highlighting + there's a fantastic YS language server that gives you autocomplete and interfaces between Unity C# and Yarn scripts automagically. Thanks to everyone who supported this project! You should now use the VS Code tools instead haha

NEWS, 23 Feb 2020: Merino is currently NOT compatible with recent updates to Yarn Spinner (v1.0+)... I'll update it after Yarn Spinner finalizes a lot of stuff, but in the meantime, it doesn't make sense to try to hit a moving target... sorry! ... see #39

download / install

download and install from the Releases page;

  • "complete" .unitypackage includes Yarn Spinner, "minimal" .unitypackage is just Merino folder

usage / help / how-to / documentation

roadmap

  • edit Yarn node tags
  • line tagging for localization (pending new Yarn Spinner update)
  • playtest logs / replays
  • port writing interface to new Unity UIElements (Summer 2020)

maintainers / core contributors

  • Robert Yang @radiatoryang
  • Adrienne Lombardo @charblar

acknowledgments

see also

license?

MIT

merino's People

Contributors

radiatoryang avatar yangrobertw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

merino's Issues

Handling playtesting with multiple windows

Something that has come up while working on #9 is making it so Merino is not dependent on the main Yarn editor window being open at all times to handle actions such as saving and playtesting.

While I've managed to separate and organize most of the code in question I'm left with the design decision on how/where the playtest window will be displayed if playtesting is started via the nodemap window similar to that of Twine.

image

With the current codebase, the Yarn editor window has to be open for the user to see the playtest toolbar which appears inside of it and pulling up the entire window if the user just wants to check something quickly from the nodemap isn't ideal.

Would we rather include the same playtest toolbar in the nodemap window so it can be shown independent of the Yarn editor window or should shift towards creating a new playtesting EditorWindow which will appear and close after playtesting and can be used by both the Yarn editor and the nodemap window?

Unique IDs across files

I seems like Merino v 0.5 is enforcing unique IDs across yarn files in a folder.
A "-2" is added to a node on the node that has the same name in a different .yarn file.

name refactoring

there are at least two Yarn name types we'd want to be able to refactor:

  • node names
  • variable names

node names in Yarn are very important...

  • nodes link to each other via node names
  • there can be no duplicate node names, validation is needed

however, "never changing your node names" makes it difficult to reorganize a complicated story sometimes

so, it would be great if Merino could automatically change node name references if you rename a node

  • renaming a node that is referenced in another node should prompt a refactoring confirmation pop-up, where merino asks to find and replace all instances of that node name throughout the whole yarn file
    • detecting node references would likely require a regex, to make sure it's referenced within double brackets like [[NodeName]]
  • also perform validation and make sure there are no duplicate node names in the file
  • also include a "disable refactoring pop-up" etc. setting in the Merino Editor Preferences page

and then, do the same for variable names (like $variableName) as well

for now, unassigned / with no timeline on when this will happen, unless everyone starts screaming that they need this much sooner

folder support

implementation in the sidebar should resemble #3 (comment)

image

  • internally, this is what Yarn Spinner already does... all files get loaded into the same network
  • this is pretty important for huge projects with lots of files / scenes / characters
  • for earlier discussion, see previous issue #3

work to do:

  • need to edit MerinoTreeElement to add two new leaf pseudo-types... a "folder" leaf and a "file" leaf
  • add "load folder" button (or let user select multiple folders? need to research Unity Editor's built-in folder picker utility)... sets string[] currentFolders
  • a "load folder(s)" method should traverse currentFolders for all subfolders (recursively) and generate the data for the TreeView, will need to modify GetData as appropriate
  • a "save folder(s)" method should call SaveData for each item
  • should we let users rename folders and files from the sidebar? seems weird to duplicate functionality that's already in the Unity Editor project tab, but I think it's pretty possible

Yarn Command support during playtest

from #36

so this is also part of a bigger UX design problem with how Merino should handle Yarn Commands...

  • if Merino executes Yarn Commands during edit mode, it would likely edit the current scene in harmful ways or just flat-out crash when that command isn't intended to execute outside of play mode
  • but Yarn Command coroutines can be very important for timing dialogue, delays, setting variables or game state, etc.
  • some users might engineer their game to support running in-game Yarn Commands during edit time

some possible design solutions:

  • checkbox on PlaytestWindow ("Execute Commands?")
  • user configurable blacklist / whitelist of Yarn Commands to execute and/or ignore

most of the work will involve grabbing the code from the Yarn Spinner DialogueRunner (https://github.com/thesecretlab/YarnSpinner/blob/master/Unity/Assets/YarnSpinner/Code/DialogueRunner.cs) and porting it to Merino's internal dialogue runner (https://github.com/radiatoryang/merino/blob/master/Assets/Merino/Editor/Scripts/Playtest/MerinoPlaytestWindow.cs)... especially the DispatchCommand functionality

PRs are welcome, but if not, I'll get around to this in a month or so

Adding NewNodes Bug

In the new merino 5.4, I am getting a console error the first time I try to add a new node while selecting a node. I can only add a node while selecting the yarn.txt file in the merino editor. After dragging that under a node, I can then add subsequent nodes under that node.

Attaching a screenshot of my error, which is the second error. (The "Control 5's" error happens a lot and doesn't seem to have any consequence.)

Screen Shot 2019-07-11 at 3 32 24 PM

auto-complete in nodeBody textArea editor

  • will probably rely a lot on this for info / implementation: http://www.clonefactor.com/wordpress/public/1769/
  • we're not using TextField, we're using TextArea... so instead have to use TextEditor.SelectWord to grab the current word being typed, and then compare word distances there
  • user can define a custom list of auto-complete terms too, good for keeping speaker names consistent?
    • or automatically detect speakers? hmm
  • wish list: use reflection to automatically detect all YarnCommands in code base? is that possible?

NodeMap existing files- Links only represent parent relationships, not order

For the new NodeMap (which works great btw), for existing files, the links only represent parent/child relationships between nodes, not order of nodes or what nodes really link to each other.

For example I have many nodes that go to other nodes [[likethis]], and the nodemap does not show connections between them.

make more operations undo-able

to get undo support working, Merino uses a secret temporary ScriptableObject (MerinoTreeData serializedTreeData) so that it can use Undo.RecordObject() with it... but I think I don't quite understand the undo system well enough to fix various bugs / extend the functionality

Merino also keeps its own stack of undo snapshots, so that it can compare those snapshots to Unity's undo stack, diff strings, and move the keyboard caret cursor back to the undo point (see MerinoEditorWindow.OnUndo())

we still need undo support for:

  • drag and drop in TreeView... reordering tree (maybe hook into OnTreeChanged()?)
  • AddNewNode()
  • DeleteNodes() (this is tricky because I also don't understand the undo system too well, and I suspect you also have to revert the currentFiles and fileToNodeID dictionary as well... should we store this data in serializedTreeData somehow?)

I suspect there's probably some much more elegant way to do all of this, instead of manually recording undo snapshots everywhere in all these different methods... again, help would be appreciated from someone who understands Unity's undo system better, and can explain more about how to handle all this

text box drift / dynamic whitespace horizontal scroll

PROBLEM:

  • text area dynamically scrolls horizontally to accommodate extra whitespace without starting a new line, which is bad because it breaks the syntax highlighting and causes a weird ghosting / drifting effect on the text (the syntax highlighting label has no way of knowing the text area is secretly scrolling horizontally)

TO REPRODUCE:

  • when editing a node in the main Merino editor window, just type a bunch of spaces past the right-edge of the text area box; the text will scroll horizontally to accommodate all the whitespace without starting a new line
  • or sometimes, when exiting playmode, this happens for some reason

STATUS:

  • can't fix this, the behavior is built into Unity Editor's IMGUI TextArea with no way to change the behavior?
  • might be able to access some extra options on the TextEditor via reflection, but I doubt it'll help
  • this is mostly just an annoyance though, doesn't seriously harm files or functionality
  • I feel like this didn't happen back in Unity 2017... what happened, did something change?

WORKAROUND FOR NOW

  • to get the text box back to normal, move your keyboard cursor / caret back to the left
  • OR avoid using a lot of a whitespace

ROADMAP:

  • in 2020, explore porting the main text editor to the new UIElements system, which hopefully has much better text editing support than all the hacks I've been doing here

Tab size in the text editor

When I hit tab on the text editor in Merino, it gives me a tab size of 16 spaces, which is obviously an absolutely ridiculous amount of space. Ideally I'd want this to be configurable like most other text editors (4 is my preference), is there some easy way to change this?

See Invisible Characters

Unfortunately I've found that one misplaced space can mess up multiple options when presenting shortcut options (->). Merino should have the ability to show invisible characters much like other text editors.

Empty yarn.txt files not loaded with folder

When loading a folder into Merino, yarn files with no nodes in them are not loaded and need to be loaded one by one.

I'm on Windows in Unity 2018.3.4f1 and Merino v0.5.3

Merino loses reference to folder/files

First of all, thanks for this great tool.

I have Merino open in a tab next to my inspector and sometimes when I switch over to it, it's empty of nodes as if it has lost reference to the folder I opened. It also spits out these two error messages repeatedly:

NullReferenceException: Object reference not set to an instance of an object Merino.MerinoEditorWindow.DrawMainPane (Rect rect) (at Assets/Merino/Editor/MerinoEditorWindow.cs:1476) Merino.MerinoEditorWindow.OnGUI () (at Assets/Merino/Editor/MerinoEditorWindow.cs:1230) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342) UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336) UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition, Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:302) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

and

GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

If I load that folder again, it works for a little while until I get this error again. I'm running Unity 2018.3.0f2. Not sure if I can tell which version of Merino I'm running but I'm pretty sure it's 0.5.0.

Rich Text messes up the view

Having textmesh pro rich text messes up the text box in Merino:
rich_text

text to reproduce: Sally: <size=60%>Hello I am 60% smaller than the rest

Merino don't support Coroutine

I created my yarn file and inside I write a command but the command doesn't call the Ienumerator method who I assigned

double clicking on a *.cs file opens the Merino window

This is just a minor annoyance -- Unity treats *.cs files as text assets so when you double click on a source file it opens Merino. i can submit a PR if you'd like or you can drop the snippet below into the top of MerinoEditorWindow.OnOpenAsset.

string path = AssetDatabase.GetAssetPath(instanceID);
if(Path.GetExtension(path).Equals(".cs"))
{
    return false;
}

Tag support for nodes

It would be really nice to be able to add tags for nodes. Just ran into a situation where I wanted to use YarnSpinner's GetTextForNode to get the raw string from a node. This only works if the node has the tag rawText, so being able to add this without editing the file itself would be cool.

not compatible with Yarn Spinner v1.0+

in case you've missed it, Yarn Spinner is currently in the middle of a big re-architecture / re-engineering phase

at the moment, Merino is currently only compatible with versions before v1.0 unfortunately

once the dust settles and Yarn Spinner solidifies, I'll go back and rewrite the Yarn Spinner integration

(but in the meantime, sorry!)

hierarchy isn't saved

In the Node list (which you can reorder), you can add a node underneath another node. This is purely for organizational purposes, but quite useful. This structure does not get saved into the file.
structure

Node map visualization

Wanted to give this a go as I've worked with/on the original Yarn editor and a couple other in-engine visual dialogue systems.

Will be pushing code to the following branch on my fork. feature/node-map

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.