Giter Site home page Giter Site logo

kyperbelt / yarngdx Goto Github PK

View Code? Open in Web Editor NEW
28.0 3.0 3.0 583 KB

YarnGdx is a Libgdx Library for interactive dialogue in games! This is a port of [YarnSpinner](https://github.com/thesecretlab/YarnSpinner) by thesecretlab

License: MIT License

Java 95.87% Shell 0.15% ANTLR 3.97%
yarn libgdx-library libgdx twine game dialogue-systems dialogue-manager

yarngdx's Introduction

alt text

YarnGdx is a Libgdx library for creating interactive dialogue in games! YarnGdx is able to parse programs made with Yarn. Yarn's minimal syntax is very similar to that of Twine, so Twine users should be able to transition easily. If you don't know Twine or Yarn yet dont worry - It is super easy to learn the basics and get started. The Yarn language is used in several well known games like Night In The Woods.

There is a simple code example in the tests package that can be run like a normal libgdx project.

Java CI with Gradle


Getting Started

  • First thing you want figure out is how you want to include YarnGdx in your project.
  • Even though you could use any old text editor to create your dialogue files - I would recommend heading over and downloading the latest build of the Yarn Editor. It is very easy to understand and offers some useful features like color coding and node tags.
  • Once you are all set up and are ready to get started implementing Yarn Dialogues into your game go ahead to the YarnGDX Wiki for an in depth guide.

yarngdx's People

Contributors

fadookie avatar jojomickymack avatar kyperbelt 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

Watchers

 avatar  avatar  avatar

yarngdx's Issues

integer is marked as unused

@SuppressWarnings("unused")

One way to tackle this would be to try{...} catch{...} outside the for loop rather than inside of it - declaring the incrementing variable inside the try block.

We need the info in catch to properly log debugs, so my idea is that a reference of the last investigated node should be stored in the method scope

android target - Lexer$TokeniserException - Lexer.java can't parse tokens following '<<' or '[[' -

Kudos on this fantastic library - when compiling for a desktop target, it works great! I created my own experiment, which is kind of a refactored version of the included demo.

https://github.com/jojomickymack/yarn_dialog01

When compiling for an android target, however, anything that's not a text token will throw a 'TokeniserException' when the json or yarn.txt file is getting loaded. I reduced a script to starting with

<<if visited("Gravedigger") is true>>

(Gravedigger is the name of the node) and this is what I see

desktop

trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
5
regex \G\<\<
match?
true
rule.type
BeginCommand
line:1 col:2 text:<<
trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
8
regex \Gif(?!\w)
match?
true
rule.type
If
line:1 col:4 text:if

android

trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
5
regex \G\<\<
match?
true
I/System.out: rule.type
BeginCommand
line:1 col:2 text:<<
trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
8
regex \Gif(?!\w)
match?
false

The regex '\Gif(?!\w)' which is supposed to match the 'if' following the '<<' is not matching like it does when loading successfully on desktop. I believe that this is because of android's java 1.6 vs the desktop's java 1.8 and support for the regex '\G' flag - I see when I remove it from the 'addTransition' method, I'm able to match the if and everything else in the expression, but run into other issues.

I think this issue is fixable using a different system of parsing the line without relying on the \G (global - this means that the match is supposed to immediately follow the previous match - i.e - only when 'if' follows '<<' should this be true).

I'll play around with it - I'd really like to see this work for android as well as desktop since this is such a cool way of handling dialog trees.

Colors Issue

Hi guys, i really love this project, i have a little question (i dont know if is a bug or is my fault)

i notice if i apply colors to the text when create the file on https://yarnspinnertool.github.io/YarnEditor/

when read the file in my app then this crash. i am missing something?

(sorry my bad engish)

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.