Coder Social home page Coder Social logo

godot_web's Introduction

godot_web

build test

godot_web is a minimalistic webserver for testing Godot HTML builds.

Why?

Prior to Godot 4.0, HTML builds could be tested using python -m http.server or other simple webservers. However, projects exported to HTML via Godot 4.0 now require the use of Javascript SharedArrayBuffers, which are disabled in modern browsers unless specific policy headers are set by the webserver to ensure they can be enabled securely.

You'll know you're in the right place if you see errors like this when trying to access your builds from a browser:

image

Error
The following features required to run Godot projects on the Web are missing:
Cross Origin Isolation - Check web server configuration (send correct headers)
SharedArrayBuffer - Check web server configuration (send correct headers)

Usage

To get around these errors, just run godot_web in the same directory as your Godot project build:

$ godot_web
Server link: http://127.0.0.1:8000/

Then, open the link in your browser to access your build. godot_web will serve your project files and add the appropriate Cross-Origin HTTP headers so that SharedArrayBuffers can be enabled securely.

By default, this server will only accept requests from localhost, so it will not be accessible from remote computers. To change this behavior, you can allow external traffic via the --external flag:

$ godot_web --external

Note: when the --external flag is given, godot_web will generate a self-signed TLS certificate to serve traffic over HTTPS, which is another requirement of Godot 4.0 HTML builds that aren't accessed via localhost. If you want to use your own certificate and private key instead, use the --tls-cert <FILE> and --tls-key <FILE> flags.

Don't like the default port (8000)? Override it with --port <PORT>, like:

$ godot_web --port 1234

Want to serve content from a different directory? Specify it as the last argument:

$ godot_web --port 1234 ~/projects/godot/mygame

For a list of all supported options, run:

$ godot_web --help

Requirements

Releases are stand-alone, static binaries with no external dependencies. You can download and run them on Linux, Mac, and Windows without any other requirements.

Building

If you prefer to build from source, you will need go >= 1.18.

To build the latest version from git, you can clone this repository and run make from its root:

$ git clone https://github.com/pipejakob/godot_web.git
$ cd godot_web
$ make

Or, you can download the source code of a specific release, unpack it, and run make there:

$ tar xf godot_web-0.2.0.tar.gz
$ cd godot_web-0.2.0
$ make

Running make from the project root will build the godot_web binary in the current directory.

Installation

To install, run:

$ make install

and the godot_web binary will be placed into $HOME/go/bin (make sure this is in your $PATH!).

If you want to install it system-wide, you can copy the binary to a system folder, like:

$ make
$ sudo cp godot_web /usr/bin/

godot_web's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.