Game: Chess vs zombie-checkers (Prolog WASM + Phaser)

Hello

I made a little web game, that was fun, mostly.

game.pl (36.0 KB)

Play on itch.io

Just a random notes

Distribution

On the desktop compiling and loading the program state works fine.

//swipl --stand-alone=false -o state.zip -c game.pl
char* argv[3] = { (char*)"libswipl.dll", (char*)"-x", (char*)"state.zip" };
if (PL_initialise(3, argv)) {
	InitStatus = 1;
	Instance = new Myswipl;
} else {
	InitStatus = -1;
}

Have no luck booting on WASM.

	var options = {
		arguments: ["-x", "state.zip" ],
		locateFile: (file) => '/' + file,
	};
	SWIPL(options).then((module) => {
		Module = module;
		Prolog = Module.prolog;
		game = new Phaser.Game(config);
	});

swipl-nodata.js

Still don’t understand what it is.

Electron packaging

Not really using this one because the size is huge.

Electron enforce file:// prefix, so i managed to get my app working only after patching the wasm.pl.
Maybe there is another workaround.

diff --git a/library/wasm.pl b/library/wasm.pl
index 429bca9b7..1bb9f9885 100644
--- a/library/wasm.pl
+++ b/library/wasm.pl
@@ -502,6 +502,7 @@ http(size, URL, Size) :-
     ).
 :- endif.
 
+:- register_iri_scheme(file,  http, []).
 :- register_iri_scheme(http,  http, []).
 :- register_iri_scheme(https, http, []).
2 Likes