Hosting a web game on the Internet Computer
This sample project demonstrates how to deploy a web game on the Internet Computer through Unity and Godot game engines.
Before you begin, make sure you have dfx SDK installed.
Create a Web Game
Let’s create a web game by using Unity or Godot game engine.
Unity
Make sure you have Unity installed.
- Create a new Unity Project with 
Universal Render Pipelinetemplate selected, or you can use you own game as well. - Install the 
IC GameKitpackage by following this instruction. - Follow the 
IC GameKitdocument to enableIC Connector. - Switch to 
WebGLbuild target in theBuild Settingswindow. - Under the 
Settings for WebGLtab in thePlayer Settingswindow.- Set 
Compression FormattoDisabledif you are using dfx SDK with version before 0.12.0.
You can check this document for more information. - Choose the 
MinimalWebGL template to reduce the number of files generated. 
 - Set 
 - Build to WebGL in the 
Build Settingswindow.
WithIC Connectorenabled in the previous step, a folder namedic-projectwill be generated under the WebGL build output folder. 
Godot
Make sure you have Godot installed.
- Create a new Godot project.
 - Install the IC GameKit plugin by following this instruction.
 - Follow the IC GameKit document to enable 
IC Connector. - Switch to 
HTML5preset in theExportwindow - Export the project by 
Export Projectbutton.
WithIC Connectorenabled in the previous step, a folder namedic-projectwill be generated under the HTML5 export folder. 
Create a dfx project manually
If you install the IC GameKit to generate the dfx project automatically in Create a Web Game, please skip this section and jump to the Deployment.
Since there is no backend in this sample, there is not any benefit of using the dfx new project_name command to set up a template. The dfx.json file is all that is needed.
Unity
- Create a folder named 
unity-webgl-sample - Create a 
dfx.jsonunderunity-webgl-samplefolder - Follow the Unity WebGL sample to  
- Setup the 
dfx.jsonfile - Copy the files in the Unity WebGL build to the right places under the 
srcfolder 
 - Setup the 
 
Godot
- Create a folder named 
godot-html5-sample - Create a 
dfx.jsonundergodot-html5-samplefolder - Follow the Godot HTML5 sample to  
- Setup the 
dfx.jsonfile - Copy the files in the Godot HTML5 build to the right places under the 
srcfolder 
 - Setup the 
 
You may find generating the DFX project manuanlly is tedious and error-prone, we highly recommend you to use IC GameKit to do this automatically. The tool is still in development, let us know if you have any feedback.
Deployment
The local network is started by running this command from the root of the DFX project:
$ dfx start --background
When the local network is up and running, run this command to deploy the canisters:
$ dfx deploy