Skip to content

Commit 63f0fe2

Browse files
committed
[DOCS] Added loading process & glossary
1 parent aeb9ebb commit 63f0fe2

7 files changed

Lines changed: 179 additions & 0 deletions

File tree

Docs/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ If you like our plugins, consider becoming a Patron. It will go a long way in he
66

77
[![patron](assets/patron_small.png)](https://www.patreon.com/bePatron?u=16503983)
88

9+
## Last Version: {{ VersionName }}
10+
**{{ EngineVersion }}** and the previous release are supported.
11+
Save Extension, just like other Piperift plugins, is updated regularly for the 2 most recent unreal engine versions.
12+
913
## Intended Usage
1014

1115
Our plugins are designed to work for very different games and needs, but naturally, they are more focused towards satisfying certain needs.

Docs/_glossary.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
##### Record
2+
Contains a block of serialized information.
3+
Each actor, component or level have an assotiated record containing its saved information.

Docs/_sidebar.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@
1111
- [Configuration](resources/configuration.md)
1212
- [Level Streaming](resources/level-streaming.md)
1313
- [Lifetime Components](resources/lifetime-components.md)
14+
- [Saving Process](resources/saving-process.md)
15+
- [Loading Process](resources/loading-process.md)
1416

1517
- [Credits](credits.md)

Docs/index.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
<body>
1414
<div data-app id="main">Loading...</div>
1515
<div id="app"></div>
16+
17+
<!-- Early Plugins -->
18+
<script src="//cdn.jsdelivr.net/npm/docsify-edit-on-github"></script>
19+
<script src="./src/glossary.js"></script>
20+
1621
<script>
1722
window.$docsify = {
1823
//name: '<img src="assets/logo.png" data-origin="assets/logo.png" class="sidebar-logo" width="50%">',
@@ -45,6 +50,16 @@
4550
auth: ' ',
4651
pre: '',
4752
style: 'text-align: center;'
53+
},
54+
plugins: [
55+
EditOnGithubPlugin.create(
56+
"https://github.com/PipeRift/SaveExtension/blob/main/Docs/",
57+
"https://github.com/PipeRift/SaveExtension/edit/main/Docs/",
58+
"<img class='emoji' src='https://github.githubassets.com/images/icons/emoji/memo.png' alt='memo'> Edit"),
59+
Glossary.create({})
60+
],
61+
mustache: {
62+
data: ['https://raw.githubusercontent.com/PipeRift/SaveExtension/main/SaveExtension.uplugin']
4863
}
4964
}
5065
</script>
@@ -55,11 +70,36 @@
5570
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-csharp.min.js"></script>
5671
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-cpp.min.js"></script>
5772

73+
<link rel="stylesheet" href="unpkg.com/@fortawesome/fontawesome-free/css/fontawesome.css" />
74+
<link rel="stylesheet" href="unpkg.com/@fortawesome/fontawesome-free/css/brands.css" />
75+
<link rel="stylesheet" href="unpkg.com/@fortawesome/fontawesome-free/css/regular.css" />
76+
<link rel="stylesheet" href="unpkg.com/@fortawesome/fontawesome-free/css/solid.css" />
77+
5878
<!-- Plugins -->
5979
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
6080
<script src="//cdn.jsdelivr.net/npm/docsify-pagination/dist/docsify-pagination.min.js"></script>
6181
<script src="//cdn.jsdelivr.net/npm/docsify-tabs"></script>
6282
<script src="//cdn.jsdelivr.net/npm/docsify-copy-code"></script>
6383
<script src="//unpkg.com/docsify-footer-enh/dist/docsify-footer-enh.min.js"></script>
84+
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/front-matter.min.js"></script>
85+
<script src="//cdn.jsdelivr.net/npm/docsify-mustache"></script>
86+
<script src="//unpkg.com/docsify-fontawesome/dist/docsify-fontawesome.min.js"></script>
87+
88+
<script src="//unpkg.com/mermaid/dist/mermaid.js"></script>
89+
<script src="//unpkg.com/docsify-mermaid@latest/dist/docsify-mermaid.js"></script>
90+
<script>
91+
mermaid.initialize({
92+
startOnLoad: true,
93+
securityLevel: 'loose',
94+
theme: 'dark',
95+
themeVariables: {
96+
darkMode: true
97+
},
98+
flowchart:{
99+
htmlLabels:true,
100+
curve:'linear',
101+
},
102+
});
103+
</script>
64104
</body>
65105
</html>

Docs/resources/loading-process.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Loading
2+
Loading is divided in the following stages:
3+
4+
```mermaid
5+
flowchart LR
6+
classDef CEntry stroke:#ea9999;
7+
8+
A[Start]:::CEntry --> B[<b>Notify</b><br>OnLoadBegin]
9+
B --> Load
10+
Load --> C[<b>Notify</b><br>OnLoadFinish]
11+
C --> D[Done]
12+
13+
subgraph Load [ ]
14+
LoadB{Is at map?}:::CEntry;
15+
LoadB -->|No| LoadC[Load Map];
16+
LoadB -->|Yes| LoadD[Bake Filters];
17+
LoadC --> LoadD;
18+
LoadD --> LoadE[Prepare Levels];
19+
LoadE --> LoadF[Deserialize World];
20+
21+
click LoadE "./?id=deserialize-world" "Deserialize World" _blank
22+
end
23+
```
24+
25+
## Bake filters
26+
In this step, all level filters and the general one are baked.
27+
We need this to check which actors to prepare in each level, and how to deserialize.
28+
29+
## Prepare levels
30+
We must ensure actor correctness before loading the data into actors.
31+
That means all actors that were saved have to be restored, and actors that should not exist have to be deleted.
32+
33+
```mermaid
34+
flowchart LR
35+
classDef CEntry stroke:#ea9999;
36+
37+
Start:::CEntry --> PrepareLevel
38+
PrepareLevel -->|Loop all levels| PrepareLevel
39+
PrepareLevel --> Done
40+
41+
subgraph PrepareLevel [Prepare Level]
42+
A[Remove not saved actors]:::CEntry --> B[Spawn missing saved actors];
43+
end
44+
```
45+
46+
## Deserialize World
47+
This is where the magic happens. The system goes through each actor to be loaded and deserializes its data from its record.
48+
```mermaid
49+
flowchart LR
50+
A[Deserialize Game Instance] --> B[Deserialize Actors];
51+
```

Docs/resources/saving-process.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Saving
2+
3+
Saving is divided in multiple stages:
4+
5+
```mermaid
6+
graph LR
7+
A[Start] --> B{Valid Map?};
8+
B -->|Yes| D[Prepare Levels];
9+
B -->|No| C[Load Map];
10+
C --> D;
11+
D --> E[Deserialize];
12+
```

Docs/src/glossary.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
let Glossary = {
2+
create: (config) => {
3+
this.config = config;
4+
5+
let loadGlossary = async () => {
6+
return fetch('_glossary.md')
7+
.then(function(data){
8+
return data.text();
9+
})
10+
.then(function(text){
11+
window.$docsify.terms = {};
12+
13+
let termTexts = text.split('#####');
14+
termTexts.forEach((termText) => {
15+
if (termText.length <= 5) { // If it can't possibly contain a term, skip
16+
return;
17+
}
18+
19+
// Parse the term and its content
20+
let title = termText.split('\n', 1)[0].trim();
21+
let id = title.toLowerCase().replace(' ','-');
22+
let content = termText.substr(termText.indexOf('\n') + 1).trim();
23+
content = content.replace("\r\n\r\n", "\n");
24+
if (content.length > 200) {
25+
content = content.substring(0, 200) + "...";
26+
}
27+
window.$docsify.terms[title] = {
28+
id: id,
29+
content: content
30+
};
31+
});
32+
});
33+
};
34+
35+
let addLinks = (content,next,terms) => {
36+
for (let term in terms) {
37+
console.log(term);
38+
39+
let regex = new RegExp(`\\b${term}\\b`,'ig');
40+
content = content.replace(regex, (match) => {
41+
let termData = terms[term];
42+
return `[${match}*](/_glossary?id=${termData.id} "${termData.content}")`;
43+
});
44+
}
45+
next(content);
46+
};
47+
48+
return (hook, vm) => {
49+
hook.beforeEach(function(content,next)
50+
{
51+
if(window.location.hash.match(/_glossary/g)) {
52+
next(content);
53+
return;
54+
}
55+
56+
if (!window.$docsify.terms) {
57+
// Glossary needs loading before creating the link
58+
loadGlossary().then(() => {
59+
addLinks(content, next, window.$docsify.terms);
60+
})
61+
} else {
62+
addLinks(content, next, window.$docsify.terms);
63+
}
64+
});
65+
};
66+
}
67+
};

0 commit comments

Comments
 (0)