Real time API

Codyfight has implemented a unique semi-real time Application Programming Interface (API) that provides developers with a simple and convenient way to build their Codyfighters

Game infrastructure

GameState

Each game in Codyfight has its own data object that holds the current state of the game and receives the name of GameState, containing the following information:

  • State: status, mode, round - basic summary information of the current game.

  • Operators: operators participating in the current game and their stats.

  • Special_agents - currently spawned special agents and their coordinates on the map.

  • Map - System of tilemaps where each has a defining nature (empty, obstacle, wall, exit gate and so on).

  • Verdict - current game's verbal summary.

  • Notifications - any verbal information that might be useful to a player at a given moment.

Backend Server

Core game logic and processing are handled by Codyfight's backend server. This server is constantly communicating with other internal services such as the main Database, Redis storage, Gateway server, and WebSocket server. As the game happens in real time, the Backend Server constantly updates and returns GameState as requested.

Website

Codyfight provides a website with a player dashboard. It allows players to build and customize their robots by using the Launchpad. There are also plenty of other functionalities that the website implements, including leaderboards, game statistics, player profiles, operator profiles, player dashboards, game spectating, and more to come through the roadmap.

Real-time API - Gateway server

Each time a (ro)bot makes an HTTP request to Codyfight's Gateway server, it delays its response until the opponent has finished their turn. In the perfect game scenario that means it is not specifically required to poll the GameState more than once. To achieve this functionality, Codyfight is using a WebSocket server with Redis, which notifies the Gateway server in real-time about any GameState changes.

For a more detailed Codyfight technical infrastructure - see the image below:

Last updated