inkle / ink
- воскресенье, 13 марта 2016 г. в 16:08:18
C#
inkle's open source scripting language for writing interactive narrative.
Ink is inkle's scripting language for writing interactive narrative, both for text-centric games as well as more graphical games that contain highly branching stories. It's designed to be easy to learn, but with powerful enough features to allow an advanced level of structuring.
Here's a taster from the tutorial.
- I looked at Monsieur Fogg
* ... and I could contain myself no longer.
'What is the purpose of our journey, Monsieur?'
'A wager,' he replied.
* * 'A wager!'[] I returned.
He nodded.
* * * 'But surely that is foolishness!'
* * * 'A most serious matter then!'
- - - He nodded again.
* * * 'But can we win?'
'That is what we will endeavour to find out,' he answered.
* * * 'A modest wager, I trust?'
'Twenty thousand pounds,' he replied, quite flatly.
* * * I asked nothing further of him then[.], and after a final, polite cough, he offered nothing more to me. <>
* * 'Ah[.'],' I replied, uncertain what I thought.
- - After that, <>
* ... but I said nothing[] and <>
- we passed the day in silence.
- -> END
Broadly, the engine is made up of two components:
.ink
extension, and produces a .json
file. It can also be used in play mode, for testing a story on the command line.Warning: ink is in alpha. Features may change, bugs may be encountered. We're yet to complete a project with this major rewrite of ink - it's a work in progress!
Warning: Since the engine is in alpha, it hasn't been neatly packaged up for non-technical writers. Right now, you need basic knowledge of the command line to try out your stories.
myStory.ink
, containing the text Hello, world!
.On the command line, run the following:
Mac: ./inklecate -p myStory.ink
Windows: inklecate.exe -p myStory.ink
The -p
option uses play mode so that you can see the result immediately.
Optionally, you may want to install inklecate at a system level (e.g. on Mac copy to /usr/local/bin
).
Follow the tutorial: Writing with Ink.
We currently have a C# runtime DLL ink-engine.dll
, for example for use in Unity, and you'll also need the included Newtonsoft.Json.dll
. It has a very simple API, so is easy integrate. It's not designed as an end-to-end narrative game engine. Rather, it's designed to be flexible, so that it can slot into your own game and UI with ease. Here's a taster, and is all you need to get started:
using Ink.Runtime;
// 1) Load story
_story = Story.CreateWithJson(sourceJsonString);
// 2) Game content, line by line
while(_story.canContinue)
Debug.Log(story.Continue());
// 3) Display story.currentChoices list, allow player to choose one
Debug.Log(_story.currentChoices[0].choiceText);
_story.ChooseChoiceIndex(0);
// 4) Back to 2
...
For information on getting started, see Running Your Ink.
Windows:
Mac:
ink.sln
.inklecate/bin/Release
(or x86
), while the runtime engine DLL will be built in ink-engine-dll/bin/Release/ink-engine.dll
Note that the executable requires Mono on Mac or .NET on Windows. On Windows this isn't a problem since it ships with .NET, but on Mac you need Xamarin for Mono. The build_release.command
file in the repo is a Mac script that will bundle up both Mac and Windows versions, and the Mac version will be bundled with the Mono runtime so that the end user doesn't need Xamarin/Mono installed.
We’d of course appreciate any bug fixes you might find! Also see the roadmap below for future planned features and optimisations that you might be able to help out with.
Create a GitHub issue if you want to start a discussion or request a feature. (Is this the best place for community discussion? We're pretty new to open source!) Or if you want to get in touch with us directly, email us.
We also have a public room in HipChat where you may find someone to help you:
In terms of related projects outside of the scope of this repo, we'd love to see the following since we don't have time to do it ourselves right now, and we think it would substantially help the community:
Internally we've been thinking about the following. We can't guarantee we'll implement them any time soon though, or indeed at all!
.ink
files and output .json
files, so that the size and arrangement is predictable and controllable.See the architectural overview documentation for information about the pipeline of the ink engine, and a birds-eye view of the project's code structure.
ink is released under the MIT license. Although we don't require attribution, we'd love to know if you decide to use ink a project! Let us know on Twitter or by email.
Newtonsoft's Json.NET is included, and also has the MIT License.
Copyright (c) 2016 inkle Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.