Taking the initial steps to building on a blockchain can be rather daunting if you don’t know the tips and tricks that will save you hours of development and research time. dfuse is talking to experienced blockchain developers in the community so as to pass this valuable information along. This week we spoke with Jimmy Gong from EOS Dynasty.
Could you introduce yourself?
I am Jimmy Gong, the technical leader from 7th Continent Studio team and a blockchain developer. I have 10 years of experience in software development and have worked in the fields of telecommunications and industrial robotics. In 2017, I was exposed to blockchain and was deeply attracted to it. In 2018, I started my work in the blockchain industry. The combination of blockchain and games is a direction we have always been very optimistic about, and 7th Continent Studio team is constantly striving and exploring.
What made EOS Dynasty into one of the most active dapps on the EOS mainnet right now? What attracts players to EOS Dynasty?
EOS Dynasty is a casual game based on the Three Kingdoms, which is a historical theme beloved by Chinese and other Asian players. Since the launch of the EOS Dynasty in May this year, we have received a lot of love and support from our players. We are very happy about what we have created. I’d like to share a few points why EOS Dynasty is unique:
First, as an on-chain game, naturally it has trading and financial attributes. While casually playing the game, players can easily trade items within the in-game marketplace to earn EOS.
Second, we introduced a token economy in the game. A portion of the game’s revenue is returned to the players as dividends, and both early players and new players alike can be rewarded through this dividend mechanism. There is also a reasonable mining mechanism in the game that can increase the player’s activity. The token economy has become an indispensable in-game element. We will also continue to introduce more fun elements as well.
Third, we run a tight-knit community. The team and the players communicate and interact very often. Players provide suggestions and directly affect the development of the game. The game is currently in the process of rapid iteration, and many of the game features and functions are based on recommendations from the player community.
What are the main challenges you faced while developing a marketplace on blockchain, specifically on EOS? How did you solve them?
EOS Dynasty is a fully on-chain game, meaning all of its data and operations are on the EOS blockchain. EOS does provide a powerful infrastructure for on-chain games thanks to the quality service provided by the EOS Block Producer community and the fast-growing EOS user-base. Other than covering our own resource overhead, we did not need to build many additional tools. On the other hand, our game server provides an enhanced experience and auxiliary modules for the game, such as the in-game marketplace which allows thousands of in-game materials and equipment to be traded quickly and easily. This is supported by the powerful features provided by dfuse. Switching to building our back-end services on dfuse, the architecture was simpler, more reliable, more flexible, and easier to scale.
What do you need to take in consideration when building a game that can scale to thousands of active users on chain?
To build an in-game marketplace on a blockchain, we have to consider two typical solutions. One is to use a centralized server which interacts with the chain, handles the transfer transactions, etc. The advantage of this solution is to provide a quick search. The disadvantage is that it is easy to lose the transaction, or the transaction on the central server doesn’t match the one on-chain. An example would be when an item has been sold, but the payment has not arrived. One solution is to perform the whole transaction on-chain. The advantage of this method is that the data consistency is guaranteed. The disadvantage is that the index and query cannot be well supported. For example if the player needs certain in-game assets, the price could be sorted based on the thousands of rows table data, but EOS is yet to provide an API for this.
What we have adopted is a mixed solution, which first uses fully on-chain trading, then indexes it on the back-end. This provides players with flexible indexing and query services while ensuring data consistency. But the ensuing problem is that the back-end service data and the chain data needs to be updated in a timely manner. This is hard to do when infrastructure and services are lacking in the EOS community. Fortunately, with dfuse Stream, we can get the game asset table delta in the contract in real-time for the server, and update the status of the trading order delta. Any user’s purchase or pending order will be synced to the game server by dfuse in time to update all users.
When using dfuse Stream, we also have some experience to share with you. First, try to use the official SDK library. Second, handle well the disconnection and reconnection, to prevent missing data when streaming. Third, if run into problems such as firewalls, consider how your code should gracefully degrade the service. When the subscription service is temporarily disconnected, sync with the pulling method, so that the service is not interrupted.
In the nearly three and a half months since the launch of the EOS Dynasty, the in-game trading market has been running steadily, accumulating more than 1,300,000 asset transactions, and the accumulated asset trading volume has exceeded 50,000 EOS.
What advice would you give to a developer who wants to build a project on blockchain?
I have two things that I would like to share with you：
1. Transform your way of thinking for development. There are great differences in the way of development and problems-solving between traditional software and blockchain development. Understand the underlying operation mechanism of the chain, so you can make better use of it. The blockchain mechanism solves problems.
2. Do not reinvent the wheel. Use the existing services that can help you quickly build a stable and reliable project. After all, as the famous Chinese quote says, “Of all the kung fu in the world, only speed can make you unbreakable”
If you think that you have some great insight to share and would like to be featured on “In the Eyes of a Blockchain Developer”, please feel free to reach out to us! We would love to share your story and help inspire the many developers who join the blockchain space each and every day.