Magazine Software Design June 2023: Interview with Daichi Horio and Ryo Tomaru [ part 2 ]
※This article is machine translated.
Explore Cocone’s engineering capabilities to open up a new era of Web3
Top-level performance in the world’s favorite digital world
2nd To enjoy rock-paper-scissors with players from all over the world
JANKEN, Play&Earn’s blockchain service, adds a unique strategic element to the Janken game that everyone knows and allows players around the world to play for free on an equal footing. Continuing from the previous interview, we asked Daichi Horio and Ryo Tomaru of Cocone about the technology that makes global real-time competition possible.
– Please introduce yourself.
Horio: My name is Daichi Horio (Horio) and I am the development leader for the JANKEN project, and my main focus is on client development.
Tomaru: I am also Ryo Tomaru, and I am in charge of server development in the JANKEN development team.
– Please tell us about “JANKEN”.
Horio: One-on-one rock-paper-scissors matches are played in real time, and the first two winners are the winners. The service is simple and easy to enjoy, but it is also interesting to strategize how to play the Rock, Paper, and Scissors cards that are dealt. Players are randomly assigned opponents from all over the world.
Tomaru: Although not as severe as fighting games or racing games, real-time competition requires a different design and implementation than normal API calls.
Implementation Methods for Real-Time Competition
Horio: Since we don’t do much at Cocone that requires real-time competition, we were still searching for a solution at first. You had experience in real-time processing, right?
Tomaru: I have loved games since I was a child, especially MMORPG (Massively Multiplayer Online Role-Playing Game), an online RPG in which many players participate simultaneously. This interest led me to gain knowledge and implementation experience in real-time communication technology.
– How is real-time competition achieved?
Tomaru: JANKEN uses gRPC for data communication between client and server. This is one of the RPC protocols developed by Google, and there are four types of communication methods: (1) Unary RPC, (2) Server streaming RPC, (3) Client streaming RPC, and (4) Bidirectional streaming RPC.
Initially, the game was designed and implemented using (4) in order to use bidirectional communication, but the implementation was more complicated than the other options, and there were concerns that this would hinder quality assurance and future scalability. In addition, since the game design was such that an action (Request) always generated a result (Response), we changed the design to a combination of (1) and (2) (Fig. 1). Although this was a major change, it resulted in a simpler design and made it easier to follow the process.
– What are some of the difficulties in handling real-time competition?
Tomaru: There are many problems that are difficult to anticipate. For example, in terms of communication, games that use a PC or console are often accessed from a relatively stable communication environment, such as at home. However, in the case of smartphone applications, the communication environment is often unstable due to switching between Wi-Fi and carrier lines, or switching carrier base stations as the user moves. In such situations, various problems such as instantaneous disconnections, delays, and disconnections without detecting EOF can occur, which must be taken into account during development. There are also many factors to be considered in the design, such as the need to be constantly aware of I/O load while ensuring data integrity.
For You to Continue to Play with Us in the Future
– You used Unity in the development process.
Horio: The way of thinking differs depending on the organization, but the first thing to consider is whether to use Unity or not. In “JANKEN,” for example, if there is a process other than drawing, such as a logic-oriented process or calculation process, there is no need to use Unity, so it is coded in pure C# classes.
If you rely too much on Unity, you run the risk of making your source code difficult to understand. When communication code, drawing code, logic code, etc. are all mixed together in the same source code, you have to decipher, “What is this about?” and you have to decipher it. We think it is better to separate drawing from the rest for the sake of those who read the code later.
– How do you plan to develop “JANKEN” in the future?
Horio: We are thinking of making improvements in terms of presentation without changing the basic rules or the way the game is played. For example, we would like to make the on-screen presentation more exciting when a player wins.
In “JANKEN,” players play against each other and the machines do not play against each other. It is not possible without many players, so we would like to increase the number of players who will continue to play for a long time to come. For this reason, I think it is important to make the game comfortable and easy to play. Some games are difficult to quit once you start playing, but “JANKEN” can be finished in a few minutes, so we want people to enjoy playing real-time games casually.
Tomaru: Some online games have separate servers for each country of residence (to reduce the risk of load and delay) and can only be played with domestic players, but “JANKEN” allows you to play against players from all over the world, transcending national borders. In this context, we would like to create a service that allows customers to express their own identities while seeing the diversity of the countries of their opponents.
Horio: Since players are accessing the game from all over the world, we believe that we need to strengthen the infrastructure. In fact, since its release, players from all over the world have been playing the game more than we expected. We hope that they will continue to think, ” That was fun. Let’s play again tomorrow “.
Making Janken a worldwide entertainment
Magazine WEB+DB PRESS Vol.133: Interview “The Challenge of Becoming a Server Engineer from a Client Engineer” by Daisuke Okada
Magazine SWITCH Interview “COCONE CREATORS FILE” FILE.07 Creative Director Katsuya Takeuchi