🎮 Cognify 🎮

Cognify is an AI-powered word-guessing game where players compete against a sophisticated AI to guess a daily target word. Set in a futuristic world where AI has taken control of human knowledge, the stakes are high: players must outsmart the AI to reclaim and protect the words that define humanity's culture and history. Cognify challenges players to engage in a battle of wits and creativity, blending fun, education, and strategy. Together, human ingenuity and linguistic prowess become the last hope to save the world from an AI-driven erasure of identity.

Alt text

🗂️ Table of Contents


💡 Features

Alt text

1. AI-Driven Word Guessing

  • Compete against an AI that guesses alongside you using Amazon Bedrock Models.
  • Receive similarity feedback based on GloVe embeddings for each guess.

2. Interactive Gameplay

Alt text

  • Real-time updates via a Flask backend and JavaScript frontend.
  • A user-friendly interface with visual and audio feedback.

3. Daily Challenges

Alt text

  • A unique target word every day, challenging players to improve over time.
  • Leaderboards for competitive ranking.

4. Performance Tracking

Alt text

  • In-depth player statistics including total games played, guesses per game, and average completion time.
  • Save and review game history to track improvement.

5. Seamless Cloud Integration

Alt text

  • Hosted on AWS ECS and managed with CloudFormation, ensuring a scalable and secure experience.

🛠️ Architecture Overview

📂 ### Cognify Game Architecture

Architecture Overview


Frontend

  • User Interaction: Web Game UI built with HTML, JavaScript and CSS.
  • Key Features:
    • Handles word input, feedback display, and leaderboard updates.
    • Communicates with the backend API using AJAX.

Backend

Flask API

  • Processes:
    • Player inputs.
    • Game logic and AI integration.
  • Handles:
    • Semantic similarity calculations.
    • Ranking player guesses.
  • Interfaces with DynamoDB for data storage.

AI Integration

  • Amazon Bedrock:
    • Mistral.mistral-7b-instruct-v0:2: AI-powered guessing logic.
    • Titan Embeddings V2: Semantic similarity calculations.
  • Custom Logic: Ranks and optimizes similarity scores.

Dockerized Backend

  • Key Components:
    • Flask API and AI logic encapsulated into Docker containers.
    • Ensures portability and ease of deployment.

Hosting and Compute

  • Amazon ECR: Stores Docker images for frontend and backend.
  • Amazon ECS: Orchestrates containers in production.
  • Amazon EC2: Provides compute instances for running containers.

Amazon Q (CodeWhisperer)

  • Capabilities:
    • Assisted in coding efficient Flask API and Dockerfiles.
    • Optimized container configurations and AWS service integration.
    • Suggested scalable deployment solutions.

Database

  • Amazon DynamoDB:
    • Stores player profiles, game history, and statistics.
    • Ensures low-latency data retrieval for smooth gameplay.
    • Manages leaderboard and daily challenges.
      Alt text

AI Processing Workflow

  1. Player Input: Sent to backend for processing.
  2. AI Guessing:
    • Titan Embeddings V2: Embedding similarity calculations.
    • Mistral.mistral-7b-instruct-v0:2: AI-generated guesses.
  3. Ranked Results: Returned to players in real-time.

Game Hosting and Infrastructure

  • Docker Containers:
    • Frontend and backend services packaged for simplicity.
    • Streamlined deployment and scaling.
  • Elastic Container Service (ECS): Auto-scales to handle traffic.
  • Elastic Load Balancer: Distributes requests efficiently.
  • Amazon EC2: Runs the game server and backend logic.
  • Route 53: Manages game domain DNS.

Player Analytics and Statistics

  • Tracks:
    • Total games played.
    • Best rank achieved.
    • Completion rate and recent game activity.
  • Visualized on the user dashboard for insights.

Development Automation (Amazon Q)

Key Contributions:

  • Generated Flask API routes, logic, and frontend components.
  • Facilitated integration with AWS services (Bedrock, ECS, DynamoDB).

Optimization Areas:

  • Semantic similarity calculations.
  • AI inference pipeline.
  • Dockerfile creation and deployment automation.

Security and Scalability

  • Security Measures:
    • Data encryption for storage and communication.
    • Role-based access control for sensitive resources.
    • Secure API Gateway interactions.
  • Scalability:
    • Auto-scaling policies ensure high availability.

👥 Team

Cognify was developed by a passionate team of developers and AI enthusiasts committed to creating a fun, educational, and competitive game experience.


🛠️ Challenges We Ran Into

Alt text

  • Embedding Model Limitations: GloVe embeddings' limited vocabulary required additional fallback logic.
  • Optimizing AI Performance: Reducing latency for real-time gameplay involved extensive caching and optimization.
  • Infrastructure Setup: Deploying and scaling on AWS ECS and integrating Route 53 presented initial challenges.

🏆 Accomplishments That We're Proud Of

Alt text

  • Successfully integrating GloVe embeddings and Amazon Bedrock Models for dynamic word guessing.
  • Creating a visually appealing and responsive interface for an engaging user experience.
  • Deploying a scalable cloud-based solution that ensures reliability and performance.

🎓 What We Learned

Alt text

  • Natural Language Processing: Gaining insights into embedding techniques and similarity calculations.
  • Cloud Infrastructure: Building and managing scalable solutions using AWS services.
  • User-Centric Design: Iterating on feedback to refine the gameplay experience.

🌟 What's Next for Cognify

  • Multiplayer Mode: Enable real-time competition between friends.
  • Mobile App: Launching a mobile version for iOS and Android.
  • Enhanced AI: Using more sophisticated NLP models to improve the AI's guessing ability.
  • Gamification Features: Adding achievements, rewards, and daily streaks to boost player engagement.
  • Language Support: Expanding vocabulary and support for multiple languages to reach a broader audience.

Built With

Share this project:

Updates