Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross origin requirements for godot 4 in the browser #116

Open
matheusfillipe opened this issue Jul 7, 2023 · 1 comment
Open

Cross origin requirements for godot 4 in the browser #116

matheusfillipe opened this issue Jul 7, 2023 · 1 comment

Comments

@matheusfillipe
Copy link

Godot 4 now requires cross origin isolation and SharedArrayBuffer for web build servers, which can be tricky to setup on popular static website hosting platforms like netlify and itch.io, which you can still deal with, but specially github pages Trying to deploy with the current example actions will cause:

image

I have a workaround for that but still waits way too long to load for a very simple game (Not sure if it is related to that):

    name: "godot-ci export"
on: push

env:
  GODOT_VERSION: 4.0.3

jobs:
  export-web:
    name: Web Export
    runs-on: ubuntu-20.04
    container:
      image: barichello/godot-ci:4.0.3
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          lfs: true

      - name: Setup
        run: |
          mkdir -v -p ~/.local/share/godot/export_templates
          mv /root/.local/share/godot/templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
      - name: Web Build
        run: |
          mkdir -v -p build/web
          godot -v --headless --export-release "Web" build/web/index.html
      - name: Install rsync 📚
        run: |
          apt-get update && apt-get install -y rsync curl
      - name: Patch for Cross Origin Isolation and SharedArrayBuffer
        run: |
          cd build/web/
          curl https://raw.githubusercontent.com/josephrocca/clip-image-sorter/92b108dc670d0b56bd6b72963b0e86c4c862412e/enable-threads.js --output enable-threads.js
          sed -i 's|headers.set("Cross-Origin-Embedder-Policy", "credentialless")|headers.set("Cross-Origin-Embedder-Policy", "require-corp")|g'  enable-threads.js
          sed -i 's|<script src="index.js"></script>|<script src="enable-threads.js"></script><script src="index.js"></script>|g' index.html
      - name: Upload Artifact
        uses: actions/upload-artifact@v1
        with:
          name: web
          path: build/web
      - name: Deploy to GitHub Pages 🚀
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          folder: build/web # The folder the action should deploy.

https://github.com/orgs/community/discussions/13309
godotengine/godot#70691

@Calinou
Copy link
Collaborator

Calinou commented Jan 2, 2024

I have a workaround for that but still waits way too long to load for a very simple game (Not sure if it is related to that):

On macOS, this is due to an upstream issue: godotengine/godot#70691

On other platforms, this can occur on slower devices in general since the shader can take a very long time to compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants