基于区块链的毕业设计CSC2421_ETH_AutoChess – CSC2421u ETHu自动切割器

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计CSC2421_ETH_AutoChess – CSC2421u ETHu自动切割器 是一篇很好的国外资料

CSC2421_ETH_AutoChess

Sections

  1. Introduction
  2. Related Work
  3. AutoChess
  4. Discussion
  5. Conclusion

Introduction

Blockchain provides a decentralized environment to perform consensus and log replication between several nodes. In recent years, blockchain has been used in several different areas to come up with a decentralized solution that enhances their product space or solution space. Most of these advances have happened in the finance domain because of the nature of how blockchain was introduced to the world. Gaming industry is one such field where the introduction and use of blockchain has seen a massive support from the gaming community. A blockchain based game Cryptokitties was so popular when it was launched in 2017 that it had caused a network congestion on the Ethereum network.

Decentralized blockchain applications have provided many benefits that are desirable to the gaming community. One of the most prominent one of them is being able to own and trade in game virtual assets on a common marketplace off game using non fungible tokens that can be logged by the blockchain instead of a central server. There are several other benefits like the core gameplay logic is publicly visible to all and game ownership is not limited to developers only but players themselves can also develop and introduce additional content for these games to the public over the blockchain network.

We introduce AutoChess, a novel blockchain based game that lets users create squads from their units and deploy them into battles with other player’s squad for a chance to win tokens.

The rest of this report is structured as following. Section 2 introduces some related work. Section 3 covers the general design and salient features of AutoChess. Section 4 covers how blockchain is used for AutoChess. Section 5 visits some future direction for AutoChess. Section 6 discusses some issues wrt AutoChess. Section 7 concludes the report.

Related Work

Initially there were two main types of blockchain games that were developed. First is the Non-fungible token games. Such games introduced non-fungible tokens(NFTs) that users own. Users can then sell these NFT assets. Examples of such games are Cryptokitties, cryptozombies and many more. The Second category of games is gambling games. These games allow users to bet their tokens on some event and then reap rewards based on outcomes. Fomo3d is one such game. With AutoChess we try to include both types of functionality in one game. We allow NFT type units to be owned by users. Users can trade and auction these units.

AutoChess

This section covers the basic game design of the game and its core features. AutoChess is broadly a battle simulation game inspired by auto battlers like Dota Auto Chess or Team Fight Tactics. It lets players initiate squad battles with other players. The incentive for players is to win these battles to earn rewards. Squads themselves are formed with units, so to build a squad, players need units. Units need to be purchased from the store using tokens which is an investment from the players to play the game. Once a player creates their squad for battle they can challenge the squads of other players. The result of the battle and the winnings if any are then communicated back to the player. There is however more to AutoChess than just a battle simulation and more details follow in the following subsections.

Features

Units

Units that are used to create squads actually participate in the battle individually as explained previously. Each of the units created in AutoChess have the following attributes: level, power, defence, health and name. The level is used when computing the price of the unit as well as the bonus from later level ups. The power determines how much damage the unit does in combat. The defence and health attributes determine the units survivability in combat. The defence of a unit reduces any incoming damage by it’s value, whereas health defines how much total damage a unit can sustain, after the reduction from defence. The name is purely cosmetic and allows players to customize their units. Units can level up and receive a bonus to power, health and defence. Total health is linear in level while attack and defence are quadratic.

Unit Types

AutoChess allows players to choose from 3 different unit types when buying units from the store. The unit types are Warrior, Archer and Cavalry. Each of these unit types are configured to be better than the other two in one of the 3 main attributes defined above. Warriors have high defence, Archers have high attack, and Cavalry have high health.

Squad Tiers

To make the squad battles happen between relatively similar powered squads, AutoChess introduces squad tiers. Players can create squads for different tiers based on how many units are part of it. During a battle only the same tiered squads will engage in battle. There are four tiers with squads sizes of 1,3,5 or 7 units. This ensures players owning more units cannot overpower new members. It also allows players with many units to leverage them for greater rewards, while allowing players with fewer units to still participate.

Because squads can only be attacked after they attack another squad there must be some initial squad for the first player to challenge. This initial squad is in the form of a default all cavalry squad owned by the game. There is one default squad for each tier and after battles the units in the squad are not killed, nor is the squad retired. Therefore, whenever a player challenges one of the default squads the number of deployed squads will increase by one.

Battles

Battles are performed as follows. The squads take turns attacking each other but only the damage to the defender is ever saved to the state. The first unit (or a random unit depending on implementation) in each squad deals damage to the last living unit in the other squad. The damage is reduced by the unit receiving damage’s defence stat. If a units health would be reduced by 0 it is marked as dead instead. After a fixed number of rounds or when one squad is all dead. After the battle the defenders state is saved, while the attacker is left unchanged. Tokens are awarded to the owners of each squad based on the value of the units that died (40% for the defender, and 60% for the attacker). Any surviving units in the defender are leveled up and receive stat increases. See Appendix ref{sec:code} for detailed pseudo-code.

Discussion

Limited Throughput

One of the major hindrances when using blockchain for backend storage is the limited transaction throughput that the blockchain network supports. With this limitation supporting large multiplayer games with blockchain is an issue. Every action by any player that needs to change the blockchain state becomes a new transaction in the network. So, if the number of players grow the number of transactions being put into the network will also increase. Large number of transactions will then cause network congestion and thus delay in transaction processing. This is more of an issue to games which are more interactive with the transactions they issue for each user action. There are two potential solutions to this issue, one is to batch several actions into a single transaction thereby reducing the effective number of transactions that the blockchain network has to process and replicate to all nodes. Batching is not always possible especially in cases where user actions that change the blockchain state affect or influence the next action that the player has to perform. Second potential solution is to use a blockchain network that allows higher transaction throughput and is thus naturally more scalable to massive multiplayer games. Since, AutoChess is a battle simulation game, the whole battle logic can be batched into a single transaction instead of having single turn based attacks create individual transactions. There are more areas of improvement with respect to batching multiple transactions into one in AutoChess and can be exploited to help reduce the burden of large number of transactions in a limited transaction throughput blockchain network.

Gas Costs

In addition to the to the low processing speed of blockchain networks another drawback for interactive applications is the transaction fees. Each transaction is charged fees for using network resources (i.e. storage, computation) this includes a base fee of approximately 21000 gas)for any transaction. This means that applications relying on many small updates will be prohibitively expensive to the user due to the base transaction fee. Whereas, applications relying on fewer large updates will have to contend with very large fees that may be off-putting to users and will potentially be less interactive.

We considered several approaches to resolving this issue. However, were ultimately unsuccessful at lowering costs to an acceptable level. The reason for this is that even ignoring the cost of computations related to playing the game, the act of loading, verifying the integrity of, and saving the state required for a battle takes 400,000 gas.

User Submitted Proofs of Computation

One optimization implemented in the Smart Contract is to use a zero knowledge Succinct Non-interactive Arguments of Knowledge to allow users to submit proofs of their results instead of having the smart contract compute the results, allowing for the processing of battles in near fixed time. This process was implemented using the zokrates library and G16 proving scheme.

Using this process we were able to simulate a battle with 50 rounds at a cost of 400k gas. There are several ways this could be reduced further. There are several other proving schemes for zoKrates that could be used to potentially reduce costs. The zokrates language does not support unbounded iteration and dynamic arrays so squad sizes are padded to 7 with blank units. Since the verifier performs an operation for each input, the cost of verification for small squad sizes is dramatically increased. This could be avoided by creating one verifier for each tier. This is not without drawbacks as the client would have to load an additional key and the contract would have to deploy an additional library for each tier. While this cost is significant it potentially scales much better than computing the whole game on chain. This can be tested using the provided makefile.

However, the front-end still uses the block-chain to compute the result due to the high fixed cost of the zksnark solution making it equally impractical at this point.

Challenge System

Another approach we considered to reduce the gas cost of the contract was to make the battles optimistic in nature.

Instead of the contract computing the result, the owner of each squad s submits the result of its attack during deployment. This is stored by the contract but not finalized until a later point in time. Until the result is finalized it can be challenged by any party. We finalize the result of an attack after the squad that attacked is itself attacked. As an example, the result of B attacking C is saved at that point, but only finalized once A attacks B.

Additionally,When a squad deploys it is given a grace period during which no other squads can attack it. This guarantees that the owner of the defending squad will have a chance to challenge the results before they are finalized. Detailed pseudo-code is available in Appendix

There are drawbacks to this approach in that it introduces additional security concerns (e.g. block timestamp manipulation) as well as requires the storing of extra data for each squad that may outweigh the benefits. However, the most significant drawback is that since challenging is more expensive then submitting false results there will be cheating for which the cost of verifying outweighs the damages. This could potentially be mitigated by generating new assets for the aggrieved player but that would come at the cost of further increased challenge costs.

Regular Server as a Cache

One optimization we considered but ultimately didn’t develop was hosting a web-server and database to offload storage of unnecessary but space consuming state data. Since there is currently no server all persistent information must be stored on the block-chain including strings like the names of units, and auctions. We were able to mimic this to some extent using session storage in the browser. This allows users to create and temporarily save squads without communicating with the block-chain.

If trust in the regular server is high this might yield benefits when combined with the optimistic battle system by reducing the number of transactions that need to be challenged.

Strategy

Another things that games need to consider is the strategy that invites new players to play the game and keeps the players already playing the game hooked to it. The NFT based games like Cryptokitties have already shown how popular they can be. Being able to own and trade in NFT’s is interesting enough for users to play any such game as long as the NFT’s in play are interesting to the community. Gambling games however need to consider some strategy to hook players to play the game. AutoChess uses two ways to motivate people to play. First, AutoChess models the battle simulation gameplay in such a way that winning battle is also about strategy than just luck and randomness. Players with better strategy would stand higher chance of winning their squad battles. This itself would make people challenge others to show the world that they are a better strategist. Secondly, AutoChess uses the player’s NFT units to issue the gambling based squad battle. Similarly winning squad battles allows players to upgrade their NFT units with some form of battle experience. This way the players who want to play the game for it’s NFT auction and trade gameplay have to get involved in the gambling based squad battle to upgrade their units uniquely.


CSC2421_ETH_AutoChess

Sections

  1. Introduction
  2. Related Work
  3. AutoChess
  4. Discussion
  5. Conclusion

Introduction

区块链blockchain提供了一个分散的环境来执行多个节点之间的共识和日志复制。近年来,区块链blockchain已被应用于多个不同领域,以提出一种分散的解决方案,增强其产品空间或解决方案空间。这些进展大多发生在金融领域,因为区块链blockchain是如何被引入世界的。游戏行业就是这样一个领域,区块链blockchain的引入和使用得到了游戏界的大力支持。一款基于区块链blockchain的游戏Cryptokitties在2017年推出时非常受欢迎,导致以太坊eth网络出现网络拥塞。

分散的区块链blockchain应用程序提供了许多游戏社区想要的好处。其中最突出的一个是能够使用区块链blockchain(而不是中央服务器)记录的不可替代代币在游戏外的公共市场上拥有和交易游戏虚拟资产。还有其他一些好处,比如核心游戏逻辑对所有人都是公开的,游戏所有权不仅限于开发者,玩家自己也可以通过区块链blockchain网络为这些游戏开发和引入额外的内容。

我们推出了一款基于区块链blockchain的新型游戏AutoChess,它允许用户从自己的单位创建小队,并将其部署到与其他玩家的小队的战斗中,以获得赢得代币的机会。

本报告其余部分的结构如下。第二节介绍了相关工作。第3节介绍了汽车离合器的总体设计和显著特点。第4节介绍了区块链blockchain如何用于自动缓存。第5节探讨了汽车的未来发展方向。第六节讨论了与汽车有关的一些问题。第7节结束报告。

Related Work

最初开发的区块链blockchain游戏主要有两种类型。首先是不可替代的代币游戏。这类游戏引入了用户拥有的不可替代代币(NFT)。用户可以出售这些NFT资产。这类游戏的例子有Cryptokitties、cryptozombies等等。第二类游戏是赌博游戏。这些游戏允许用户在某些事件上下注,然后根据结果获得奖励。Fomo3d就是这样一款游戏。我们尝试在一个游戏中包含这两种类型的功能。我们允许NFT类型的单元归用户所有。用户可以交易和拍卖这些单位。

AutoChess

本节介绍游戏的基本游戏设计及其核心功能。AutoChess是一个广泛的战斗模拟游戏,灵感来自于像Dota自动象棋或团队战斗战术这样的自动战斗者。它可以让玩家与其他玩家发起小组战。玩家的动机是赢得这些战斗以获得奖励。小队本身是由单位组成的,所以要建立一个小队,球员需要单位。单位需要从商店购买使用代币,这是一个投资从玩家玩游戏。一旦一个玩家创建了他们的战斗队伍,他们就可以挑战其他玩家的队伍。战斗的结果和赢的钱(如果有的话)会传回给玩家。不过,autoches不仅仅是一个作战模拟,更多细节将在下面的小节中介绍。

Features

Units

如前所述,用于创建小队的单位实际上单独参与战斗。每一个单位都有以下属性:等级,力量,防御,生命值和名字。当计算单位的价格以及后期升级的奖金时,将使用该级别。力量决定了单位在战斗中造成的伤害。防御和健康属性决定了部队在战斗中的生存能力。一个单位的防御减少了它的价值,而健康定义了一个单位在防御减少后能承受多少伤害。这个名字纯粹是装饰性的,允许玩家自定义他们的单位。单位可以升级并获得能量、生命和防御加成。总健康水平是线性的,而攻击和防御是二次的。

Unit Types

当玩家从商店购买单位时,自动切纸允许玩家从3种不同的单位类型中进行选择。单位类型有战士、弓箭手和骑兵。在上面定义的3个主要属性之一中,这些单元类型中的每一个都被配置为比其他两个更好。战士有很高的防御力,弓箭手有很高的攻击力,骑兵有很高的健康度。

Squad Tiers

为了使队伍战斗在相对相似的有动力的队伍之间进行,AutoChess引入了队伍层级。玩家可以根据队伍中有多少单位来创建不同等级的队伍。在一场战斗中,只有相同的梯队才会参战。有四层,小队规模为1、3、5或7个单位。这可以确保拥有更多单位的玩家无法战胜新成员。它还允许拥有许多单位的玩家利用这些单位获得更高的奖励,同时允许拥有较少单位的玩家仍然参与。

因为队伍只有在攻击另一个队伍后才能被攻击,所以必须有一个初始队伍,第一个玩家才能挑战。这个初始的队伍是以默认的所有骑兵队伍的形式存在的。每层都有一个默认的小队,战斗结束后小队中的单位不会被杀死,小队也不会退役。因此,每当玩家挑战一个默认的小队时,部署的小队数将增加一个。

Battles

战斗执行如下。各队轮流攻击对方,但只有对防守队员造成的伤害才会被保存到州里。每个小队中的第一个单位(或一个随机单位,取决于执行情况)对另一个小队中最后一个活着的单位造成伤害。受到伤害的单位的防御属性会降低伤害。如果单位的生命值会降低0,则会被标记为死亡。在一个固定的回合数之后或者当一个小队都死了的时候。战斗结束后,防御者的状态被保存,而攻击者则保持不变。根据死亡单位的价值(防御者40%,攻击者60%)将代币奖励给每个小队的所有者。防御者中任何幸存的单位被升级并获得属性提升。见附录{sec:代码}详细的伪代码。

Discussion

Limited Throughput

区块链blockchain用于后端存储时的主要障碍之一是区块链blockchain网络支持的有限事务吞吐量。有了这个限制,用区块链blockchain支持大型多人游戏是一个问题。任何玩家需要改变区块链blockchain状态的每一个动作都成为网络中的新交易。因此,如果玩家的数量增加,被放入网络的交易数量也会增加。大量的事务将导致网络拥塞,从而延迟事务处理。对于游戏来说,这是一个更重要的问题,因为游戏与每个用户动作的事务更具交互性。对于这个问题有两种可能的解决方案,一种是将多个操作批处理成一个事务,从而减少区块链blockchain网络必须处理并复制到所有节点的有效事务数。批处理并不总是可能的,尤其是在改变区块链blockchain状态的用户操作影响或影响玩家必须执行的下一个操作的情况下。第二个可能的解决方案是使用区块链blockchain网络,它允许更高的交易吞吐量,因此自然更适合大规模多人游戏。由于AutoChess是一个战斗模拟游戏,因此可以将整个战斗逻辑批处理到单个事务中,而不是让基于单回合的攻击创建单个事务。在autoches中将多个事务批处理为一个事务方面还有更多的改进,可以利用这些改进来帮助减少有限事务吞吐量区块链blockchain网络中大量事务的负担。

Gas Costs

除了区块链blockchain网络的低处理速度之外,交互式应用程序的另一个缺点是交易费用。每笔交易都要收取使用网络资源(即存储、计算)的费用,这包括任何交易的基本费用(约21000燃气)。这意味着依赖于许多小更新的应用程序将由于基本事务费用而对用户昂贵得令人望而却步。然而,依赖较少的大型更新的应用程序将不得不面对非常大的费用,这些费用可能会让用户感到不快,并且可能会降低交互性。

我们考虑了几种解决这个问题的方法。然而,他们最终未能将成本降低到可接受的水平。其原因是,即使忽略与玩游戏相关的计算成本,加载、验证完整性以及保存战斗所需状态的行为也需要40万汽油。

User Submitted Proofs of Computation

智能合约中实现的一个优化是使用零知识简洁的非交互知识参数,允许用户提交结果证明,而不是让智能合约计算结果,允许在固定时间内处理战斗。这个过程是使用zokrates库和G16证明方案实现的。

使用这个过程,我们能够模拟一场50发子弹、耗资40万汽油的战斗。有几种方法可以进一步减少这种情况。对于zoKrates,还有其他几种证明方案可以用来潜在地降低成本。zokrates语言不支持无界迭代和动态数组,所以团队规模用空白单位填充为7。由于验证器对每个输入执行一个操作,因此小队规模的验证成本显著增加。这可以通过为每层创建一个验证器来避免。这并非没有缺点,因为客户机必须加载一个额外的密钥,而契约必须为每个层部署一个额外的库。虽然这个成本是巨大的,但它的扩展性可能比计算整个游戏链要好得多。可以使用

However, the front-end still uses the block-chain to compute the result due to the high fixed cost of the zksnark solution making it equally impractical at this point.

Challenge System

Another approach we considered to reduce the gas cost of the contract was to make the battles optimistic in nature.

Instead of the contract computing the result, the owner of each squad s submits the result of its attack during deployment. This is stored by the contract but not finalized until a later point in time. Until the result is finalized it can be challenged by any party. We finalize the result of an attack after the squad that attacked is itself attacked. As an example, the result of B attacking C is saved at that point, but only finalized once A attacks B.

Additionally,When a squad deploys it is given a grace period during which no other squads can attack it. This guarantees that the owner of the defending squad will have a chance to challenge the results before they are finalized. Detailed pseudo-code is available in Appendix

There are drawbacks to this approach in that it introduces additional security concerns (e.g. block timestamp manipulation) as well as requires the storing of extra data for each squad that may outweigh the benefits. However, the most significant drawback is that since challenging is more expensive then submitting false results there will be cheating for which the cost of verifying outweighs the damages. This could potentially be mitigated by generating new assets for the aggrieved player but that would come at the cost of further increased challenge costs.

Regular Server as a Cache

One optimization we considered but ultimately didn’t develop was hosting a web-server and database to offload storage of unnecessary but space consuming state data. Since there is currently no server all persistent information must be stored on the block-chain including strings like the names of units, and auctions. We were able to mimic this to some extent using session storage in the browser. This allows users to create and temporarily save squads without communicating with the block-chain.

If trust in the regular server is high this might yield benefits when combined with the optimistic battle system by reducing the number of transactions that need to be challenged.

Strategy

Another things that games need to consider is the strategy that invites new players to play the game and keeps the players already playing the game hooked to it. The NFT based games like Cryptokitties have already shown how popular they can be. Being able to own and trade in NFT’s is interesting enough for users to play any such game as long as the NFT’s in play are interesting to the community. Gambling games however need to consider some strategy to hook players to play the game. AutoChess uses two ways to motivate people to play. First, AutoChess models the battle simulation gameplay in such a way that winning battle is also about strategy than just luck and randomness. Players with better strategy would stand higher chance of winning their squad battles. This itself would make people challenge others to show the world that they are a better strategist. Secondly, AutoChess uses the player’s NFT units to issue the gambling based squad battle. Similarly winning squad battles allows players to upgrade their NFT units with some form of battle experience. This way the players who want to play the game for it’s NFT auction and trade gameplay have to get involved in the gambling based squad battle to upgrade their units uniquely.

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/21570.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计CSC2421_ETH_AutoChess – CSC2421u ETHu自动切割器

提供最优质的资源集合

立即查看 了解详情