ravensight-playtest 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,8 @@
3
3
  * game reads them, and a start spec (a level, a turn, a named save) handed to
4
4
  * the game. docs/hosted-direct/NATIVE_GPU_PLAN.md section 5 in the platform
5
5
  * repository is the design; this is its local half for `godot_driver`,
6
- * `android_driver` and `ios_driver`.
6
+ * `android_driver`, `ios_driver`, and the desktop drivers on a Mac
7
+ * (`desktop_driver`, `unity_driver`, `unreal_driver`).
7
8
  *
8
9
  * A cloud web playtest has its own save path (`hosted run --save`,
9
10
  * ../hosted/recordedRun.js: one file, browser storage). This file never
@@ -13,6 +14,9 @@
13
14
  * --save-target <where> the root and the path inside it:
14
15
  * godot:user://<path> Godot's user:// folder
15
16
  * unity:persistent://<path> Unity's Application.persistentDataPath
17
+ * unreal:saved://<path> an Unreal game's Saved folder (SaveGames/ inside it)
18
+ * desktop:appdata://<path> Library/Application Support in a desktop run's own home
19
+ * desktop:home://<path> a desktop run's own home folder
16
20
  * a path ending in "/" is a folder, and each file keeps its own name
17
21
  * --start-spec <text> free text up to 1,000 characters, such as {"level":"12"} or turn=150
18
22
  *
@@ -23,8 +27,24 @@
23
27
  * | godot:user:// | a user folder of the run's own, never the developer's | /data/data/<package>/files (a debuggable build, through run-as) | the app's Documents |
24
28
  * | unity:persistent:// | not a local path | /sdcard/Android/data/<package>/files | the app's Documents |
25
29
  *
30
+ * A desktop run on a Mac (./drivers/desktop/runHome.js) that starts from a
31
+ * save, or plays several sessions, starts the game on a folder of the run's
32
+ * own, removed when the run ends; the developer's own saves are never read or
33
+ * written. desktop_driver and unity_driver give the game a home of its own
34
+ * (HOME and CFFIXED_USER_HOME, which macOS reads for the user's Library);
35
+ * unreal_driver gives an Unreal game its own user folder (-userdir), inside
36
+ * its container when it is in the App Sandbox. Under that folder:
37
+ *
38
+ * | Root | desktop_driver | unity_driver | unreal_driver |
39
+ * |---|---|---|---|
40
+ * | desktop:home:// | the home | the home | no |
41
+ * | desktop:appdata:// | Library/Application Support | the same | no |
42
+ * | unity:persistent:// | no | Library/Application Support/<bundle id> | no |
43
+ * | unreal:saved:// | no | no | Saved |
44
+ *
26
45
  * The start spec reaches the game as RAVENSIGHT_PLAYTEST_START (the Godot
27
- * process's environment, the simulator app's environment), as the intent
46
+ * process's environment, a desktop game's environment, the simulator app's
47
+ * environment), as the intent
28
48
  * extra `ravensight_playtest_start` on Android, and on Godot through the
29
49
  * driver addon's `playtest_start` call to a method the game defines,
30
50
  * `_ravensight_playtest_start(spec)`, whose answer (what it loaded) the
@@ -42,14 +62,27 @@ export const MAX_SAVE_TOTAL_BYTES = 256 * 1024 * 1024;
42
62
  export const MAX_SAVE_PATH_CHARS = 200;
43
63
  export const MAX_START_SPEC_CHARS = 1000;
44
64
 
65
+ /** The desktop drivers on a Mac, which start the game on a folder of the run's own (./drivers/desktop/runHome.js). */
66
+ export const DESKTOP_START_DRIVERS = Object.freeze(['desktop_driver', 'unity_driver', 'unreal_driver']);
67
+ /** The desktop drivers that give the game a whole home folder of the run's own. */
68
+ const HOME_DRIVERS = Object.freeze(['desktop_driver', 'unity_driver']);
69
+
45
70
  /** The roots a save may be placed under, and the drivers that can place each. */
46
71
  export const SAVE_ROOTS = Object.freeze({
47
72
  godot_user: { prefix: 'godot:user://', drivers: ['godot_driver', 'android_driver', 'ios_driver'] },
48
- unity_persistent: { prefix: 'unity:persistent://', drivers: ['android_driver', 'ios_driver'] }
73
+ unity_persistent: { prefix: 'unity:persistent://', drivers: ['android_driver', 'ios_driver', 'unity_driver'] },
74
+ unreal_saved: { prefix: 'unreal:saved://', drivers: ['unreal_driver'] },
75
+ desktop_appdata: { prefix: 'desktop:appdata://', drivers: HOME_DRIVERS },
76
+ desktop_home: { prefix: 'desktop:home://', drivers: HOME_DRIVERS }
49
77
  });
50
78
 
51
79
  /** The drivers a run can start from a save or a start spec on. */
52
- export const START_DRIVERS = Object.freeze(['godot_driver', 'android_driver', 'ios_driver']);
80
+ export const START_DRIVERS = Object.freeze(['godot_driver', 'android_driver', 'ios_driver', ...DESKTOP_START_DRIVERS]);
81
+
82
+ /** The save roots a driver can place files under, as the studio writes them. */
83
+ export function rootsFor(driverName) {
84
+ return Object.values(SAVE_ROOTS).filter(root => root.drivers.includes(driverName)).map(root => root.prefix);
85
+ }
53
86
 
54
87
  /** The environment variable, intent extra and addon method names the game reads. */
55
88
  export const START_ENV = 'RAVENSIGHT_PLAYTEST_START';
@@ -99,7 +132,7 @@ export function saveTargetOf(value) {
99
132
  const checked = relativeSavePath(rest, { folder });
100
133
  return checked.error ? { error: checked.error } : { root, path: checked.path, folder };
101
134
  }
102
- return { error: 'Choose --save-target as godot:user://<path> or unity:persistent://<path>.' };
135
+ return { error: `Choose --save-target as ${Object.values(SAVE_ROOTS).map(root => `${root.prefix}<path>`).join(', ')}.` };
103
136
  }
104
137
 
105
138
  /** A save target as the studio wrote it, for lines a person reads. */
@@ -121,17 +154,17 @@ export function startProblems(options = {}, driverName = '') {
121
154
  const asked = saves.length > 0 || options.saveTarget !== undefined || options.startSpec !== undefined;
122
155
  if (!asked) return problems;
123
156
  if (!START_DRIVERS.includes(driverName)) {
124
- problems.push(`--save and --start-spec start a native local run (Godot, an Android emulator or an iOS simulator), and this run uses ${driverName || 'no driver'}. A web build starts at --start, or from a save with hosted run --save.`);
157
+ problems.push(`--save and --start-spec start a native local run (Godot, a desktop game on this Mac, an Android emulator or an iOS simulator), and this run uses ${driverName || 'no driver'}. A web build starts at --start, or from a save with hosted run --save.`);
125
158
  return problems;
126
159
  }
127
160
  if (saves.length > MAX_SAVE_FILES) problems.push(`Give --save at most ${MAX_SAVE_FILES} times.`);
128
- if (saves.length > 0 && options.saveTarget === undefined) problems.push('Say where the game reads the save with --save-target, such as godot:user://saves/slot1.sav or unity:persistent://saves/.');
161
+ if (saves.length > 0 && options.saveTarget === undefined) problems.push(`Say where the game reads the save with --save-target, such as ${rootsFor(driverName).slice(0, 2).map(prefix => `${prefix}saves/`).join(' or ')}.`);
129
162
  if (options.saveTarget !== undefined && saves.length === 0) problems.push('--save-target says where a save goes. Name the file with --save.');
130
163
  if (options.saveTarget !== undefined) {
131
164
  const target = saveTargetOf(options.saveTarget);
132
165
  if (target.error) problems.push(`--save-target: ${target.error}.`);
133
166
  else {
134
- if (!SAVE_ROOTS[target.root].drivers.includes(driverName)) problems.push(`${SAVE_ROOTS[target.root].prefix} is not a folder ${driverName} can reach on this machine. A Godot game run here reads godot:user://.`);
167
+ if (!SAVE_ROOTS[target.root].drivers.includes(driverName)) problems.push(`${SAVE_ROOTS[target.root].prefix} is not a folder ${driverName} can reach on this machine. It places saves under ${rootsFor(driverName).join(' or ')}.`);
135
168
  if (saves.length > 1 && !target.folder) problems.push('With several --save files, --save-target names a folder: end it with /.');
136
169
  }
137
170
  }
@@ -412,4 +445,4 @@ export function withStartLine(markdown, line) {
412
445
  return lines.join('\n');
413
446
  }
414
447
 
415
- export default { startReportLine, withStartLine, relativeSavePath, saveTargetOf, startProblems, resolveStart, startRecord, startLines, briefWithStart, godotDataDir, shellWord, placeSavesInFolder, androidSavePath, placeSavesOnAndroid };
448
+ export default { rootsFor, startReportLine, withStartLine, relativeSavePath, saveTargetOf, startProblems, resolveStart, startRecord, startLines, briefWithStart, godotDataDir, shellWord, placeSavesInFolder, androidSavePath, placeSavesOnAndroid };