当前位置: 首页 > 软件库 > Web3 > 区块链 >

nifty-game

授权协议 MIT License
开发语言
所属分类 Web3、 区块链
软件类型 开源软件
地区 不详
投 递 者 邓鸿彩
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Non-fungible token game

This project is a crypto card game that uses OpenZepplin.

The contract is compiled and deployed under the ERC-721 non-fungible token standard with truffle framework. After deploying onto the Ethereum blockchain, users will be able to play the game by interacting with the smart contract through DAPP’s front-end interface.

Acquiring game card:Users can acquire game cards using ETH. Every game card will have a game point on it, which will be used to determine the winner later in the game.

Roles

Card Collection

Players can aquire card using ether. Each card will have a random points on it, which will be used to deternmine the winner in the card game.

Card Battle

Once entered the game, players will need to choose a card to play for the round. Each round, the smart contract will randomly decide either card with larger or smaller point wins the round. At the same time, the smart contract will also randomly generate a number in order to compete with the player. Winner of the game will receive the price.

Dashboard

You can view the card battle history about all the games you played.

ERC-721 Token

ERC-721 non-fungible token:ERC-721 is a free, open standard that describes how to build non-fungible or unique tokens on the Ethereum blockchain. While most tokens are fungible (every token is the same as every other token), ERC-721 tokens are all unique (with unique ID).

Reference

Contracts

You can find contract detail under contracts/ directory:

Technical stack

Frontend

  • React
  • Redux
  • Saga
  • Web3(MetaMask)

UI

  • Sass
  • Material-UI

Smart contract/Solidity

  • Truffle

Test environment/Private chain

  • ganache

Requirements

  • NodeJS 8.0+ recommended.
  • Windows, Linux or Mac OS X.

How To Install Dependencies

First install required dependencies:

You'll need local ethereum node, I recommend ganache-cli. You can install it from npm.

npm install -g ganache-cli

Install truffle:

npm install -g truffle

Then install contract dependencies:

npm install

How To Test

First make sure that local ethereum node is running. Execute:

ganache-cli --gasLimit 0xffffffffff -p 8545

Now you can compile and deploy contracts:

truffle compile && truffle migrate

Run contract tests:

truffle test

Playground

We already deployed contracts to Ropsten network. You can play with them RIGHT NOW.

Contract Token address Transaction hash
CryptoHerosGame 0xb4FF27d8cD1C5b1e3D4BD8A8FFEBdA9BE9517a4b 0x49bb8698e2951a0c7eb091038b500694cdf37c74ec51d6c98d91823dc9595b95
CryptoHerosToken 0xa82Bc392bF65d03A796E1666d27594fB31De4B93 0xf41868e6b59020965831aac218e1a521b283ab4975f10a44cf0908f6ce586ad7

Card List

See CARD.md for more information.

Contributing

See CONTRIBUTING.md for how to help out.

Licence

See LICENSE for details.

 相关资料
  • Nifty是facebook公司开源的,基于netty的thrift服务端和客户端实现。 然后使用此包就可以快速发布出基于netty的高效的服务端和客户端代码。 示例: public void startServer() { // Create the handler MyService.Iface serviceInterface = new MyServiceHandler();

  • 问题内容: 我目前正在用Java开发一个小平台,并为此编写了自己的游戏引擎,名为Bonsai。现在我问自己一个问题:“我是否过度使用了静态方法?”。 一方面,这非常方便,因为我不必在每个类(例如地图或玩家)中都引用游戏实例。另一方面,我已经不得不去除applet的支持了,因为那里所有静态的东西都非常小。 所以我的问题是,由于您可能比我更有经验的Java程序员,我应该摆脱所有的静态知识吗?如果是的话

  • 问题内容: 我需要帮助在游戏场景中呈现警报视图。我目前正在努力做到这一点,例如GameScene.Swift不是标准的ViewController。如果有帮助,我需要这样做,因为我需要用户输入一个值,该值用作游戏中球Sprite Kit节点的坐标。输入只是一个标准整数,因此这不是问题。也欢迎通过警报视图实现此操作的其他任何想法。 那是在GameViewController文件中 谢谢 问题答案:

  • 问题内容: 我一直在玩SpriteKit,并且对如何从代码中驱动它有了相当不错的感觉,但是对于Xcode 6中包含的关卡编辑器却颇为困惑。 我已经看过wwdc视频(“平台联合状态”和“ spriteKit中的新功能”),并在网上搜寻,但未能找到有关关卡编辑器及其实际功能的大量描述。 我不明白,模板设置的两个文件之间有什么关系?.sks文件是GameScene.swift文件的表达式还是它包含的Ga

  • 问题内容: 我想“重置”和“重启” GameScene,就好像第一次调用GameScene一样。我已经研究了执行此操作的不同方法,但是每次收到警告时,我都试图将节点添加到已具有父级的父级。但是,在我的代码中,我删除了所有现有节点,因此我对如何重置GameScene感到非常困惑。这就是我现在的操作方式(当我想从头开始重新启动GameScene时调用此代码,并在GameScene类中调用此代码): 1

  • 问题内容: 我在main.storyboard上创建了一个UI元素,需要隐藏该元素,直到游戏结束,并且一旦玩家点击屏幕将其关闭即可。Main.storyboard链接到GameViewController,因此我所有的IBOutlet和IBActions都在其中,而我所有的游戏代码都在GameScene中。我如何将视图控制器链接到场景,以便弹出图像和按钮仅在游戏结束时出现。非常感谢您的帮助,我已经