Distribution files

Hello, I’m hoping that someone may have some insights on something that is preventing me for using GDevelop to create small educational games for a project that I’m currently working on.
I have in the past created some games with GD but cannot integrate them into my project because I need to dynamically display them on a specific web page and not take the user to a different page, aka location where all the files are located.

But I can’t do this because the paths to the distribution files are all local.

Any suggestions would be greatly appreciated :slight_smile:

Hi,
I’m a bit confused by your message, but I might be lacking technical skills to understand it…
Do you want to embed a GD project inside a webpage, or do you want to import/export data to/from a GD project?
For the first one, GD projects can be embedded in any webpage (eg itch.io, kongregate, etc) no need to “take the user to a different page”.
For the second one, you can use the Network actions/conditions (POST/GET stuff).

Hi,
Thanks for the quick response.
It’s probably me that didn’t explain it clearly :blush:
In answer to your question, I want to embed the project inside a web page and export the results from the project.
While I can see that exporting the data is feasible I don’t see how embedding can work as the project won’t be in the same folder as the web page and so all the paths to image and other resource files need to take that into account.

Example:
The main web page is located in the folder [site] /members/
A project would be located in the folder [site] /modules/levelN/project/

Looking inside the data file I see that there is just the image file names. Surely if the code is executing in my web page it’s going to try and load the images from the folder ‘members’ and not /modules/levelN/project/.

If I’ve got this wrong and there’s a solution I’ll be able to do a happy dance as I’ve already home rolled a memory card game, a hangman and a simple game with a sprite moving around on the screen, but it’s very time consuming and I need to pick up some speed here.

Projects cannot be hosted on a web page unless you change how the editor/IDE looks for resources.

However, if you choose the Local HTML 5 export, that Game folder can be uploaded to a page.

(Once exported it is no longer referred to as a project, in case we are just having a terminology issue here )

By project I understood and meant the local HTML 5 export. Which after re-examining is not going to cut it, so I’m going to have to continue to roll my own even if it is time consuming. The resultant code is much lighter and speech to text can be implemented correctly.
My apologies if I confused anyone.

I’m still not sure what you’re meaning.

If you export your game as HTML5 to a local folder, your folder structure is basically:
RootFolder (all HTML files and images)
RootFolder\event-tools (supporting javascript files)
RootFolder\extensions (supporting javascript files)
RootFolder\fontfaceobserver (supporting javascript files)
RootFolder\howler (supporting javascript files for sound)
RootFolder\libs (supporting libraries)
RootFolder\pixi-libraries (main pixi files)

You can absolutely make the RootFolder be somewhere on your webserver, then embed the main game HTML file on another page. It will still operate out of that actual root folder, not out of the embedded page.

However, I still might be misunderstanding what you’re trying to do.

The page I would like to embed the game on has a header, a menu, buttons to move from one lesson/activity to another, etc., etc… The game should be displayed in a specific div.

When the learner clicks the button to move on to the next activity an XMLHttpRequest is made to the server which gets information about the required data for that activity from the database and sends it to the page. Then the html, or video is inserted into the page and any .js files required are injected into the page header.

Looking at the index.html file there are more than 50 .js files to be included. I would have to modify the script src tags so that instead of : script src=“libs/jshashtable.js” it would be script src=“SiteRoot/modules/LevelN/RootFolder/libs/jshashtable.js”. Otherwise I would get a 404 for the file because it would’t be in the same folder as the page that’s trying to import it.

(In fact I would be putting the names of the .js files into the database, but I would still have to modify the paths).

I suspect that I would have to do the same thing for the paths to the files in data.js as well. Because the code will be executing from the location where my page is located, not from RootFolder.

I think all the paths inside the game are relative, so they run from any folder, as long as you preserve the exported structure.
So, from what I understand, you just need a trick to include the index.html of your game inside your own index.html? Google should find you plenty of such tricks.