+
Skip to content

boovboyz/gamers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎮 Game Store Platform with Ad-Based Monetization

A desktop application for Windows that provides free games with ad-supported monetization. Games are automatically paused every 45 minutes using OS-level process suspension for 5-minute ad breaks.

🌟 Features

Core Functionality

  • Process Suspension System: Robust game pausing using Windows NT APIs and thread-based fallback
  • 45-Minute Timer: Automatic game suspension every 45 minutes for ad breaks
  • 5-Minute Ad Breaks: Fullscreen ad overlay that cannot be closed or skipped
  • Game Library: Steam-like interface with grid/list views, search, and categorization
  • Developer Portal: Web interface for uploading games with mock analytics
  • Safety Features: Save protection, crash recovery, and timeout protection

Technical Highlights

  • Windows API Integration: Direct calls to NtSuspendProcess/NtResumeProcess via ffi-napi
  • Fallback Mechanism: Thread-level suspension when NT API fails
  • SQLite Database: Local storage for games, sessions, and analytics
  • Electron Frontend: Modern desktop UI with responsive design
  • Express Backend: Developer portal with file upload capabilities

🚀 Quick Start

Prerequisites

  • Windows 10/11 (required for process suspension APIs)
  • Node.js 16+
  • Administrator privileges (recommended for process suspension)

Installation

  1. Clone and install dependencies:
git clone <repository-url>
cd game-store-windows
npm install
  1. Start the main application:
npm start
  1. Start the developer portal (separate terminal):
npm run server
  1. Access developer portal: Open http://localhost:3001 in your browser

📁 Project Structure

game-store-windows/
├── main/                 # Electron main process
│   ├── index.js         # Entry point and app initialization
│   ├── processManager.js # Windows process suspension logic
│   ├── gameWrapper.js   # Game session management
│   ├── adManager.js     # Ad scheduling and analytics
│   └── database.js      # SQLite database operations
├── renderer/            # Electron renderer (UI)
│   ├── library.html    # Main game library interface
│   ├── overlay.html    # Ad overlay window
│   ├── styles/         # CSS styles
│   └── js/            # Frontend JavaScript
├── native/             # Windows-specific code
│   └── windowsAPI.js   # FFI bindings for Windows APIs
├── server/             # Developer portal backend
│   ├── app.js         # Express server
│   └── public/        # Web interface
└── data/              # Local storage
    ├── games.db       # SQLite database
    ├── uploads/       # Uploaded game files
    └── downloads/     # Downloaded games

🔧 Core Components

1. Process Suspension Manager (main/processManager.js)

The heart of the system - handles suspending and resuming game processes:

// Suspend a process with fallback logic
const suspensionInfo = await processManager.suspendProcess(processId, {
    useNTAPI: true,
    saveProtectionDelay: 3000,
    maxRetries: 3
});

// Resume the process
await processManager.resumeProcess(processId);

Features:

  • NT API calls (NtSuspendProcess/NtResumeProcess) as primary method
  • Thread-based suspension as fallback
  • Save protection delay (3 seconds default)
  • Retry logic with exponential backoff
  • Process state verification

2. Game Session Handler (main/gameWrapper.js)

Manages individual game sessions and timing:

const session = new GameSession(gameInfo, processManager, adManager);
await session.start();

// Session automatically:
// - Tracks 45-minute play timer
// - Triggers ad breaks
// - Handles crashes and errors
// - Records analytics

Features:

  • 45-minute countdown timer
  • Automatic process suspension for ads
  • Play time tracking (excludes suspended time)
  • Crash detection and recovery
  • Health monitoring

3. Windows API Bindings (native/windowsAPI.js)

Direct Windows API access via ffi-napi:

// Supported APIs:
- kernel32.dll: OpenProcess, SuspendThread, ResumeThread
- ntdll.dll: NtSuspendProcess, NtResumeProcess  
- user32.dll: FindWindow, SetWindowPos

Security Note: Some operations require administrator privileges for process manipulation.

4. Ad Overlay System (renderer/overlay.html)

Fullscreen overlay that prevents user interaction:

  • Always on top window that covers entire screen
  • 5-minute countdown with progress bar
  • Disabled controls - blocks Alt+Tab, Alt+F4, etc.
  • Skip attempt tracking for analytics
  • Auto-resume after timeout

🎯 Game Integration

For Game Developers

  1. Upload via Developer Portal:

    • Visit http://localhost:3001
    • Fill in game details (title, description, category)
    • Upload .exe or .zip file
    • Add optional cover image and screenshots
    • Games are auto-approved for MVP
  2. Supported Formats:

    • .exe files (Windows executables)
    • .zip files (will be extracted)
    • Single-player games only (multiplayer not supported in MVP)

For Players

  1. Install Games:

    • Browse library by category (Action, RPG, Puzzle, Strategy, Racing)
    • Click "Download" to install
    • Games are stored in data/downloads/
  2. Play Games:

    • Click "Play" to launch
    • Game runs normally for 45 minutes
    • Automatic pause for 5-minute ad break
    • Cycle repeats until game is closed

📊 Analytics & Monetization

Revenue Model

  • $0.02 per ad view (base rate)
  • $0.01 completion bonus (if user watches full ad)
  • Mock analytics with realistic data for demonstration

Tracked Metrics

  • Total play time per game
  • Ad completion rates
  • Download statistics
  • Player retention
  • Revenue estimation

Developer Dashboard

Access detailed analytics at http://localhost:3001:

  • Game performance metrics
  • Download trends
  • Revenue estimation
  • Player engagement data

⚠️ Important Limitations (MVP)

Single-Player Only

  • No multiplayer support
  • No online features during ad breaks
  • Network-dependent games may have issues

Windows-Specific

  • Requires Windows 10/11
  • Uses Windows-specific APIs
  • May need administrator privileges

Process Suspension Compatibility

Some games may not suspend properly:

  • Games with custom protection (anti-cheat)
  • Games using specific engines
  • Real-time multiplayer games

Security Considerations

  • Process manipulation requires elevated privileges
  • Antivirus software may interfere
  • Some corporate environments may block functionality

🛠️ Development Setup

Debug Mode

npm run dev  # Start with developer tools enabled

Database Management

// Access SQLite database directly
const Database = require('./main/database');
const db = new Database();
await db.initialize();

// View game sessions
const sessions = await db.getGameSessions();

Testing Process Suspension

// Test suspension on current process (BE CAREFUL!)
const pm = new ProcessSuspensionManager();
await pm.suspendProcess(process.pid);
// Process will be suspended - you'll need external tool to resume

🔍 Troubleshooting

Common Issues

1. Process Suspension Fails

  • Ensure running as Administrator
  • Check if antivirus is blocking
  • Try different games (some may be incompatible)

2. Games Don't Launch

  • Verify game executable path
  • Check file permissions
  • Ensure all dependencies are installed

3. Ad Overlay Doesn't Appear

  • Check if process suspension succeeded
  • Verify overlay window creation
  • Look for JavaScript errors in developer tools

4. Database Errors

  • Delete data/games.db to reset
  • Ensure write permissions in data directory
  • Check SQLite installation

Logs and Debugging

Main Process Logs:

# Console output shows:
- Process suspension attempts
- Game launch status
- Ad break triggers
- Database operations

Renderer Logs:

  • Open Developer Tools (Ctrl+Shift+I)
  • Check Console for UI errors
  • Network tab for failed requests

Server Logs:

# Developer portal logs show:
- File upload progress
- API requests
- Database queries

🧪 Testing Checklist

Basic Functionality

  • Games download successfully
  • Games launch properly
  • 45-minute timer counts down
  • Process suspends after timer
  • Ad overlay appears and cannot be closed
  • Game resumes after 5 minutes
  • Multiple suspend/resume cycles work
  • Game state preserved during suspension
  • Crashes handled gracefully

Developer Portal

  • Upload interface loads
  • Files upload successfully
  • Games appear in library after upload
  • Analytics display correctly
  • Mock revenue data shows

Edge Cases

  • Alt+Tab blocked during ads
  • Process crashes handled
  • Database corruption recovery
  • Network interruptions
  • Antivirus interference

🚀 Future Enhancements

Planned Features

  • Real Ad Integration: Connect with ad networks
  • Cloud Save System: Sync game saves across devices
  • Multiplayer Support: Handle online games properly
  • Advanced Analytics: Real user behavior tracking
  • Game Recommendations: AI-powered suggestions
  • Achievement System: Gamification features

Technical Improvements

  • Better Compatibility: Support more game engines
  • Performance Optimization: Reduce resource usage
  • Security Hardening: Protect against tampering
  • Cross-Platform: macOS and Linux support
  • Auto-Updates: Seamless application updates

📄 License

MIT License - See LICENSE file for details

🤝 Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

📞 Support

For issues and questions:

  • Check the troubleshooting section above
  • Review console logs for error messages
  • Open an issue on GitHub with detailed information

⚡ Performance Notes

System Requirements

  • RAM: 4GB minimum (8GB recommended)
  • Storage: 10GB free space for games
  • CPU: Modern dual-core processor
  • Network: Broadband for game downloads

Resource Usage

  • Main Process: ~100MB RAM
  • Renderer Process: ~200MB RAM
  • Database: Grows with usage (~1MB per 1000 sessions)
  • Game Storage: Varies by game size

Built with ❤️ for the gaming community. Enjoy free games with fair advertising!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载