Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Game exported as Html: Error: NetworkError for: AGKPlayer.data

Author
Message
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 16th Jan 2022 14:21 Edited at: 16th Jan 2022 14:29
Hello,

I exported my game as an html file.
When I upload it on itch.io it stays frozen in the "Loading" phase.

When I run it locally in the firefox browser it gives me an error message after the initial Loading phase:

Why is this happening?
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 16th Jan 2022 14:35
for the exported game it could be anything, I found HTML5 exports to be somewhat temperamental, enable dev options in the browser when you run the game this should give some clues to why it hangs.

To run it locally you need to run it from a live server, install xampp or wampp and run it from the htdocs folder, place the HTML5 folder in htdocs and point your browser to 127.0.0.1/HTML5
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 16th Jan 2022 15:15 Edited at: 16th Jan 2022 15:18
is the game set to load files using the method(s) from your other post by chance?

some of the file commands are meant for desktop only; no inclusive list that i know of but when i see commands such as GetRawFolderFileName() (or anything "raw" for that matter) + things like GetFirstFile()/GetNextFile() (which i don't see in your code but including here since i know they have issues), i worry/they won't work in HTML.

i would make a small test app, upload it to itch and see if the file commands being used are the culprit.
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 16th Jan 2022 22:30 Edited at: 16th Jan 2022 22:30
Hi Virtual Nomad!

Thank you for the tip. I used the animation functions I mentioned in the other post yes. And I tried to remove all "Raw" functions from the script (even the "GetRawKey" functions), but it's still not working.
I will just export this game as a simple windows app then.

Is there some documentation as to what functions I can and can not use for html export, where I could read about it?
It would be nice to know how to structure a game to make it run in the browser.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 17th Jan 2022 22:27 Edited at: 17th Jan 2022 22:34
Quote: "documentation as to what functions I can and can not use for html export"

not that i've seen. i've only personally ran into a few issues and, hopefully, kept them in memory things Set/GetClipboard() vs HTML which i added to the AGK2 repo ~2 years ago now and updated to include RPi last may.

another HTML issue is in re: 3d Shadows, which won't work. issue with SetDefaultWrap(), controls vs HTML, etc etc. none of which is documented in the help files as "expections" where, if there is none, we should expect them to work in HTML...
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 20th Jan 2022 11:02 Edited at: 20th Jan 2022 23:04
Yes, I agree that it's better when all functions get automatically translated to HTML without problem.
Okay, I also didn't use those functions, Raspberry or 3D effects, so it's not coming from there.

I tried exporting the snake snacker game that comes with AppGameKit, but it creates the same problem.
So the problem isn't from the script.

Here's the text in the firefox browser, which supports local running, and two screenshots of it:

Quote: "
Invalid URI. Load of media resource failed. SnakeSnacker.html
Successfully compiled asm.js code (total compilation time 3510ms) AGKPlayer.asm.js
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///C:/Users/sebaf/OneDrive/Desktop/test/AGKPlayer.html.mem. (Reason: CORS request not http).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///C:/Users/sebaf/OneDrive/Desktop/test/AGKPlayer.data. (Reason: CORS request not http).

Uncaught Error: NetworkError for: AGKPlayer.data
onerror file:///C:/Users/sebaf/OneDrive/Desktop/test/AGKPlayer.js:1
AGKPlayer.js:1:1913
asm.js type error: Asm.js optimizer disabled because debugger is active
"



Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 4th Feb 2022 13:25 Edited at: 4th Feb 2022 13:38
not sure what your issue is but i've learned to avoid onedrive for projects and i see you're using it.

the same goes for firefox. i had only grief, there. maybe i needed to install some plugin or something but everything html that i do goes to itch.io for testing. ie, snake snacker runs fine there for me.

and, i've never installed xampp or the like which i'm sure works but since whatever i do is going to end up on itch, i doubt i'll go that route (and i like to install as little as possible, where i can).

Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 6th Feb 2022 18:45 Edited at: 6th Feb 2022 18:57
Hi Virtual Nomad,

The issue with onedrive that i had were mainly that I didn't have access and admin rights. After that I didn't have anymore problems within AppGameKit and OneDrive. Also my OneDrive is deactivated.
Just in case, I exported it into a different folder outside OneDrive, with the same results.

So just to be clear, the games I export as HTML do not work on itch.io (see the screenshots above the firefox part).

Neither my own game:
https://lion-in-a-box-games.itch.io/fish-fish-fang-fang

Nor the snake snacker game (exported outside OneDrive before uploading it on itch):
https://lion-in-a-box-games.itch.io/test

the images just don't start loading.

I did a simple export:


And uploaded all the files in the folder on itch:
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 7th Feb 2022 00:25 Edited at: 7th Feb 2022 00:31
Quote: "And uploaded all the files in the folder on itch:"

that's not how it works @ itch.io
  • first, change the name of the html file to index.html
  • then zip all of the files produced on export including the renamed index.html file into a single zip file
  • upload the zip file to your project's page and tick the "this file will be played in the browser" box
  • set viewport and any other details you wish
  • save the project and view

full details here: https://itch.io/docs/creators/html5

as it stands, you are providing all files individually for download (while that's obviously not your intent).

meanwhile, one drive will still cause issues generally related to file syncing, regardless of admin rights; use at your own peril.
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 7th Feb 2022 19:37 Edited at: 7th Feb 2022 19:38
As always, thanks so much for the helpful instructions.

It works fine. Now it loads into itch.io.

But now I have the problem you mentioned before that AppGameKit does not translate expressions like "GetReadPath" etc. into HTML.


Would you happen to know how I can access and loop through all files of a media folder without using the inbuilt folder functions?
Is there a way to find out how many files there are in a path location and get a reference of their names without having to use those functions?

Otherwise I would re-use my previous Animation functions where I loaded each image by giving the name and the number of image frames in the folder. Which is much more time consuming of course.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 8th Feb 2022 01:34 Edited at: 8th Feb 2022 01:37
yup, html needs the absolute path so you need to use/generate actual path/filenames.

otherwise, i don't know of a work-around to the GetFolder/File commands.
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 8th Feb 2022 15:05
I didn't give a lot of background information about the issue, so here for some clarity:

the error message refers to line 465, which is:


the variable 'path' is defined by:


So the reason an error occurs is that the command 'OpenRawFolder' needs an absolute path.
However in html files the command 'GetReadPath' does not generate any path, it just returns an empty string. Hence the error.


As for now I am developing a fully automatic loading function , but which uses string commands instead of folder commands and this way will be compatible with html.
I only have the group loading functions left, I'll post the function code in my previous animation post when finished.
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 9th Feb 2022 22:07
Hi Virtual Nomad,

I got to make it work finally.
I created animation functions that work with html.

Thank you for the help along the way, I wouldn't have dared to try to make it work in-browser on itch if it hadn't been for your tips.

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 9th Feb 2022 22:51 Edited at: 9th Feb 2022 22:55
you're welcome. and, i gave it a once-over and am about to play it again.

meanwhile, while the loading progress is nice, i wonder how much extra time it's taking by updating each filename on-screen. you might put a timer on it and compare to, say, displaying each new folder name, instead? (plant, enemy, pufferfish - while you should probably be packing each group of images into an atlas?).

or, just updating every 10%? worth a shot? either way, i do appreciate the active loading screen.

also, on death, show the score?

and if you want to look into saving a high score table as cookies, let me know. on itch, it requires a small change to the html file.

regardless, FF^2 is looking good
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 12th Feb 2022 22:06
Yeah thanks!

I created that game to teach me how to use AppGamekit.

You want the time how long you survived when you die in the game? What would be the value in that, so I can understand?

For saving high score in cache, do I need to connect the program to google Firebase, or are there inbuilt functions with AppGameKit to do that directly into the game folder within itch?
If it's too complicated I will not do too many changes.

I would be surprised if simply drawing on screen slows the process down noticeably? Is html so slow with screen rendering?
The only thing I noticed is that html in general runs much slower than an app on the pc directly, at least for me.

Are atlasses and spritesheets the same in AppGameKit, or treated differently somehow?

FF^2...lol

Login to post a reply

Server time is: 2024-04-20 15:08:21
Your offset time is: 2024-04-20 15:08:21