Skip to content

Commit

Permalink
Merge pull request #77 from The-Chinese-Room/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
TCR-Nick authored Mar 17, 2024
2 parents 3b3489b + 37cae9e commit 3a5dfb8
Show file tree
Hide file tree
Showing 27 changed files with 422 additions and 1,251 deletions.
8 changes: 4 additions & 4 deletions Inkpot.uplugin
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"FileVersion": 1,
"Version": 1,
"VersionName": "0.4.20",
"VersionName": "1.00.21",
"FriendlyName": "Inkpot",
"Description": "A container for Ink in Unreal.",
"Category": "Scripting",
"CreatedBy": "The Chinese Room",
"CreatedByURL": "",
"DocsURL": "",
"CreatedByURL": "https://www.thechineseroom.co.uk/",
"DocsURL": "https://github.com/the-chinese-room",
"MarketplaceURL": "",
"SupportURL": "",
"SupportURL": "https://github.com/the-chinese-room",
"EnabledByDefault": false,
"CanContainContent": true,
"IsBetaVersion": false,
Expand Down
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
# Inkpot
**Inkpot** - An container for **Ink** within the Unreal Engine developed by [The Chinese Room](https://www.thechineseroom.co.uk/).<br><br>
This is a plugin for Unreal Engine 5.3 or later.<br>
This is version 0.4.20 of the plugin.</br>
This is version 1.00.21 of the plugin.</br>

Inkpot is a wrapper for the wonderful narrative scripting language **Ink** developed by [Inkle Studios](https://www.inklestudios.com/ink/).<br>

### Changes from 0.4.20
Inkplusplus port now matches version 21 of the Ink runtime engine, Ink version 1.1.1.<br>
.net version updated to 5.0<br>

### Changes from 0.3.20
Settings backed by CVars added.
First pass on auto reload and replay of ink source.
Settings backed by CVars added.<br>
First pass on auto reload and replay of ink source.<br>

### Changes from 0.2.20
JSON serialisation now functional.
JSON serialisation now functional.<br>

### Changes from 0.1.20
External functions are now implemented, along with functional tests.
External functions are now implemented, along with functional tests.<br>

## Requirements
Inkpot works with version 5.3 of Unreal.<br>
Inkpot includes a C++ port of Ink-engine-runtime version 20, which can be found in the InkPlusPlus module.<br>
As Inkpot compiles the Ink source directly on import, it should be compatible with any Ink editor version as long as you only use features from Ink version 20.<br>
Inkpot includes a C++ port of Ink-engine-runtime version 21, which can be found in the InkPlusPlus module.<br>

### .Net framework 3.1
InkleCate requires the .net framework 3.1 which you can download from here.<br>
https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-3.1.32-windows-x64-installer <br>
### .Net framework 5.0
InkleCate requires the .net framework 5.0 which you can download from here.<br>
https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-5.0.17-windows-x64-installer<br>
(Without this you will not be able to import Ink source)<br>

### Visual Studio 2022
Expand All @@ -32,10 +35,10 @@ https://visualstudio.microsoft.com/vs/<br>

## Installing the plugin

Make sure you have **.Net framework 3.1** and **Visual Studio 2022** installed.<br>
Make sure you have **.Net framework 5.0** and **Visual Studio 2022** installed.<br>

In your **project folder**, create a folder named **Plugins** and copy the Inkpot plugin there.<br>
Make sure the inkpot folder is called simply '**Inkpot**'.
Make sure the inkpot folder is called simply '**Inkpot**'.<br>

LIke this:<br>

Expand All @@ -48,8 +51,8 @@ https://github.com/The-Chinese-Room/InkpotDemo

### My Ink files will not import.

* Make sure you have **.Net framework 3.1** installed.<br>
Inkpot uses Inklecate to compile the Ink files and it needs .net 3.1.<br>
* Make sure you have **.Net framework 5.0** installed.<br>
Inkpot uses Inklecate to compile the Ink files and it needs .net 5.0.<br>
Without this the Ink files will not import.<br>

* Inkpot has only been tested as an application plugin and not an engine plugin.<br>
Expand Down Expand Up @@ -77,8 +80,7 @@ InkPlusPlus is the name of the module that contains the C++ port of the Ink Engi
https://github.com/inkle/ink/tree/master/ink-engine-runtime

When porting the code from C# to C++ we came to the conclusion that we should keep the source as close to the original C# as possible to make updates easier. </br>
That said we took the code in the summer of 2021 and have not had a need to update as it works for our purposes. </br>
The Ink version we are running is therefore behind that of the offical Ink release being at Inkversion 20.</br>
This has now been updated to Inkversion 21, Ink v1.1.1. </br>

### Inkpot
A set of wrapper classes for InkPlusPlus to simplify Blueprint coding.<br>
Expand All @@ -94,7 +96,7 @@ There area couple of supporting folders that make up the Inkpot distribution.<br

### TestInkSource
All the Unit tests for Ink.</br>
Currently 175 tests.
Currently 180 tests.

### Third Party
This contains a copy of InkleCate and is used by the script importer to compile the scripts.<br>
Expand Down
10 changes: 10 additions & 0 deletions Source/InkPlusPlus/Private/Ink/Choice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,13 @@ void Ink::FChoice::SetThreadAtGeneration(TSharedPtr<Ink::FThread> InThreadAtGene
{
ThreadAtGeneration = InThreadAtGeneration;
}

const TArray<FString> Ink::FChoice::GetTags() const
{
return Tags;
}

void Ink::FChoice::SetTags(const TArray<FString>& InTags)
{
Tags = InTags;
}
2 changes: 2 additions & 0 deletions Source/InkPlusPlus/Private/Ink/ControlCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ FString Ink::FControlCommand::ToString()
else if (CommandType == ECommandType::ListFromInt) outputString = TEXT("ListFromInt");
else if (CommandType == ECommandType::ListRange) outputString = TEXT("ListRange");
else if (CommandType == ECommandType::ListRandom) outputString = TEXT("ListRandom");
else if (CommandType == ECommandType::BeginTag) outputString = TEXT("BeginTag");
else if (CommandType == ECommandType::EndTag) outputString = TEXT("EndTag");
else if (CommandType == ECommandType::TOTAL_VALUES) outputString = TEXT("TOTAL_VALUES");
else outputString = TEXT("UNKNOWN_TYPE");

Expand Down
28 changes: 27 additions & 1 deletion Source/InkPlusPlus/Private/Ink/InkList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ Ink::FInkList::FInkList()
Ink::FInkList::FInkList(const Ink::FInkList& InOtherInkList)
: TMap<Ink::FInkListItem, int32>(InOtherInkList)
{
_originNames = InOtherInkList.GetOriginNames();
TSharedPtr<TArray<FString>> otherOriginNames = InOtherInkList.GetOriginNames();
if(otherOriginNames.IsValid())
_originNames = MakeShared<TArray<FString>>(*otherOriginNames);

if (InOtherInkList.Origins.IsValid())
Origins = MakeShared<TArray<TSharedPtr<Ink::FListDefinition>>>(*InOtherInkList.Origins);
}
Expand Down Expand Up @@ -249,6 +252,16 @@ Ink::FInkList Ink::FInkList::Intersect(const Ink::FInkList& InOtherList) const
return list;
}

bool Ink::FInkList::HasIntersection(const Ink::FInkList& InOtherList) const
{
for (const TPair<FInkListItem, int32>& itemPair : *this)
{
if (InOtherList.Contains(itemPair.Key))
return true;
}
return false;
}

Ink::FInkList Ink::FInkList::Without(const Ink::FInkList& InListToRemove) const
{
FInkList list = *this;
Expand All @@ -261,6 +274,9 @@ Ink::FInkList Ink::FInkList::Without(const Ink::FInkList& InListToRemove) const

bool Ink::FInkList::ContainsList(const Ink::FInkList& InOtherList) const
{
if( (InOtherList.Num() == 0 ) || Num() == 0 )
return false;

for (const TPair<FInkListItem, int32>& itemPair : InOtherList)
{
if (!Contains(itemPair.Key))
Expand All @@ -269,6 +285,16 @@ bool Ink::FInkList::ContainsList(const Ink::FInkList& InOtherList) const
return true;
}

bool Ink::FInkList::ContainsItem(const FString& InListItemName) const
{
for (const TPair<FInkListItem, int32>& itemPair : *this)
{
if (itemPair.Key.ItemName.Equals(InListItemName))
return true;
}
return false;
}

bool Ink::FInkList::GreaterThan(const Ink::FInkList& InOtherList) const
{
if (TMap::Num() == 0) return false;
Expand Down
9 changes: 6 additions & 3 deletions Source/InkPlusPlus/Private/Ink/JsonSerialisation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ TArray<FString> Ink::FJsonSerialisation::ControlCommandNames = { TEXT("ev"),
TEXT("end"),
TEXT("listInt"),
TEXT("range"),
TEXT("lrnd") };
TEXT("lrnd"),
TEXT("#"),
TEXT("/#")
};


TArray<TSharedPtr<Ink::FObject>> Ink::FJsonSerialisation::JsonArrayToRuntimeObjectList(const TArray<TSharedPtr<FJsonValue>>& InJSONArray, bool InSkipLast)
Expand Down Expand Up @@ -455,7 +458,7 @@ void Ink::FJsonSerialisation::WriteRuntimeObject(TJsonWriter<>* InJSONWriter, TS
return;
}

// Tag
// Legacy Tag
TSharedPtr<Ink::FTag> tag = FObject::DynamicCastTo<Ink::FTag>(InObject);
if (tag.IsValid())
{
Expand Down Expand Up @@ -762,7 +765,7 @@ TSharedPtr<Ink::FObject> Ink::FJsonSerialisation::JsonTokenToRuntimeObject(const
return variableAssignment;
}

// Tag
// Legacy Tag with text
if (Ink::FJsonExtension::TryGetField(TEXT("#"), *objectValue, propertyValue))
return MakeShared<Ink::FTag>(propertyValue->AsString());

Expand Down
Loading

0 comments on commit 3a5dfb8

Please sign in to comment.