Last updated 2 months ago
Applying blockchain technology to video games is a likely avenue for driving Cardano's mass adoption. However, current solutions lack compatibility with game engines, impeding potential projects.
We aim to integrate light wallet functionality into the open-source Godot game engine, thereby providing game developers with the tooling and infrastructure needed to quickly integrate Cardano.
This is the total amount allocated to MLabs – Cardano Game Engine Wallet - Godot Integration. 6 out of 6 milestones are completed.
1/6
Research on Godot’s extension systems And NodeJs / V8 embedding
Cost: ₳ 74,642
Delivery: Month 1 - Dec 2023
2/6
Set up development environment and build system
Cost: ₳ 81,428
Delivery: Month 2 - Jan 2024
3/6
Implement wallet and (optionally) SDK functionality
Cost: ₳ 113,095
Delivery: Month 4 - Mar 2024
4/6
Implement extension API
Cost: ₳ 81,428
Delivery: Month 5 - Apr 2024
5/6
Documentation and examples complete
Cost: ₳ 81,428
Delivery: Month 6 - May 2024
6/6
Paima Engine integration complete
Cost: ₳ 115,359
Delivery: Month 8 - Jul 2024
Sean Hunter
Ramiro Garay
No dependencies.
Project will be fully open source.
Problem
Integration of Cardano blockchain technology into traditional video game products is a lucrative market that, we believe, has the potential to deliver concrete benefits to all parties involved. Users of video game products integrated with the blockchain stand to gain "real ownership" of their digital assets and identities. Developers of gaming products gain both additional monetization opportunities and, potentially, the ability to offload transaction logic onto the blockchain. The Cardano ecosystem benefits from increased adoption by ordinary users who may not have any interest in decentralized finance products.
However, as things stand now, integration is simply too costly and difficult to be viable for many game developers. A typical Cardano dApp (including both the on-chain and off-chain components) typically requires three components: 1) Smart contracts to be executed on-chain. 2) A browser-based light wallet that allows users to ergonomically interact with the dApp. 3) An application backend (plutus-apps, CTL, GeniusYield Atlas) that provides the "glue" (building transactions, applying arguments to parameterized scripts, balancing transactions, collateral creation or selection, etc) which facilitates a convenient experience for users interacting with the blockchain.
This architecture is not suitable for video game products. Although several game engines implement rudimentary embedded browsers, those embedded browsers are not fully-featured and cannot support the extension-based light wallets used in the conventional dApp architecture. While a game developer could (at least hypothetically) route interactions with the blockchain through a user's browser-based wallet, this leads to an awful experience for users who must configure a light-wallet outside of the game and break immersion (e.g. by "tabbing out") every time they seek to perform an in-game action that interacts with the blockchain.
If game developers wish to integrate Cardano's blockchain technology while maintaining ergonomics for the user, they must develop their wallet and integrate it into their engine of choice. It stands to reason that even game developers who are very enthusiastic about blockchain integration would hesitate in the face of this technical barrier (which falls well outside the expertise of a typical game developer).
Solution
We propose that the best solution to this problem is the obvious solution: Integrate light wallet functionality directly into a game engine while providing high-quality documentation and ample examples. This removes the largest barrier to entry facing game developers wishing to integrate Cardano's blockchain technology into their products.
We believe the Godot game engine represents the most promising avenue for wallet integration. Furthermore, we have been in talks with teams saying this could directly benefit them (for example, see here). Godot is an open-source engine, which greatly simplifies the work needed to quickly get wallet support up and running. Additionally, Godot is quickly gaining significant adoption, particularly among indie developers (who, we believe, are the most likely to develop innovative blockchain integrations and experiment with new designs and revenue models). Furthermore, because Godot is free and open source, there are no licensing requirements or fees attached to its usage - which makes it attractive even to large game studios. (We note that Godot has recently been used by a major studio to develop a Sonic game, which demonstrates that it is suitable for both small-scale and large-scale development). Finally, Godot supports a robust system for extending the core engine (GDExtension), which promises to make the development of Cardano integration tools relatively painless.
Of course, while light wallet functionality is necessary for blockchain/gaming integration, it is not sufficient for a maximally ergonomic developer experience; ideally, both the application backend and the light wallet would be tightly integrated into the engine. Furthermore, even with an application backend and light wallet in place, game developers without blockchain experience may still struggle, so a full solution to the problem requires that we integrate a wallet and/or application backend with tools that facilitate a familiar development experience for game developers.
Subsequent paragraphs in this section will address our strategy in technical detail, but in broad strokes, our approach is: I) Determine if CTL (Cardano Transaction Library, a dApp backend developed by MLabs that supports basic wallet functionality) can be bundled and made available as an extension. II) If CTL can be bundled as a Godot extension, bundle it. If CTL cannot be bundled, then [Lucid](https://lucid.spacebudz.io/) may be used, which is also fully featured and has a similar path for integration to Godot. Or, as a last resort, the Cardano Multiplatform Library (CML) can be utilized as a viable alternative to provide the bare minimum functionality required to implement a wallet. III) Test the extension and write high quality documentation for it. IV) Build upon functionality developed in previous steps to implement an integration with the Paima Engine, a high quality framework for developing blockchain-integrated gaming products, which will provide game developers with a familiar experience and reduce development time for Cardano-integrated gaming products even further.
Technical details
CTL is a Plutus application backend written in PureScript which can run either in a browser or node.js environment. In addition to its application backend functionality, CTL implements features necessary for minimal wallet functionality, and therefore a CTL extension to Godot would solve both the “client needs a wallet” and the “server needs an application backend” problems in one stroke.
Node.js provides a C++ embedder API (https://nodejs.org/api/embedding.html). Godot provides both an extension API (GDExtension) which supports C++, and a C++ "custom module API". Our research indicates that it should be possible to package CTL and bundle it either as a GDExtension or a C++ module, which we could then build upon (to improve ergonomics) and document. This is the optimistic "happy path" for the development of the project.
However, as every experienced developer knows, things that should be possible in theory can turn out unworkable in practice. Because we are committed to delivering a solution with our requested budget and in our requested time frame, we have a backup plan if bundling CTL is not a viable approach: Build our light wallet functionality on top of well-tested and widely-used core libraries.
CML (Cardano Multiplatform Library, written in Rust) provides the core functionality upon which wallets and other blockchain utilities can be built. Both of these libraries are widely used in the Cardano ecosystem and are presumed to be reliable (critical components of many dApps currently deployed to mainnet are built on top of one or the other).
We anticipate that building minimal wallet functionality on top of CML and bundling it as a GDExtension (for Godot v4) or a GDNative package (for Godot v3) can be accomplished very quickly. For a game-client wallet, a simple single-address wallet capable of signing transactions and sending funds to other wallets will suffice for the vast majority of use cases, and CML provides all of the necessary infrastructure to rapidly build this solution.
Given the nature of this project (which aims at reducing the complexity required to integrate the Cardano blockchain into gaming products), high-quality examples and documentation are every bit as important as the Godot modules/extensions. Consequently, producing those examples and documentation is an essential component of our proposal. A solution that only experienced Cardano developers can make use of is, in this domain, not much of a solution at all.
Finally, while we aim to provide a general solution to the problem, we acknowledge that simply implementing a Cardano wallet or CTL bundle for Godot is not likely to provide most game developers with sufficient tools to start building blockchain-integrated products. Consequently, we have partnered with the Paima team to integrate our wallet with their Paima Engine. The Paima Engine provides frameworks and tools that will enable game developers with minimal blockchain experience to immediately start building gaming products with blockchain integrations. We believe that this approach benefits the maximum number of users: Developers with significant blockchain experience may choose to implement a bespoke solution on top of wallet/CTL functionality, while developers without blockchain experience can make use of the high quality Paima Engine to do what they do best: Build awesome games!
Market
Amateur & professional game developers who wish to integrate Cardano with their products. Cardano developers who wish to branch out into gaming products. Indirectly, mainstream consumers of gaming products.
Intended Challenge – Developer Ecosystem - The Evolution
Challenge Question – "How do we equip and support developers with tools and working infrastructure? How do we make Cardano their first choice when it comes to building dApps, innovating and collaborating?"
What does this proposal entail?
We believe the scope of this proposal is eminently achievable with our requested budget and time frame. To recap from a previous section, our "happy path" only requires that we successfully bundle CTL and package it as a Godot module. Our "unhappy path" only requires us to implement very basic wallet functionality on top of well-tested and widely-used libraries. Basic light-wallet functionality is sufficient for integration with the Paima Engine, and we believe that Paima integration will be painless to accomplish. We only intend to integrate Godot’s web output with Paima’s JavaScript framework, and Godot provides well-documented tools for doing so.
How does integrating a wallet into Godot help developers?
At the moment, any developer wishing to integrate Cardano blockchain technology into a game product must develop their own wallet and bundle it into their application backend. We anticipate that a well-documented Godot wallet (and, optimistically, application backend) will greatly increase the number of game developers able to integrate Cardano technology into their products, which is very likely to foster innovation and experimentation and vastly increase the quantity and type of products that can be built on the Cardano blockchain.
Success for this project involves, at a bare minimum, releasing a light wallet extension for the Godot game engine along with very high quality documentation and examples. (Maximal success involves releasing an extension that supports both light wallet and application backend functionality, see answers to previous questions).
We will share the progress and outcomes of our integration as effectively and transparently as possible using the typical channels:
MLabs, a leading consultancy in the Cardano ecosystem, has a proven track record and significant experience. Our team consists of seasoned engineers, each holding expertise in their respective fields. Moreover, we have consistently demonstrated our ability to deliver complicated projects with a high degree of trust and accountability. We have an extensive portfolio of satisfied client projects as well as several popular Catalyst projects. We're committed to upholding these standards for this integration proposal. Moreover, we are committed to working in an open-source and transparent manner.
The goals of the project are:
1) Providing a native Cardano light-wallet experience to the Godot engine. By native, it is meant that no out-of-game interaction will be necessary from the user to interact with the Cardano blockchain.
2) (OPTIONAL) Providing a Godot SDK for constructing Cardano dApps / games. The whole “off-chain logic” (the one related to building, balancing and signing transactions, among others) should be able to be scripted completely inside the engine. This goal is optional, since it depends on our success in integrating a fully featured JS library such as CTL or Lucid into Godot.
These are the expected milestones of the project:
Basic integration of chosen off-chain framework
Research on Godot’s extension systems and NodeJs / V8 embedding:
The first part of the project will involve research on Godot’s different extension systems and the NodeJs C++ Embedder API.
Setting up a development and build environment:
It is expected that a significant amount of work will be done on setting up a development environment that can build an embedded NodeJs runner as a shared library (for Windows / Linux at least) that can be used by Godot as a GDExtension. Some time will also be spent in bundling either CTL or Lucid as a single-file JS library.
Creating a C++ / Javascript internal interface for communication between CTL / Lucid and Godot:
A scheme will have to be devised for communicating between the NodeJs runner and the bundled Javascript library. This part is likely to be the most difficult due to lack of documentation and the necessity of interacting with Node and V8 internals. This task does not involve covering the entirety of CTL/Lucid’s API, but rather designing a sensible way of calling NodeJs code from within Godot. If this task proves to be too difficult, the optional goal will have to be dropped and the project will switch to integrating CML into Godot using the Rust bindings.
Testing the internal interface: With the internal interface in place, some testing will be performed: sending a TX to a testnet, creating a wallet from a seed-phrase, etc. These tests should serve as tangible evidence that the embedding approach is feasible. It should be noted that this interface is internal, and hence there are no requirements on how the extension looks like for a final user: here we only test how the extension internally communicates with JS-land.
Wallet functionality implemented
(OPTIONAL) All off-chain functionality implemented
Implemented extension API
Documentation and examples complete
Paima Engine Integration complete
Basic integration of chosen off-chain framework:
Deliverable: A research writeup on Godot's extension system, a development environment, an interface scheme, and basic tests.
Outcome: NodeJS embedded in the Godot game engine and effective communication between the two systems established or a pivot to the Rust approach.
Wallet functionality implemented:
Deliverable: A basic light wallet integrated into the Godot game engine.
Outcome: Essential wallet features incorporated into the Godot game engine.
(Optional) All off-chain functionality implemented:
Deliverable: A complete off-chain SDK integrated into the Godot engine.
Outcome: More complex off-chain functionality incorporated into the light wallet and available to developers.
Implemented extension API:
Deliverable: An ergonomic and user-friendly API for the Godot extension.
Outcome: An intuitive GDScript API that smoothly integrates blockchain functionality into video games developed with Godot. Ample documentation, educational resources, and examples.
Documentation and examples complete:
Deliverable: Detailed, comprehensive, and user-friendly documentation and descriptive use case examples.
Outcome: Developers have a clear and practical understanding of how to incorporate the extension into their projects.
Paima Engine integration complete:
Deliverable: Successful integration of the Paima engine into the Godot game engine, with blockchain functionality available.
Outcome: Increased scope and usability of blockchain functionality within the Godot engine, opening up additional opportunities for developers to create innovative, blockchain-based gaming experiences.
Basic integration of chosen off-chain framework: 250 hours
Wallet functionality implemented: 180 hours
All off-chain functionality implemented: 250 hours
Implemented extension API: 160 hours
Documentation and examples complete: 120 hours
Paima Integration: 250 hours
Subtotal: 1210 hours @95/hour = $114,950 USD
Total (@ rate $0.21 USD / ADA): 547380 ADA
**In the interest of full transparency, please note we have applied a conservative USD/ADA exchange rate in pricing this proposal. This is to ensure our operations remain stable regardless of market conditions. Although we firmly believe the future of Cardano is bright, we recognize the price of ADA and all cryptocurrencies is inherently volatile. Our financial obligations are denominated in fiat. Most importantly, this includes the salary of our engineers whose hard work makes projects like this possible.
In the unlikely scenario of severe negative price movement beyond our forecasted rate, it is possible that MLabs may need to temporarily suspend work on this proposal until the market recovers. Rest assured, this decision would be made solely to protect our business's long-term viability and never taken lightly.
We appreciate your understanding and support, and we are excited to see what we can achieve together.
Our project, which centers on integrating a light wallet into the widely-adopted Godot game engine, serves as a key enabler for Cardano's expansion into the burgeoning gaming industry. Recognized for its rapid growth and influential trend-setting dynamics, the gaming industry presents an outstanding platform for Cardano's widespread adoption.
This project will empower game developers with easy access to Cardano's rich feature set, inspiring a conducive environment for creativity and innovation to flourish atop the Cardano blockchain. We anticipate this integration will directly lead to an enriched gaming experience underpinned by the decentralization, transparency, and security inherent to Cardano.
From a value-for-money perspective, the Catalyst community stands to gain significantly. Primarily, the project provides a promising financial ROI, as the gaming industry represents a fertile ground for growth. More importantly, the successful delivery of this project symbolizes tangible, real-world applications paving the way for a stronger, more influential Cardano ecosystem.
NB: Monthly reporting was deprecated from January 2024 and replaced fully by the Milestones Program framework. Learn more here
MLabs
MLabs is a premier development firms in the Cardano Ecosystem. We are an IOG Plutus Partner and work regularly with IOG to develop the Cardano blockchain and ecosystem. Our team is composed of talented developers who have helped build community projects such as:
And several others. Through our work with early-stage projects, we have one of the largest groups of Haskell/Plutus developers in the Cardano community.
Website: https://mlabs.city/
Core Team
Ramiro Garay
Ramiro is a flexible software developer who entered the world of Cardano through his love of functional programming and Haskell. He put a hiatus to his software engineering studies to work at MLabs, where he brings his Haskell and Purescript skills to many dApp projects. He loves the safety guarantees of the statically-typed functional paradigm, but he's first and foremost a pragmatic person: he strives to deliver the most value possible and to do that he uses all the tools at his disposal.
Github: https://github.com/rmgaray
Sean Hunter
Sean is an engineer with extensive Cardano smart-contract development experience. He has implemented and audited multiple complex projects written in both PlutusTx and Plutarch. Sean's functional programming journey began as an offshoot of his academic interest in formal logic, and to this day he maintains a strong interest in type theory (with a special interest in row types and their applications).
Partners
dcSpark and Paima Studios
dcSpark is a leading company in the blockchain industry, deeply committed to improving the accessibility and usability of blockchain technologies. They focus on infrastructure services for Cardano and other blockchain platforms, spanning protocol and dApp development, as well as interoperability solutions. Their mission is to enhance composability and interoperability on the backend, offering a seamless experience for users venturing into the dynamic world of Blockchain.
Paima Studios, founded in April 2022, are the core developers of the Paima Engine: a web3 engine built using novel layer 2 technology. Paima Engine is a safe and easy way to enter web3 as it can be used with any programming language and doesn’t expose users or developers to common web3 risks and hacks.