embed godot html export in a Angular CLI project

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SamTT

Is it possible to embed a Godot 3.1 Html export in a Angular CLI project? I want to work with my data in Indexed-DB from my Godot game in my Angular CLI project. But does somebody know if is that possible?

:bust_in_silhouette: Reply From: wombatstampede

I’d say: Yes

I’m not an expert for Angular but as far as I get it it produces basically an “app/site” consisting of html, css and javascript.

If you look at this doc-page…

you’ll see that it is possible to call javascript from within the godot game (script). You can also get back a result. (For more complicated/structured return values it is probably possible to return JSON from the web page and decode it inside Godot.

As Godot does not speak “Angular” but Javascript so you might have to fiddle a bit to integrate it.

Also be aware that the Godot app probably won’t visually integrate well with the rest of your app. It is basically a “black box”.

You should basically be able to access IndexedDB (probably via Javascript helper functions).

AFAIK it is NOT possible to call the game from the page. I.e. to “push” data into the game or trigger some event but if that is required you save such data and poll regularly from GDScript. I.e. check with a timer each second if something is “in the queue”.

Important: Before building the whole game in Godot I would propose to start with a little demo/testing project to see if load times, platform compatibility etc. actually suit your needs.

Sorry for my late response, but this may be useful for someone someday.

I agree with almost everything you mention.

Nevertheless I think it is important to point out that Godot actually CAN communicate with the DOM (page) in order to push/retrieve data or sense inputs from the DOM by for example, using buttons in the page.

It can be done via a Javascript interface provided by Godot by using GDScript.
Here you can see an example of Godot<–>DOM communication in action

And here the is the official documentation regarding Javascript ↔ Godot communication

ginestopo | 2023-06-14 06:42