I’m integrating my existing pitch detection code for a friend into gdevelop. This JS code depends on a webassembly module.
Given that gdevelop can run both in browser and in electron I assume that there is an API or standard for loading data blobs from extension code? Where should I put the wasm file to be accessable from the extension?
this questions sound like something to post under:
You could do a node script something along the lines of
Read binary file
Compress it into an UInt8Array with require(“pako”).deflate
Write The UInt8Array as string (use something like let string = "new UInt8Array(["; for(let i of array) string += i + ","; string = string.slice(-1) + "])";) into a file
Execute the script, copy it, then in your JS event, do somwthing like
// Insert pako.min.js file contents here to import pako
const compressedFile = /* Paste the generated array here */;
const rawFile = pako.inflate(compressedFile);
// Do your thing with the binary file, e.g. WebAssembly.instantiate(rawFile, ...
It looks like it would be useful for me for quick prototyping of ideas.
@arthuro555 every dev questions i ask and ever dev questions i seen ask point to the gui way of doing things when a questions about the code way of doing something. And you right, github repo isn’t a place i just found out to ask simple questions related to more in depth. @Silver-Streak pointed me to the discord than lock my self answer post, but the discord offer no channel to even type in. So I guess you right that this is the best place to ask any questions as it is more accessible than the other two. And yes you right @Robehickman , gdevelop is well designed abstraction although i wish it utilities more advance features like events trigger by other means than in the game loop, and if else would be nice with the conditions to make one conditions two conditions and async than would be nice to wait for something to finish… but as you said, it can be extended if you really want those features.
I agree about events being triggered by different things. However gdevelop’s events are not ‘events’ in the sense the term is used in other programming languages. They are really just a long string of if statements called from top to bottom once per game loop. Personally I wouldn’t have called them ‘events’ at all if it was my project. In most languages an event is a message - a piece of data - which can be acted on.
Given that what it is is already a long string of if statements, adding an ‘else’ clause should be easy, and I agree would be a good idea.