Skip to content

Repository files navigation

TikTok Live-Style Little Fighter 2 Game

This project transforms Little Fighter 2 into an interactive TikTok Live-style game where characters spawn dynamically based on external events (simulated TikTok gifts).

Architecture

The system consists of three main components:

  1. Socket.IO Controller Server - Simulates TikTok Live gift events
  2. Game Engine - Modified LF2 with dynamic character spawning
  3. TikTok Integration Module - Connects the two via Socket.IO

Setup Instructions

1. Install Dependencies

Navigate to the controller directory and install Node.js dependencies:

cd tiktok-controller
npm install

2. Start the Socket.IO Controller

cd tiktok-controller
npm start

The controller will start on http://localhost:3000

3. Open the Game

Open the game in your browser:

open little-fighter-2/game/game.html

Or navigate to: file:///path/to/little-fighter-2/game/game.html

The game will auto-start immediately (no menu navigation needed).

4. Send Gift Events

  1. Open the controller UI in your browser: http://localhost:3000
  2. Enter a username (or leave empty for "Anonymous")
  3. Click any gift button to spawn a character

Gift → Character Mapping

Gift Name Character
Rosa Bandit
Tiny Diny Deep
Pumpkin Latte John
Gutab Henry
Fruit Plate Rudolf
Heart Gaze Louis
Tiny Diny in Love Firen
Perfume Freeze
S Flowers Dennis
Tiny Diny Hotdog Woody
Dombra Davis

How It Works

  1. Gift Event: User clicks a gift button in the controller UI
  2. Socket.IO Broadcast: Server broadcasts the gift event to all connected clients
  3. Event Handler: Game receives the event via tiktok-integration.js
  4. Character Spawn: match.spawn_ai_character() is called with character ID and username
  5. AI Character: Character spawns at a random position with AI controller
  6. Label Display: Username label appears below the character

Configuration

Disable TikTok Mode

To disable auto-start and TikTok integration, add ?tiktok=false to the URL:

file:///path/to/little-fighter-2/game/game.html?tiktok=false

Change Socket.IO Server URL

Edit game/game.js and modify the serverUrl parameter:

serverUrl: "http://your-server:3000";

Files Modified

Game Engine

  • LF/match.js - Added spawn_ai_character() method and task handler
  • LF/tiktok-integration.js - NEW: Socket.IO client and event handler
  • LF/label-renderer.js - NEW: Character label rendering
  • game/game.js - Added auto-start and TikTok integration initialization
  • game/game.html - Added Socket.IO client library
  • game/autostart-config.js - NEW: Default game configuration

Controller

  • tiktok-controller/server.js - NEW: Socket.IO server
  • tiktok-controller/public/index.html - NEW: Controller web UI
  • tiktok-controller/package.json - NEW: Dependencies

Development Notes

  • Characters spawn with Team 1 (enemies)
  • AI controller is automatically assigned
  • Labels are stored in character display_name property
  • Socket.IO runs on port 3000 by default
  • Game auto-starts after 500ms delay

Future Enhancements

  • Real TikTok Live API integration
  • Character label rendering on canvas
  • Team assignment based on gift value
  • Character despawn after timeout
  • Gift combo effects
  • Sound effects for spawns

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages