Repository navigation
OnlyWorlds Unity SDK 0.50.0
A world's element names found in prose, and four refusals that keep a reader and a writer honest: a number the reader
cannot hold is refused by name, a file is one JSON value and nothing after it, a share carries only what the folder
reader serves as one element with no mark, and a save never writes over a file it could not read or a byte that is
not UTF-8. The package is now on OpenUPM (openupm add com.onlyworlds.sdk). A minor release because it adds public
API (below).
Added
-
OWNameFinder.For(elements, nameCase): a world's element names found in prose. It reads the names once and
answers anOWNameFinder<T>, whoseFind(text)lists everyOWNameFound<T>(Start,End, andElement, the
object that was passed in) in order, none overlapping, so a game or a tool can mark the words that are elements (a
hover, a suggestion, a link a person chooses to make). It finds and never writes. Elements are JSON rows
(IEnumerable<JToken>, by their stringidandname), typed models (OWElement, byIdandName), or any
kind of the caller's own with anidOf.nameCasemust be given,OWNameCase.ExactorOWNameCase.Folded
(simple case folding, Unicode 15.1): the enum has no zero value, sodefault(OWNameCase)is refused. The optional
namesgives the names an element is found by, by default its name alone; a name is a string or a JSON string,
anything else is passed over. The rule: a whole name only, where the character on each side is not a letter, a
combining mark, a decimal digit or an underscore in any script (soKira'sholds the name andKirandoes not);
trimmed of White_Space, three code points at least; the longest whole name where several start at one place; a
name two elements share is never answered, nor anything inside it; nothing inside an address (what
OWAddress.FindLinksfinds) or a Markdown link[label](target).StartandEndare C# string indexes, UTF-16
code units, as the TypeScript SDK counts them (the Python package counts code points). Limits: text is compared as
written, with no Unicode normalisation; a space in a name matches that one space; what counts as a letter is the
runtime's own table, as in the other two packages, and Unity 6's Mono reads Unicode 11.0's, so beside a letter
assigned since then (one of CJK Extension G, say) a name is whole here and not for the TypeScript SDK on a current
Node. The work for one text is at most its length times the longest name's length, with no pattern that
backtracks. The TypeScript SDK's cases file (name-finder.cases.json, 47 cases, each answer written by hand) is
vendored byte for byte and its sha256 held; every case is replayed, its seven hostile or large texts timed, and ten
inputs the cases are silent on are held to the TypeScript SDK's own answers. Parity with the TypeScript SDK
4.194.0. -
OWNumberOutOfRangeException, a number the reader cannot hold refused by name. An integer of more than 380
characters (its sign counted) or a number past the largest double (1e400,-1e400) is valid JSON that Newtonsoft
cannot read, and every reader of the SDK threw its bareJsonReaderExceptionfor it. Each now throws this one
refusal instead:Reasonisnumber_out_of_range(OWJson.NumberOutOfRange, the word the TypeScript SDK's and the
Python package's folder readers skip such a file by),Pathis the number's place in the text, Newtonsoft's
exception is the inner one. It is aJsonReaderException, so a caller that catchesJsonExceptionstill catches it.
Where the line falls is unchanged: 380 characters still read, exactly, and write back with the same bytes. The
three packages do not draw it in one place (the TypeScript SDK refuses any number a double cannot hold, an integer
from 309 digits; the Python package an integer of more than 4,300 digits), and no profile says yet. -
OWWorldArchivePackOptions.UnreadLeftOut, andunreadLeftOutas the last parameter of
OWWorldArchive.Pack(worldFolder, archivePath, keepApiBlock, includePrivateRecords, includeHidden, hiddenLeftOut, unreadLeftOut): on a share, the paths inside the world (code point order) of the files underelements/and
spatial/left out because the folder reader would not serve them as one element (below), counted apart from
HiddenLeftOut. Nothing is added on a copy. The new parameter is optional, so every existing call compiles as
before.
Changed
- A share carries under
elements/andspatial/only an element the folder reader serves with no mark (folder
spec §4.8, a file whose mark cannot be read, and its rulings of 2026-11-23). WithincludeHidden: false, "read as
an element" is the folder reader's own verdict, by its own code over the bytes decoded strictly as UTF-8: a file is
carried only whenOWFolderReaderwould serve it as an element and it carries no mark; a served element with the
mark or a doubt is left out whole and named inHiddenLeftOut; every other file under the two folders is left out
whole and named inUnreadLeftOut. That is a file the writer could not read, whatever the reason (not UTF-8, not
JSON, not one JSON value, cut short, nested past the parser's depth of 64, a number the parser refuses such as
1e400or 4,301 digits, an array or a string, an object with no id or an empty one); a file no reader serves as an
element (anotes.txtin a type folder, a.jsonin a folder deeper than a type folder, such as a hidden element's
file moved intoold/by hand, a file directly inelements/orspatial/, a folder underelements/that is not
one of the 22 types or underspatial/not one ofmap,pin,zone,marker, a name spelled.JSON, which the
archive reader never serves); and both files of an id two files hold, in one folder or acrosselements/and
spatial/, since the share cannot say which file's mark is the element's (a hidden first file with a visible twin
would hand the twin on). Before, such files were carried byte for byte:{"id": "c-2", "hidden": true,cut short
travelled; a hidden element in a file holding one byte that is not UTF-8 reached the receiver, whose reader decodes
leniently, as a hidden element; a hidden element's visible twin, or its oldspatial/copy, reached it as that
element, visible; and{"hidden": true}with no id was counted hidden.media/andrecords/are not read for it
and travel as before. A copy (includeHiddenon, the default) is unchanged: it carries every such file byte for
byte. - A JSON text is one value and nothing after it but whitespace, at every reader (folder spec §4.8).
{"id": "c-9"} {"hidden": true}was read by the folder and.owworldreaders, aworld.json, an export file, the
cache'sIsKnownOfandOWFolderWriter.Parseas the visible elementc-9, the content after the first object
ignored, while the serializer refused it; and every reader passed over a comment, U+00A0 or a NUL after the value.
Now every reader refuses anything after the value but JSON's four whitespace characters (space, tab, LF, CR),
saying where it starts: a folder or an.owworldskips the file, itsReasonstartingcontent after the JSON valuewith the line and position, and serves the rest; aworld.jsonor an export file is refused with those
words; a response throws the refusal naming the request (GET /character/<id>: Not one JSON value: …); the cache's
IsKnownOfthrows it rather than answerfalse, andAll<T>passes over that element and logs it; a records
manifest with content after it refuses a share, as an unreadable one does. The refusal is aJsonReaderException,
so a caller that catchesJsonExceptionstill catches it. A text that ends in newlines or other whitespace reads as
before.
Fixed
- A folder or an
.owworldskips such a file by its name. The other elements were always served, but the skip's
Reasonsaidunparseable JSONfor a file that is JSON; it now startsnumber_out_of_rangeand says where the
number sits. Aworld.jsonor a portal export file holding one is refused by that name, no longer as "not valid
JSON". - A response holding such a number throws the refusal, naming the request (
GET /character/: A number too large …), where it threw Newtonsoft's exception with no word of which call. A page is one JSON text, so the whole page
fails, as before. An error response holding one still becomes anOWApiErrorof its status, itsCodeunread. OWSync.BaselineAsyncleaves the cache as it was when its walk throws. It emptied the cache before walking, and
a walk that failed part way (a dropped connection, a cancel, a page holding such a number) left it empty at cursor 0;
only the resets put it back. Now the baseline puts back its elements, cursor, cursor token, epoch and sync time
itself, and anIncrementalAsyncwith no cursor (which runs one) does too.OWWorldCache.IsKnownOfthrows the refusal for a raw body holding such a number, where it answeredfalse
and so read a stub it could not read as a whole element.- A save never writes U+FFFD over bytes that are not UTF-8. The folder reader decodes an element file leniently,
so a file holding one Latin-1 byte reads with U+FFFD in its place, andOWFolderWriter.WriteorWriteElementof
that body wroteEF BF BDover the person's byte, even when nothing was edited. Now a body read from such a file and
not edited is left as it is on disk (its path returned, nothing written), and an edited one is refused with an
OWFolderFormatExceptionnaming the file; a refusedWritewrites none of its batch. Files that are UTF-8 are
written as before. - A save never writes over a file it could not read (folder spec §4.8). A new element whose short filename was
already a file the writer could not read as an element (cut short, not JSON, not one JSON value, a number it cannot
hold, an array,{"hidden": true}with no id) was written over it, since such a file was taken as holding no id and
so as free. Now the element takes the next name, the full-id form the writer collision rule gives, and the file
keeps its bytes; the next write of that element finds it there. When the full-id form is such a file too, nothing is
written andWriteElementorWritethrows anOWFolderFormatExceptionnaming the file (a refusedWritewrites
none of its batch). A neighbour's id is read as the folder reader reads it, so an id shaped like a date is compared
as written.