This is a Head Soccer style game - run on Ethereum - built by Cocos Creator.
Live Game: PLAY
(Make sure you are using Rinkeby and have some Ether in your account)
- Game Client: Cocos creator
- Blockchain: Ethereum
- Smart Contract: Truffle
- Game-Blockchain Connection: Web3js
- Make sure you have got truffle installed: https://github.com/trufflesuite/truffle/releases
- Go to
/smart-contracts
- Copy
.env.example
to.env
and config your keys here:
cp .env.example .env;
- Install dependencies:
yarn install
- Compile && migrate to network you want (for example
rinkeby
):
truffle migrate --reset --network rinkeby
- now you have built contracts in
/assets/contracts
- Install Cocos Creator: https://www.cocos.com/en/creator (this game was built by version 2.2.0, use higher version may lead to lost metadata when open scene).
- Open project, you will see 2 scene:
Home
andPlayGame
- All connection beetween game and blockchain was implemented in class
Web3Controller
, in case you want to use your own smart contract, change theContractABI
inside theWeb3Controller
component. - Select
Browser
and run it. - If you want to publish anywhere on internet, built it and deploy on your server. References here: https://docs.cocos2d-x.org/creator/manual/en/publish/publish-web.html
- Due to short development duration, of course we made some bugs!
- Because we have many asynchronous actions, sometime it will not update page when transaction is completed or when switch network.
- In future, we will solve all bugs, and support more chain like Mainchain, Ropsten, Kovan, Loom, Tomochain....
Enjoy Coding