MV Cross Engine - require ('fs') make game not playable on browser or mobile (html)

Hi there!

I'm making a project on rpg maker mv using the cross engine (chrono engine abs with pixel mouvement) and it works great on desktop but when I tried to deploy and play it on browser via chrome or android I got this error

1675301371646.png



This line seems to be the problem

1675303618781.png



I tried to change it to this to see

var fs = require? ("fs");

And it work I can launch the game but animations of fight like sword are junky and doesnt work well


sounds like it's searching image files on computer so it works on desktop but not on html or android...


Unfortunately the plugin creator Restart isn't active anymore it seems
Any idea how to fix that ? anyone already made a game for browser or mobile using cross engine ?
thanks again
You appear to have a typo where there's a space between the name of the function and the parentheses containing its arguments.

That will make the code think it's a variable, and thus not defined.
Thanks for your answer
I just removed the space in this line
var fs = require("fs");

but it didnt solve the problem

1675311270160.png


this is the complete error log if it can help

1675311707757.png


and link to check it out http://lordstryagain.fr/
Perhaps the developers blocked the fs module or it has been deleted by accident.
I guess you could download it from the net and include it in your game just in case.
Perhaps the developers blocked the fs module or it has been deleted by accident.
I guess you could download it from the net and include it in your game just in case.
what's an fs module ? is it standard ? i searched and found topics about node.js
but kidda lost here
I Googled the error and it looks like the require function is explicitly not supported by browsers.

Since the purpose of it is to load a code module that the plugin proceeds to use, I'm going to go out on a fence and say the plugin is not compatible with browser play.

I Googled the error and it looks like the require function is explicitly not supported by browsers.

Since the purpose of it is to load a code module that the plugin proceeds to use, I'm going to go out on a fence and say the plugin is not compatible with browser play.

they also talk about this https://requirejs.org/docs/download.html
do u think it might be able to make the game playable on browser ?
require('fs') is a module exclusive to node.js. It won't work on android or chrome.

However, unless the nodejs modules specifically need to be used, it would theoretically be possible to make it work using javascript's native loading.
The filesystem module 'fs' allows you to read files synchronously from the local filesystem. Makes loading files easier. Browsers need to download the files from the server so they cannot use that module. The plugin needs to be rewritten for browser support

I have made a plugin where a helper plugin uses 'fs' while the main plugin does not. It can perhaps serve as a useful reference
Apparently, the Plugin's developer was not aware that the RPG Maker's core code already has Data & Storage Managers to read and write files. Maybe you can contact the developer and ask them if they could try to rewrite the plugin to use those managers' functions, or you can try it by yourself.

"fs" stands for "file system." In a browser, an application or game is never allowed to access files - that would be an open door for any malicious code. Imagine that a simple browser game could read and modify your files! And this is why we have those Managers. They will either use your local file system when running as a desktop app or the browser's local storage when running as a browser game. So you, as a developer, don't have to check by yourself which environment you are in right now.
Apparently, the Plugin's developer was not aware that the RPG Maker's core code already has Data & Storage Managers to read and write files. Maybe you can contact the developer and ask them if they could try to rewrite the plugin to use those managers' functions, or you can try it by yourself.

"fs" stands for "file system." In a browser, an application or game is never allowed to access files - that would be an open door for any malicious code. Imagine that a simple browser game could read and modify your files! And this is why we have those Managers. They will either use your local file system when running as a desktop app or the browser's local storage when running as a browser game. So you, as a developer, don't have to check by yourself which environment you are in right now.
That's what I thought, I tried to find a way to make it work but I don't have the necessary coding skill.

I tried to contact Restart the creator of the plugin but I think he isn't active anymore

What's frustrating is I managed to make it work with all my other plugins and game system on desktop and It works well (the altlimit mouvement add a lot to building creation et pathfinding)
So sad to be blocked just by this file access problem.
That's what I thought, I tried to find a way to make it work but I don't have the necessary coding skill.

I tried to contact Restart the creator of the plugin but I think he isn't active anymore

What's frustrating is I managed to make it work with all my other plugins and game system on desktop and It works well (the altlimit mouvement add a lot to building creation et pathfinding)
So sad to be blocked just by this file access problem.
Hi, did you manage to solve the problem?
@gaa , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/cross-engine-require-fs-make-game-not-playable-on-browser-or-mobile-html.154601/