Home
Softono
gdcef

gdcef

Open source MIT C++
418
Stars
46
Forks
9
Issues
6
Watchers
3 weeks
Last Commit

About gdcef

gdCEF is a Godot 4 GDExtension that integrates the Chromium Embedded Framework (CEF) into the game engine, enabling developers to display fully functional web browsers within 2D and 3D scenes. Written in C++ with GDScript bindings, it supports Linux and Windows, with macOS support pending contributors. The plugin allows loading web pages, rendering HTML content, and interacting with web technologies directly inside Godot projects through a simple node-based interface. Key features include a CEF wrapper exposing GDScript APIs, browser creation targeting texture nodes, support for both 2D and 3D scene integration, and a Python build script for compiling from source. Pre-built binaries are available via GitHub Releases and the Godot Asset Library. The repository includes multiple demo projects, comprehensive documentation covering installation, API reference, architecture, and troubleshooting, plus unit tests for development. Use cases include embedding web-based UIs, displaying online content like leaderboards

Platforms

Web Self-hosted

Languages

C++

๐ŸŒ gdCEF - Chromium Embedded Framework for Godot 4

License: MIT Godot 4.2+ Version

Integrate a fully functional web browser into your Godot 4.2+ games for Linux, Windows (and for macOS, we need contributors!). This GDExtension wraps the Chromium Embedded Framework (CEF) API, allowing you to display web content in 2D and 3D scenes using GDScript.

โš ๏ธ Godot 3 users: Please use the godot-3.x branch instead.

๐ŸŽฅ Click the picture to watch the YouTube video "I made my own Browser" by FaceDev!

Wattesigma


๐Ÿ“ Repository Structure

๐Ÿ“ฆgdCEF
 โ”ฃ ๐Ÿ“œ build.py              โฌ…๏ธ Python3 script for compiling the project
 โ”ฃ ๐Ÿ“ฆ cef_artifacts         โฌ…๏ธ Folder with CEF and gdCEF artifacts created by build.py
 โ”ฃ ๐Ÿ“‚ demos                 โฌ…๏ธ Several examples of usage of gdCEF
 โ”ฃ ๐Ÿ“‚ doc                   โฌ…๏ธ Several documents to teach you how to use gdCEF
 โ”ฃ ๐Ÿ“‚ gdcef                 โฌ…๏ธ C++ code source of the gdextension (to be compiled)
 โ”ƒ โ”ฃ ๐Ÿ“‚ browser             โฌ…๏ธ Code for the CEF main process (libgdcef used by CEF)
 โ”ƒ โ”ฃ ๐Ÿ“‚ subprocess          โฌ…๏ธ Code for the CEF secondary process (gdCefRenderProcess used by libgdcef)
 โ”ƒ โ”ฃ ๐Ÿ“‚ patches             โฌ…๏ธ Patch files to apply to the CEF source code
 โ”ƒ โ”— ๐Ÿ“‚ tests               โฌ…๏ธ Unit tests
 โ”— ๐Ÿ“‚ thirdparty            โฌ…๏ธ Downloaded packages by build.py
   โ”ฃ ๐Ÿ“‚ cef_binary          โฌ…๏ธ CEF distribution used to build dependencies (downloaded)
   โ”— ๐Ÿ“‚ godot-cpp           โฌ…๏ธ Godot C++ API and bindings (downloaded)

โšก Quick Start

๐Ÿ› ๏ธ Option 1: Compile from Source

python3 -m pip install -r requirements.txt
python3 build.py

The cef_artifacts folder will be created at the project root with all necessary files.

Depending on your computer but count around 15 min to compile:

  • download and compile godot-cpp.
  • download and compile CEF.
  • compile gdCEF.

๐Ÿ“ฆ Option 2: Download Prebuilt Binaries from GitHub

  1. โฌ‡๏ธ Download the latest release from GitHub Releases.
  2. ๐Ÿ“ Extract and copy the cef_artifacts folder into your Godot project.
  3. โœ… Done! The .gdextension file is already included in the folder.

๐ŸŽฎ Option 3: Download Prebuilt Binaries from Godot Asset Lib

  1. ๐Ÿ›๏ธ Open the Godot editor, and click the "AssetLib" button.
  2. ๐Ÿ”Ž In the search bar, type gdcef.
  3. ๐Ÿ“ Download the cef_artifacts folder into your Godot project. Be sure to have clicked on "Ignore asset root".
  4. โš ๏ธ Godot does not preserve file attributes. Call cd cef_artifacts/linux/ && chmod +x *.so gdCefRenderProcess to restore them.
  5. โœ… Done! The .gdextension file is already included in the folder.

๐Ÿ“ Hello gdCEF World!

  1. Create a gdCEF node in your scene graph.
  2. Create a TextureRect in your scene graph.
  3. Create a gdscript with the following basic content:
extends GDCEF

func _ready():
    $CEF.initialize({})
    var browser = $CEF.create_browser("https://godotengine.org", $TextureRect, {})

โš ๏ธ This minimal example needs more code to have a usable browser in your game. See the Getting Started Guide for detailed instructions.


๐Ÿ“š Documentation

Document Description
Getting Started ๐Ÿš€ How to integrate gdCEF in your project
API Reference ๐Ÿ“‘ Complete GDScript API documentation
Installation ๐Ÿ”ง Detailed compilation instructions
FAQ โ“ Common questions and troubleshooting
Architecture ๐Ÿ—๏ธ How CEF works internally
Design Details ๐Ÿ—‚๏ธ Repository organization and build system
Gallery ๐Ÿ–ผ๏ธ Gallery of projects using gdCEF

๐ŸŽฒ Demos

Ready-to-use demos are included in the demos/ folder:

CEF demos

Demo Description
Hello CEF ๐Ÿ‘‹ Minimal example to start with
2D Demo ๐ŸŒŸ Full-featured browser with tabs, showcasing most of the API
3D Demo ๐ŸŒ€ Browser in a 3D scene with spatial audio
JS Bindings ๐Ÿ”— JavaScript to GDScript communication

๐Ÿ† Alternatives

Project Description
godot_wry ๐Ÿฆ€ WebView in Rust
GodotWebView ๐Ÿงฉ Qt-based solution
GodotChrome ๐Ÿค– Android/Godot 3

โš–๏ธ License

This project is licensed under the MIT License.

โš ๏ธ Note: CEF uses LGPL third-party libraries. See the FAQ for licensing implications.