Advance Chat Documentation
Complete guide for the Advance Chat System for MFPS
Overview
The Advance Chat System is a comprehensive replacement for the default MFPS lobby chat. It introduces modern chat features such as multiple channels, private messaging, emoji support, command systems, and a built-in profanity filter.
- Multi-Channel Support: Global, Friends, Party, Team, and Room channels.
- Rich Media: Pixel art emoji support.
- Commands: Built-in commands for moderation and navigation.
- Security: Profanity filter and spam protection (rate limiting).
- Customization: Fully customizable UI colors and settings via ScriptableObject.
Installation
1. Enable the Addon
First, you need to enable the addon in the project settings:
- Go to the Unity top menu: MFPS > Addons > BlinkBox > AdvanceChat > Enable.
- Wait for the script recompilation to finish.
2. Scene Integration
Once enabled, integrate the chat system into your MainMenu scene:
- Open your MainMenu scene.
- Go to MFPS > Addons > BlinkBox > AdvanceChat > Integrate.
- Click the Integrate button in the wizard window.
- The tool will automatically:
- Disable the default
bl_LobbyChat. - Instantiate the
Advance Lobby Chatprefab. - Migrate your previous chat settings (like history length).
- Disable the default
Configuration
All settings are managed via the ChatSettings ScriptableObject located in the Resources folder.
Location: Resources/ChatSettings.asset
Channel Settings
- Default Channels: List of channels to join automatically (e.g., "Global", "Friends").
- Channel Names: Customize the display names for Global and Friends channels.
- History Length: Number of past messages to fetch when joining.
Message Settings
- Rate Limit: Minimum time (in seconds) between messages to prevent spam.
- Max Length: Maximum characters per message (default: 200).
- Pooling: Configure
Max Pooled MessagesandMax Visible Messagesfor performance optimization.
UI & Debug
- UI Colors: Set custom colors for different channel messages (Global, Friends, Party, Room).
- Debug Mode: Enable
Enable Debugto see detailed connection logs in the Unity Console.
Features
Channels
The system supports dynamic channel switching:
- Global: Public chat for all players in the region.
- Friends: Private channel for friend communications.
- Party: Automatically created when joining a party.
- Room: Lobby/Match room chat.
Profanity Filter
The ChatProfanityFilter automatically censors offensive language. It comes with a pre-populated list of block words but can be extended via the ChatBlockList script.
Behavior: Bad words are replaced with ***.
Emojis
Users can send pixel art emojis. These are rendered as sprites within the chat UI. Emojis are stored in the AdvanceChat/Arlan Trindade/Free emojis pixel art folder.
Chat Commands
Users can execute commands by typing / followed by the command keyword.
| Command | Alias | Description | Usage Example |
|---|---|---|---|
/help |
- | Displays a list of available commands. | /help |
/clear |
- | Clears the local chat history. | /clear |
/join |
/j |
Join a specific channel. | /join Trade |
/msg |
/w |
Send a private whisper to a user. | /msg PlayerName Hello! |
/team |
/t |
Send a message to your team (in-game). | /team Defend A! |
Script Reference
bl_Advance_LobbyChat
Path: Scripts/bl_Advance_LobbyChat.cs
The core controller script. Handles Photon Chat connection, channel subscriptions, and message instantiation.
Connect(): Initiates connection to Photon Chat.SendMessage(string text): Processes and sends input text.OnSubscribed(): Callback when channels are successfully joined.
ChatSettings
Path: Scripts/ChatSettings.cs
Singleton ScriptableObject for global configuration. Access via ChatSettings.Instance.
ChatCommandSystem
Path: Scripts/ChatCommandSystem.cs
Parses and executes chat commands. New commands can be registered via RegisterCommand(string name, Action<string[]> action).