A game recommendation system that suggests video games based on titles you've previously played. Built with Python and Prolog for logic-based recommendations.
- Personalized game recommendations based on your gaming history
- Prolog-powered recommendation logic
- Multiple recommendation strategies (genre, platform, rating similarity)
- Real game data from IGDB (Internet Game Database)
- Fast queries with SWI-Prolog backend
Before installation, ensure you have:
-
Python 3.12 or higher
- Check:
python3.12 --version - Download: https://www.python.org/downloads/
- Check:
-
SWI-Prolog (MUST be installed BEFORE creating Python virtual environment)
- macOS:
brew install swi-prolog - Ubuntu/Debian:
sudo apt-get install swi-prolog - Windows: https://www.swi-prolog.org/download/stable
- Verify:
swipl --version
- macOS:
-
IGDB API Account (free)
- Required for fetching game data
- Setup instructions below
git clone https://github.com/osyounis/new_game_plus.git
cd new_game_pluspython3 -m venv venv
# Activate on macOS/Linux
source venv/bin/activate
# Activate on Windows
venv\Scripts\activatepip install --upgrade pip
pip install -r requirements.txt-
Sign up for a Twitch account (if needed)
-
Click "Register Your Application"
-
Fill in:
- Name: "New Game Plus Recommender"
- OAuth Redirect URLs: http://localhost
- Category: Application Integration
-
Click "Manage" → Copy your Client ID
-
Click "New Secret" → Copy your Client Secret
-
Create
.envfile in project root:
cp .env.example .env- Edit
.envand add your credentials:
IGDB_CLIENT_ID=paste_your_client_id_here
IGDB_CLIENT_SECRET=paste_your_client_secret_here
# Fetch 50 games from IGDB
python src/igdb_client.py
# Convert to Prolog facts
python src/generate_facts.pypython src/main.pyYou'll be prompted to enter a game title.
python src/main.py --game "Dark Souls"python src/main.py --game "The Witcher 3" --limit 10============================================================
Recommendations based on: Dark Souls
============================================================
Similar Games (Genre + Rating):
1. Bloodborne
2. Elden Ring
3. Dark Souls II
4. Demon's Souls
5. Sekiro: Shadows Die Twice
Same Genre:
1. Bloodborne
2. The Witcher 3: Wild Hunt
3. Dragon's Dogma
...
new_game_plus/
├── src/ # Python source code
│ ├── main.py # Main CLI application
│ ├── igdb_client.py # IGDB API client
│ ├── generate_facts.py # JSON → Prolog converter
│ └── prolog_bridge.py # Python-Prolog interface (pyswip)
├── prolog/ # Prolog knowledge base
│ ├── knowledge_base.pl # Game facts (auto-generated)
│ └── rules.pl # Recommendation rules
├── data/ # Game data
│ └── games.json # IGDB game data (50 games)
├── .env # API credentials (NOT in git)
├── .env.example # Template for .env
├── requirements.txt # Python dependencies
└── README.md # This file
The recommendation system uses a hybrid Python-Prolog architecture:
-
Data Collection (
igdb_client.py)- Fetches game data from IGDB API
- Stores raw JSON in
data/games.json
-
Fact Generation (
generate_facts.py)- Converts JSON to Prolog facts
- Creates
prolog/knowledge_base.pl - Format:
game(Title, Genre, Platform, Rating)
-
Recommendation Rules (
prolog/rules.pl)- Defines logic for matching games
- Strategies: genre, platform, rating similarity
-
Query Engine (
prolog_bridge.py)- Bridges Python and Prolog via pyswip
- Sends queries to Prolog
- Returns results to Python
-
User Interface (
main.py)- CLI for user interaction
- Displays formatted recommendations
Data Flow:
IGDB API → igdb_client.py → data/games.json
↓
generate_facts.py
↓
prolog/knowledge_base.pl ← rules.pl
↓
User → main.py → prolog_bridge.py → Prolog
↓
Recommendations
Test each component individually:
# Test IGDB API connection
python src/igdb_client.py
# Test Prolog fact generation
python src/generate_facts.py
# Test Prolog bridge directly
python src/prolog_bridge.py
# Test full system
python src/main.py --game "The Witcher 3: Wild Hunt"GNU General Public License v3.0 - See LICENSE file for details
- IGDB API for game data
- SWI-Prolog for the logic programming engine
- pyswip for Python-Prolog integration
