实操 decentraland 上传内容到土地

论坛 期权论坛 区块链     
永远游泳的鱼   2018-11-20 23:32   4483   0
            实操 decentraland 上传内容到土地搞了一个上午,终于将内容上传到自己的土地上了,下面我把步骤给大家列一下。
[h1]准备工作:DCL SDK 安装[/h1]使用
  1. npm install -g decentraland
复制代码
一个命令即可安装完成。详情可以查看《安装指南》上的说明。
[h1]新建一个 DCL 项目[/h1]
  • 新建一个项目
    1. mkdir democd demodcl init ? Scene title: 输入内容标题 ? Your ethereum address: (optional, recommended -- used to check ownership of parcels when deploying your scene) 输入拥有土地的以太地址 ? Your name: (optional -- shown to other users so that they can contact you) 输入名字 ? Your email: (optional -- shown to other users so that they can contact you) 邮箱 ? Parcels comprising the scene (optional, recommended -- used to show the limts of your scene and upload to these coordinates) Please use this format: `x,y; x,y; x,y ...` 输入拥有的土地地址 ? Which scene template would you like to generate? Interactive  Installing dependencies Success! Run 'dcl start' to see your scene
    复制代码
  • 修改场景内容
    然后就可以根据自己的要求,通过修改 scene.tsx 文件,做到自定义的游戏或内容场景的开发。为了简单,我在自动生成的场景中,只加入一行欢迎标题,这样进入场景就能看到,如下在 scene.tsx 文件中加入
    1. text
    复制代码
    一行:
    1. return (                                )
    复制代码
    3D 模型可以从以下几个网站下载使用。
  • 预览自己的场景
    1. dcl start
    复制代码
    会打开一个浏览器窗口,推荐使用 chrome 浏览器。
    可以使用 WASD 键上下左右行走,鼠标移动转向。
  • 上传内容到自己的土地
    因为 dcl 上传的场景内容是保存在 ipfs 上的。所以为了上传场景内容,首先要开启 ipfs 本地服务。
      下载 ipfs
    • Mac OS X and Linux 下安装
      1. $ tar xvfz go-ipfs.tar.gz $ cd go-ipfs $ ./install.sh   
      复制代码
    • ipfs 配置
      1.   ipfs init
      复制代码
    • 运行 ipfs 服务
      1. $ ipfs daemon   Initializing daemon...   Swarm listening on /ip4/127.0.0.1/tcp/4001   Swarm listening on /ip4/192.168.36.188/tcp/4001   Swarm listening on /ip6/::1/tcp/4001   Swarm listening on /p2p-circuit/ipfs/QmTpjEfoRDEG8pzny3NmoRxyYR5eNs7Fknp1ayaCsHBBn8   Swarm announcing /ip4/127.0.0.1/tcp/4001   Swarm announcing /ip4/192.168.36.188/tcp/4001   Swarm announcing /ip6/::1/tcp/4001   API server listening on /ip4/127.0.0.1/tcp/5001   Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080   Daemon is ready
      复制代码
    1. [/code][/list]在浏览器中打开 [url=http://localhost:5001/webui]http://localhost:5001/webui[/url] 可以查看 ipfs 网络连接情况。
    2. ipfs 服务开启后,就可以上传场景内容了,这一步只使用一个命令
    3. [code]$ dcl deployTracked files: scene.js (443435 bytes) scene.json (490 bytes)? You are about to upload 2 files (443925 bytes). Do you want to continue? Yes Uploading files to local IPFS node Checking IPNS for coordinates 36,-16 Publishing IPNS for /ipfs/QmW43TKERbU8x1gwJBfuKabXw4etBhSptx4VDpMyM5a IPNS hash: QmVtpGyrBb3qbpfr6P8j71NYPnYryQgkRvh9K8h9DRW Pinning files to IPFS gateway Deployment complete!
    复制代码
    此命令主要有两个功能:一是上传场景文件到 IPFS。二是将场景文件的 IPNS 与 LAND 土地对应起来。
    在这里它会自动打开浏览器,然后在浏览器里中登录自己的 metamask,再点击 DEPLOY 发布。会弹出 metamask 的对话框。点击确认。等待以太网络确认交易。确认交易后上传即可完成。



    我自己在实际操作中,遇到两个问题:
    • 卡在确认交易这里很长时间,虽然 metamask 显示交易已经发送,但是 https://etherscan.io 上却查不到此笔交易。一直找不到问题,后来试着在 metamask 中自行发了两笔转帐,也是同新的问题,才意识到是 metamask 出了问题。最后在 metamask 中 reset 了帐户,然后再重试 dcl deploy 命令解决。
    • 确认交易后其操作中没有自动进行下去。我用 CTRL + C 中断了 dcl deploy 的运行,然后重新运行 dcl deploy 一下就行了。
    最终的效果,内测用户可以到我的土地地址上看一下,不是内测用户可以点击这个链接看一下:https://dcl-project-dshxwziwho.now.sh/?position=36%2C-17
             
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:65
帖子:4
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP