Inspiration

The inspiration for Akumen stemmed from the desire to revolutionize the traditional board gaming experience by integrating decentralized technologies. As avid board game enthusiasts and blockchain developers, we saw an opportunity to create a platform that combines the best of both worlds—immersive gameplay and cutting-edge blockchain solutions. Our goal was to provide a seamless, interactive, and secure gaming experience for players worldwide, leveraging the power of decentralized networks.

What it does

Akumen is a decentralized board gaming platform that offers the following features:

  • Play Chess: Users can play chess games in real-time with friends or other players on the platform.
  • Connect Wallet: Users can connect their wallets to manage in-game assets and transactions securely.
  • Live Streaming: Integrated with Theta’s decentralized video services, Akumen allows users to stream their games live.
  • NFT-based Rewards: Players can mint their winning positions as NFTs with some AI generated unique signatures, adding a unique collectible aspect to their gameplay.
  • Staking Mechanism: Players can stake tokens for match requests, adding a competitive and rewarding element to the games.
  • Social Features: Users can follow content creators, add friends, and interact with other players through the platform.

How we built it

Akumen was built using a combination of modern web technologies and blockchain solutions:

  1. Frontend Development: We used React.js for the frontend, providing a dynamic and responsive user interface. Styled-components and CSS modules were utilised for efficient styling.
  2. Blockchain Integration: Theta was chosen as the primary blockchain for managing game assets and transactions. We used ethers.js to interact with the Theta network, enabling wallet connections and smart contract interactions.
  3. Chess Game Integration: The chess game logic was implemented using the chess.js library, and game states were managed through RxJS to handle real-time updates and user interactions.
  4. Decentralized Video: Theta's decentralized video services were integrated to enable live streaming of games and secure video playback using NFT-based DRM.
  5. Backend: Firebase was initially considered for authentication and database management. However, we pivoted to a more decentralized approach to align with the project's vision.]

Detailed High-Level Process for Setting Up a Live Stream with ffmpeg and RTMP stream link

Akumen integrates advanced decentralized technologies to enable seamless live streaming of board games, particularly chess. Our approach leverages the Tether blockchain's Edge cloud for decentralized live streaming, ensuring high performance, security, and scalability. This document provides a detailed explanation of the implementation of our live streaming feature, outlining the complex processes and functions involved.

  • Ingestor Initialization and Livestream Creation: The first step in our live streaming architecture involves initializing the ingestor and creating a live stream. This is done through specific functions that interact with the Tether blockchain's API. The ingestor is responsible for capturing the raw video data, while the livestream creation function sets up the necessary infrastructure to broadcast the video.

  • Backend Server Setup; Our backend is built using Node.js, which sets up an Express server to handle HTTP requests and WebSocket communication. The server listens for incoming video data from the client and processes it in real-time.

  • WebSocket Communication WebSocket is used to facilitate real-time communication between the client and the server. When the client starts streaming, it sends video data through the WebSocket. This data is captured and passed to the FFmpeg process for encoding and streaming.

  • FFmpeg Integration for Video Processing:FFmpeg plays a critical role in our live streaming architecture. It processes the incoming video streams from WebSockets, encodes them in real-time using codecs like H.264 and AAC, and streams the output to the RTMP server. This ensures high-quality video streams with minimal latency.

Command to Start ffmpeg Stream: ffmpeg -f x11grab -s 1920x1080 -i :0.0 -vcodec libx264 -preset veryfast -maxrate 3000k -bufsize 6000k -pix_fmt yuv420p -g 50 -f flv rtmp://localhost/live/your-stream-key Key Point: ffmpeg captures the screen and sends the video feed to the nginx server via RTMP.

  • RTMP Server Configuration: The encoded video stream is sent to an RTMP server. The RTMP server is configured to receive the video stream from FFmpeg and make it available for consumption by clients. This server acts as a middleman, ensuring the video stream is accessible globally.

  • Frontend Integration with Simple Peer Library: On the front-end, we use the Simple Peer library to establish peer-to-peer connections for live streaming. The client captures the screen using getDisplayMedia and sends the video stream through WebSocket to the backend. Simple Peer handles the peer-to-peer connections, ensuring smooth and reliable streaming between the sender and receiver.

Code to Capture Screen:

async function startScreenCapture() { try { const stream = await navigator.mediaDevices.getDisplayMedia({ video: true, audio: true, }); return stream; } catch (err) { console.error("Error: " + err); return null; } }

  • Client-Side Streaming Consumption: The client-side application is designed to consume the live stream. The receiver component uses Simple Peer to connect to the sender, receiving the video stream and displaying it in real-time. This setup ensures that users can watch the live-streamed games with minimal delay.

  • Error Handling and Resilience: Throughout the implementation, we have integrated robust error handling to ensure the system remains resilient. FFmpeg and WebSocket processes are monitored for errors, and appropriate actions are taken to handle any issues, such as restarting the stream or reconnecting to the WebSocket server.

  • Decentralized Infrastructure: Leveraging the Tether blockchain's Edge cloud, our architecture is decentralized, ensuring data security and integrity. This decentralized approach enhances performance by reducing latency and provides a scalable solution for live streaming board games.

Challenges we ran into

The journey to build Akumen was not without its challenges:

  1. Ingestor Availability Issues: The ingestor was not selectable or available in certain regions, causing delays and interruptions in the live streaming setup process.
  2. Blockchain Complexity: Integrating blockchain technology presented numerous challenges, from handling smart contract deployments to managing secure and efficient transactions.
  3. Real-time Interactions: Ensuring real-time game interactions and state updates required careful management of asynchronous operations and data flows.
  4. Video Integration: Incorporating Theta's decentralized video services and NFT-based DRM required us to navigate new APIs and ensure seamless integration with our platform.
  5. User Experience: Balancing a rich feature set with an intuitive user experience was a constant challenge, as we aimed to make the platform accessible to both casual players and blockchain enthusiasts.
  6. Server Load and Scalability: Ensuring that the backend server could handle multiple simultaneous live streams without performance degradation required careful resource management and optimization.

Accomplishments that we're proud of

Seamless Blockchain Integration: Successfully integrated Theta SDK for secure management of game assets and transactions.

  • Theta Integration: Efficiently incorporated Theta's decentralised video services for live streaming and video playback.
  • User-friendly Interface: Developed an intuitive and responsive user interface that enhances the overall gaming experience.
  • Smart Contracts: Created robust smart contracts to manage game logic, staking, and NFT rewards, ensuring transparency and security.
  • Real-time Gameplay: Implemented real-time game state updates and interactions, providing a smooth and engaging user experience.

What we learned

Throughout the development of Akumen, we gained valuable insights into several key areas:

  1. Blockchain Integration: We deepened our understanding of how to integrate blockchain technologies, such as Ethereum, to manage in-game assets, transactions, and user identities securely and transparently.
  2. Decentralised Video Services: By incorporating Theta's decentralised video services, we learned how to efficiently handle video delivery and playback, ensuring a smooth streaming experience for live games.
  3. Smart Contracts: We explored the intricacies of smart contract development, focusing on creating robust and secure contracts to manage game logic, staking mechanisms, and NFT-based rewards.
  4. User Experience: We emphasised the importance of creating a user-friendly interface that allows players to easily navigate the platform, connect their wallets, and engage in games without technical barriers.

What's next for Akumen

Looking forward, we have several exciting plans for Akumen:

  • Expand Game Selection: We plan to introduce additional board games to the platform, providing a diverse range of gaming experiences.
  • Enhanced Social Features: We aim to develop more robust social features, including chat functionality and community events.
  • Mobile Support: Expanding our platform to mobile devices to provide users with a seamless gaming experience across all devices.
  • Advanced Staking and Rewards: Implementing more sophisticated staking mechanisms and reward systems to enhance player engagement and competition.
  • Partnerships and Collaborations: We are looking to partner with other blockchain projects and gaming communities to expand our reach and improve the platform's offerings.
Share this project:

Updates