Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Commit

Permalink
Updates the README
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloa committed Jan 28, 2018
1 parent a69efa0 commit 592067c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local.properties

# IDE and Build environment settings
*.iml
Minor.idea/
.idea/
.gradle/
build/
out/
Expand Down
69 changes: 25 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

[![CI Status](http://img.shields.io/travis/micabytes/mica-ink.svg?style=flat)](https://travis-ci.org/micabytes/mica-ink)

[mica-ink](http://github.com/micabytes/mica-ink) is a Kotlin implementation of Inkle Studios (@inkle) scripting language [ink](http://github.com/inkle/ink) for
writing interactive narrative. It was developed in order to have an ink alternative for Java, and is used as the narrative engine in my various projects; most
notable [Pirates and Traders 2](https://play.google.com/store/apps/details?id=com.micabytes.pirates2).
[mica-ink](http://github.com/micabytes/mica-ink) is a Kotlin (originally Java) implementation of Inkle Studios (@inkle) scripting language [ink](http://github.com/inkle/ink)
for writing interactive narrative. It was developed in order to have an ink alternative for Java, and is used as the narrative engine in my various projects;
most notable [Pirates and Traders 2](https://play.google.com/store/apps/details?id=com.micabytes.pirates2). StoryBytes is a simple open-source sample
application (for [Desktop](https://github.com/micabytes/storybytes-desktop)) that uses the mica-ink engine and runs compatible ink scripts.

Currently, this reimplements Part 1 to Part 3 of the [Ink documentation](https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md), with the following omissions (that I know of - other things may be missing that I've simply forgotten to get implemented):
Currently, this reimplements Part 1 to Part 3 of the [Ink documentation](https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md), with the
following omissions (that I know of - probably things added to Ink since I made this list as well):

- Conditions on choices (as well as the choice header) cannot be multi-line.
- evaluation of conditions has some limitations (not only supported as a function, evaluation of 'and' and 'or' is space sensitive).
Expand All @@ -23,15 +25,19 @@ And of course, the key elements of Part 4 are missing:
- Tunnels
- Threads

Most of the examples in the implemented section of the documentation are used as tests, with a few additional test cases grabbed from the 'ink/Tests' where appropriate.
Most of the examples in the implemented section of the documentation are used as tests, with a few additional test cases grabbed from the 'ink/Tests' where
appropriate.

This implementation does one thing that the standard Ink implementation does not, which is to allow the use of native Java/Kotlin objects as values, and permit the calling of methods on those objects.
This implementation does one thing that the standard Ink implementation does not, which is to allow the use of native Java/Kotlin objects as values, and permit
the calling of methods on those objects.

## Roadmap

I would like to use this implementation in some of my own (Java-based) games, so I plan to continue working on this as and when circumstances allow,
I use this implementation in my own Kotlin-based games, so I plan to continue working on the game engine as and when I require new features. I would like to
stay compatible with the main ink functionality, but my focus is on making games rather than developing a game engine; as such, it is never going to be a
priority for me to stay 100% in sync with the Ink engine.

- Extend the engine until it implements all (or nearly all) of the standard Ink features.
- Extend the engine until it implements all (or nearly all) of the standard Ink features; particularly threads and tunnels.
- Add more comprehensive testing to code. Many corner cases are not covered adequately yet.
- Clean up and refactor the code. Especially the variable/expression evaluator needs some work.

Expand All @@ -42,11 +48,12 @@ Feel free to send in push requests to fix bugs or add features. All help is appr
If you would like to contribute, the following would be useful:

- Missing functionality, obviously.
- [Ink's JSON RunTime format](https://github.com/inkle/ink/blob/master/Documentation/ink_JSON_runtime_format.md)
- Reading of [Ink's JSON RunTime format](https://github.com/inkle/ink/blob/master/Documentation/ink_JSON_runtime_format.md)

## Building

The library is a combined runtime and parser, instead of splitting it up. Neither JSON output or input is supported at present; only plain Ink. Since the JSON format is not really stable yet, I probably won't be spending much time looking at that for now.
The library is a combined runtime and parser, instead of splitting it up. Neither JSON output or input is supported at present; only plain Ink. In general, I
am not particularly interested in the JSON format, and probably won't ever implement it, given that I don't really see a compelling need for it.

To build the jar:
```
Expand All @@ -62,44 +69,18 @@ Use the `bat` file on windows.

## Usage

To use the library:
To use the library, include the jitpack.io repository and the dependency to the latest release:

```
import com.micabytes.ink.Story;
```

Loading a vMap file:
```
Story vMap = InkParser.parse(inputStream, new StoryContainer());
```

Working through children line by line:
```
while (vMap.hasNext()) {
String line = vMap.next();
...
}
```
repositories {
maven { url 'https://jitpack.io' }
}
Working through all children children line by line up to the next stop:
```
List<String> lines = vMap.nextAll();
```

To get the available choices:
```
for (int i=0; i<vMap.getChoiceSize(); i++) {
Choice choice = vMap.getChoice(i);
String choiceText = choice.getChoiceText(vMap);
...
}
```

To select a choice:
```
vMap.choose(0)
dependencies {
compile 'com.github.micabytes:mica-ink:0.1.0'
}
```

Note: Unfortunately, the existing ink interface doesn't work with standard Java (`continue` is a reserved keyword), so jInk will end up with a different interface. The above interface may change, as I clean up code and/or get a better idea.
For usage in general, check the StoryViewModel in the [sample StoryBytes app](https://github.com/micabytes/storybytes-desktop).


0 comments on commit 592067c

Please sign in to comment.