Skip to content

Commit

Permalink
Merge pull request #74 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 9997e67 + f88191b commit 6d2349a
Show file tree
Hide file tree
Showing 38 changed files with 515 additions and 1,257 deletions.
1 change: 1 addition & 0 deletions InkpotDemo/Config/DefaultEngine.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ CommandletClass=Class'/Script/UnrealEd.WorldPartitionConvertCommandlet'
bAuthorizeAutomaticWidgetVariableCreation=False
FontDPIPreset=Standard
FontDPI=72
UIScaleRule=ScaleToFit

[/Script/Engine.Engine]
+ActiveGameNameRedirects=(OldGameName="TP_Blank",NewGameName="/Script/InkpotDemo")
Expand Down
Binary file modified InkpotDemo/Content/InkpotDemo/Maps/Demo/Demo.umap
Binary file not shown.
Binary file modified InkpotDemo/Content/InkpotDemo/Stories/Demo.uasset
Binary file not shown.
Binary file modified InkpotDemo/Content/InkpotDemo/Stories/HelloInk.uasset
Binary file not shown.
Binary file modified InkpotDemo/Content/InkpotDemo/UI/WBP_Display.uasset
Binary file not shown.
8 changes: 4 additions & 4 deletions InkpotDemo/Plugins/Inkpot/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 InkpotDemo/Plugins/Inkpot/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
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;
}
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
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
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 6d2349a

Please sign in to comment.