Integration of Ably for Real-Time Game Events in Factile and Its Advantages Over PubNub
One of our client’s projects, Factile, a dynamic jeopardy-style game platform designed for topic reviews, has recently upgraded its real-time event handling by transitioning from PubNub to Ably. This change was driven by the need for better payload capacity and guaranteed event order, which are essential for ensuring smooth gameplay in Factile’s multi-player and multi-team environments.
The decision to switch from PubNub to Ably was influenced by three main factors:
- Increased Payload Capacity: PubNub supports a maximum payload of 32KB, which was insufficient for Factile’s needs. Ably, with its 64KB payload limit, allows for more data to be transmitted in a single game event. This is crucial for Factile, which supports up to 100 teams with up to 10 members each. Handling the data for such a large number of players was not feasible with PubNub’s limitations, requiring data to be split into multiple chunks.
- Guaranteed Event Order: PubNub does not guarantee (till the time of shifting) that events sent in sequence will be received in the same order, leading to synchronization issues during gameplay. This limitation resulted in hard-to-trace bugs that disrupted the gaming experience. Ably guarantees the delivery order of events, which is critical for Factile’s real-time competitive environment where the order of responses can determine game outcomes. Testing with Ably involved sending 100 messages in a loop, and all were received in sequence every time, unlike with PubNub, which frequently delivered messages out of order.
- Firewall Compatibility: Factile is frequently used in schools and educational institutions where firewalls are common. PubNub worked without issues, but Ably initially faced firewall blocking. Ably provided an option to add DNS CNAME records, allowing requests to be redirected through our server. This solution effectively resolved the firewall blocking issue, ensuring uninterrupted access to Factile.
Integrating Ably into Factile’s architecture has brought several benefits:
- Enhanced Real-Time Communication: With Ably’s higher payload capacity, Factile can handle more complex game states and player interactions in a single event. This reduces the need to split data into smaller chunks, simplifying the data transmission process and improving performance.
- Reliable Multi-Player Synchronization: The guarantee of event order provided by Ably ensures that all players receive updates and events in the correct sequence. This is crucial for maintaining fairness and clarity during gameplay, particularly in buzzer-mode where timing is essential.
- Scalability and Performance: Ably’s infrastructure is designed to handle high volumes of events with low latency, making it ideal for Factile as the platform grows. This scalability ensures that Factile can accommodate a larger number of players and more complex game scenarios without compromising performance.
- Simplified Data Handling: Previously, Factile had to break down large data exceeding 32KB into 2-3 chunks when using PubNub. These chunks had to be reassembled on the subscriber side, which was complicated by the lack of guaranteed order. Ably’s 64KB payload capacity eliminates this issue, allowing for single, cohesive events to be sent and received without fragmentation.
- Firewall Solutions: Ably’s provision for DNS CNAME records to redirect requests through our server has solved firewall blocking issues commonly encountered in educational institutions. This feature ensures that Factile remains accessible in restrictive network environments.