Ashley
I am experimenting with using multiple windows at the same time for the same game. In my first test I used a local server and WebSock to make the different windows communicate. But I think it might be interesting to get the same result without using external tools.
WebSockets can be replaced with LocalStorage: all instances of WebView share the same memory (and they always refer to app.localhost/index.html)
I have two problems left
- the ability to launch a new instance of WebView directly from WebView itself. If there will be a specific plugin for WebView I would like an action like "run file" of the NWjs plugin
- 2. the possibility of launching WebView with arguments readable by Construct 3
My idea is a command (PowerShell or command line) like MyProject.exe x=5 y=6
In C3 I would likethe opportunity to have something similar to:
const x = runtime.WebView.arguments[0];
const y = runtime.WebView.arguments[0];
// or
const { x, y} = runtime.WebView.arguments;
const result = x + y;
runtime.objects.Text.text = result;
This would allow you to open multiple windows at the same time, each on a different layer portion always using the same source file.
In my experiment I used Deno to launch WebView 4 times, each time from a different folder.
await Deno.run({ cmd: ["./webview/cameras/A/MultiWindows.exe"] });
await Deno.run({ cmd: ["./webview/cameras/B/MultiWindows.exe"] });
await Deno.run({ cmd: ["./webview/cameras/C/MultiWindows.exe"] });
await Deno.run({ cmd: ["./webview/cameras/D/MultiWindows.exe"] });
It would be nice if it were possible to avoid such code perhaps using an event similar to:
// pseudocode
Run File: "MultiWindows.exe layout=A"
Run File: "MultiWindows.exe layout=B"
Run File: "MultiWindows.exe layout=C"
Run File: "MultiWindows.exe layout=D"
//or
Run File: "MultiWindows.exe A"
Run File: "MultiWindows.exe B"
Run File: "MultiWindows.exe C"
Run File: "MultiWindows.exe D"
// pseudocode
On start: go to layout WebView.arguments.layout
// or
On start: go to layout WebView.arguments[0]
I believe that the combination of these two things can allow the creation of projects like this without having to go through other applications.
Obviously, I don't know if it's technically feasible, if it's worth the effort, if it's in your priorities.