icon-community / ice-substrate

ICE Blockchain is an EVM and Wasm compatible network built with Parity’s Substrate framework.
http://www.icenetwork.io
Apache License 2.0
22 stars 12 forks source link

Ice/Snow EVM Unity SDK #160

Open paulrouge opened 1 year ago

paulrouge commented 1 year ago

Application Type

Please check one below.

Subcategory: Please check all which apply.

Team Introduction

I will be leading this project myself. I have wide experience with multiple aspects, mostly but not limited to the ICON ecosystem. I am the lead developer of the Blobble World web-app that will be deployed on Snow (I have showed it to Mo recently). I have been dipping my toes into the Unity Engine out of interest in the opportunities and possibilities for crypto in gaming / meta-verse etc.

Grant Request Amount

$9600,- Based on a 2 to 3 week FTE. Besides the work I put in myself I expect the need to outsource some of the work as well.

Project Description

Context

"Unity is a cross-platform game engine developed by Unity Technologies, which is primarily used to develop video games and simulations for computers, consoles and mobile devices."

At the moment of writing I have not found a comfortable SDK to interact with EVMs through Unity. There is an easy way to connect MetaMask to your games, but that only works for web-apps not stand alone games / apps.

Goals & Key Performance Indicators

Create an easy to use SDK for Unity to interact with EVMs. At the moment there is not a user friendly SDK (that I know of at least). None have the opportunity to store your private key for example. I will build a keystore-like system that will allow you to locally store your password-encrypted private key (sort of like MetaMask does).

After a wallet is loaded the private key can be used to sign transactions within the game / app, without the need of a third party app like MetaMask (and keep in mind that MetaMask only works with web-apps). For example keeping track of a gamescore or interacting with NFTs.

It might be an opportunity for the ICE/SNOW network to step in the Unity EVM void. Unity and gaming can be a gateway for new developers to Ice/Snow/Kusama/Polkadot/BTP etc.

If have already build a working prototype as proof of concept.

Screenshot 2022-09-23 at 10 17 55 Screenshot 2022-09-23 at 10 20 25 Screenshot 2022-09-23 at 10 20 36

The SDK will come in the form of a Unity Prefab. "Prefabs in Unity are pre-configured reusable GameObjects that you create in the scene and store in the project."

Constraints

I will include some examples, for example calling functions on contracts which users can use to adjust to their needs.

Assumptions

Unity uses C# scripting. To use the SDK one will need some experience with the Unity engine as well as C#.

Milestone Duration

If granted I expect to be able to finish the project in 1 month. If there are any question feel free to contact me.

Kind regards, Paul

paulrouge commented 1 year ago

Btw, I am open for feedback!

sos0 commented 1 year ago

Hi, we're letting you know that we've received your application and are undergoing discussion. We'll be posting questions for you, so you can keep an eye out here. Thanks for your patience.

mohamedelshami commented 1 year ago

Hi Paul,

Thank you for this application.

We have some questions:

paulrouge commented 1 year ago

Hi Mo,

Thanks for replying. Let me try and answer your questions as good as I can.

Q: What are some use cases for this SDK beyond wallet integration?

A: It will make it easy for Unity-developers to implement the signing of transactions. A player of a game can log in with a password protected keystore. After that he/she can sign transactions in-game with the click of a button.

For example, a multiplayer card game where all players need to send an NFT to an escrow contract before the game start, winner can claim the losers NFT('s) by signing a 'claimEarnings' method-call.

Obviously it would also make it possible to send any tokens from within the game.

Q: What is the value of attaching wallet/private key to GameObject as opposed to using C# Ethereum API https://ethereum.org/en/developers/docs/programming-languages/dot-net/

A: Good question. To be honest, I don't know if the solution I'm prompting is the best one (changes are, that it is not). I got to this solution after figuring out how to make some ideas work in Unity. It took me more effort than I initially expected. And while trying to make it to work a rough prototype originated.

I think the value for Unity ( Game ) developers will be, that they would be able to get up and running quickly when trying to integrate EVM compatibility, without the need of having to understand too much of Ethereum / blockchain technology. They can have a Solidity developer set up the contracts and implement it in the game by using the Unity SDK easily.

And why make it a so called "GameObject"? Within Unity basically everything you use within your game is a GameObject. You can attach all kind of things to the GameObject in your game which determines what it is / does. So a character is a GameObject, as is a menu, or a button of a menu. When you save a GameObject it is called a PreFab, which you can see as a Class (more or less). So with the PreFab a Unity developer can easily implement EVM utility as he/she needs.

There is somewhat of a vacuum for a product like this I believe. There is a lot of documentation to get WebApps connected via MetaMask but not "standalone" games/apps. Also, keep in mind that even though Unity uses C#, not all Unity devs use scripting, you can get quite a lot done without scripting within the engine.

Q: Do you have future plans for ICE/SNOW and Unity SDK support?

A: The goal would be to build something that people will actually use. So I will definitely be around to help out when needed (to a certain extend obviously, I won't be building games for users or can promise to answer all question for the next 20 years, you can get some feedback from the Icon people on how they experienced my way of working). Perhaps we can think of a way to make an example use-case on Snow/Ice and implement that in some docs on icenetwork.io . Like I said, there is somewhat of a void which might be one that Snow/Ice can fill.

Q: How is the progress on Blobble? We love the project and would like to understand if work on the SDK would impede the other.

A: Indeed, at the moment of writing I am spending most of my time on Blobble. I expect to get most of Blobble, production ready this or next week. After that it will be finetuning and "waiting" for launch.

I will be keeping you up to date and would be happy to see if we can work together in getting Blobble World launched as well as possible. I believe I do several unique and cool things with Blobble and I am looking forward in how it will be received. But I also believe I will have room to manage other things beside it. The Blobble launch has top priority. And if granted, I don't expect the funds after delivering a working product. If any unexpected things occur the delivery of the SDK will take a bit longer.

Some extra words: I believe an easy to use EVM SDK for Unity is still missing in the Unity environment. Therefor I also believe it could be a good way to introduce blockchain newbies, to blockchain via this SDK, which can be an opportunity to get builders to Ice and Snow. It won't guarantee that they will stay of course, because it's EVM they can use it on a lot of other chains.

I can imagine it's not an easy / obvious decision to determine if that is worth the amount of money I am requesting, so good luck to you guys ;p

I won't have any hard feelings towards you guys if you decide that you don't think the added value to the network will be equal or more than the requested amount of money.

I hope my answers gave you more clearance on the proposal, if not feel free to ask more.

Kind regards,

Paul

mohamedelshami commented 1 year ago

Hey @paulrouge

Thanks for providing the above details. We are definitely supportive of the idea, especially if you think there is a gap, I do believe further research needs to be done here. I would suggest doing the following:

  1. Look at existing EVM Unity SDK, and see if the ICE/SNOW can be integrated with these and what's efforts are needed for this. Examples, Ajuna, and Chainsafe Gaming SDK.
  2. Also, unsure about the security of saving private keys in GameObject
  3. From a user perspective, wouldn't it make more sense if they use wallet extensions to connect such as MetaMask and PolkadotJS?

Budget-wise, I'm cautious of the fact that we haven't provided clear guidance on the different funds level, but for something that is estimated to take 3 weeks effort, I would expect a budget less the what's proposed.

paulrouge commented 1 year ago

@mohamedelshami thank you for your answer,

One of the sources that you suggested actually contained quite some solutions that I was not able to find before. I read over some of the docs and missed it before. That tackles a part of my proposal, which is great!

However one thing I still miss in the Unity blockchain space is also the answer on point 2 and 3 of your latest remark.

q 3: From a user perspective, wouldn't it make more sense if they use wallet extensions to connect such as MetaMask and PolkadotJS?

This works only for WebGL games, games that are run in a browser (A browser has limitations, a max of 500mb for example). You can not connect MetaMask from within a PC-, PlayStation- or Xbox-game for example (as far as I know at least, but I am pretty sure on this one).

q 2:Also, unsure about the security of saving private keys in GameObject

The answer to this lays in the extension of the previous answer. Without the ability to use something like MetaMask my solution is to store the private key locally AND encrypted with a password, I think this is similar to how MetaMask works(?).

At the moment, a few weeks has passed and, the Blobble project is getting closer to finishing. I want to focus on that for now but want to suggest to catch up on the above mentioned later on. During the past few weeks, and with help of your feedback in this feed, my view on my initial proposal shifted a bit.

Perhaps a "MetaMask for Unity" is more what this should become. I see potential for SNOW/ICE in this, if done properly, for example with good documentation and/or tutorials.

Let me know what you / the team thinks!

Regards, Paul

sos0 commented 1 year ago

Hi @paulrouge , would you like to revise your application? I'd love to see an updated proposal with different milestones/budget if needed.

sos0 commented 1 year ago

Hi @paulrouge , just checking in regarding the above.

paulrouge commented 1 year ago

@sos0 I am so sorry! I totally missed the previous messages!

At the moment I am really busy with finishing extra aspects to the tokenomics of Blobble (The game that will be launched on Snow). So I can't really make any promises beside this one:

After launch I will have go through all of the above and re-evaluate my initial proposal. I have some bibs and bobs set up in the Unity project that I used as a prototype for the initial proposal. That will be the starting point for evaluating and reshaping a proposal.

It would be helpful for me to know if my last answers to Mo's questions actually made sense. Otherwise it might be necessary that I clear those up before creating a new proposal, because his questions are about the security of private keys. I don't think a proposal can be approved if this is not cleared up... ( English is not my first language so maybe my answers were not clear enough. )

I think I will be able to look at the end of this month.

Again my apologies for not responding, please know that you can also always contact me on Discord if needed!

Kind regards, Paul