Mods / CompatLib

Tags: #Library
Author: Elocrypt
Side: Both
Created: Feb 2nd at 1:58 AM
Last modified: Feb 4th at 5:50 AM
Downloads: 2632
Follow Unfollow 60

Latest release (for Vintage Story 1.20.3, outdated):
CompatLib_1.0.1.zip  1-click install


Heart Support Sticker by Ko-fiimage

CompatLib is a library designed to streamline mod compatibility by providing a structured approach to detect and manage interactions between various mods. This library offers utilities to check for the presence of specific mods, retrieve mod versions, and register compatibility handlers that ensure seamless integration simplifying the process for mod developers to ensure their mods work harmoniously with others, enhancing the overall modding experience.

Discuss CompatLib: Vintage Story Discord CompatLib mod thread


Key Features:

  • Mod Detection: Check if specific mods are installed and retrieve their versions.
  • Compatibility Management: Register and process compatibility handlers for mods.
  • Conflict Tracking: Detect and log compatibility conflicts dynamically.
  • Server & Client Commands: In-game commands for debugging compatibility issues.
    - Client-side command: .compatlog
    - Server-side command: /compatlog
  • Thread Safety: Utilizes thread-safe operations to ensure data integrity in multithreaded environments.
  • Dynamic Handler Control: Enable or disable specific handlers at runtime for flexible compatibility management.
  • Version Compatibility Checks: Ensure handlers are compatible with specific mod versions to prevent conflicts.
  • User Feedback Mechanism: Inform users about active handlers and detected conflicts, enhancing transparency.
  • JSON Export for Compatibility Logs: Export compatibility logs in a structured JSON format for easier debugging and analysis.
  • Logging Granularity: Introduced different log levels (INFO, WARNING, ERROR) to categorize messages, allowing for more granular control over logging output.

Installation Instructions (Dependency for other mods):

  1. Download CompatLib: Ensure you have the correct version of CompatLib the mod is using as a dependency and that they are compatible with your Vintage Story game version.

  2. Add to Mods Folder: Place the CompatLib .zip file into your Vintage Story Mods directory.

  3. Launch the Game: Start Vintage Story, and CompatLib will be automatically recognized and integrated.


For Developers:

To utilize CompatLib in your mod development, follow these steps:

  1. Download CompatLib: Get the latest release.

  2. Add to Project: Include the CompatLib DLL in your mod's project references.

  3. Namespace Inclusion: Add the CompatLib namespace in your code:

    using CompatLib;

  4. Initialization: Initialize CompatLib within your mod's main class by extending ModSystem:

    using Vintagestory.API.Common;

    namespace YourModNamespace
    {
        public class YourModSystem : ModSystem
        {
            public override void Start(ICoreAPI api)
            {
                base.Start(api);
                // Initialize CompatLib
                api.Logger.Notification("YourMod initialized with CompatLib support.");
            }
        }
    }

     

For a comprehensive guide and examples, please refer to the CompatLib Wiki.


Support & Feedback:

  • Ko-fi: Support development at Ko-fi.
  • Twitch: Watch live gameplay and mod development at Twitch.
  • Discord: Join our community for feedback and discussions at Discord.
  • GitHub: Report issues or track development progress at GitHub.
  • ModDB: Find my other Vintage Story mods and patches at ModDB.

Your support helps keep this mod updated and improves the Vintage Story experience for everyone!
My Wishlist

Mod Version Mod IdentifierFor Game version Downloads Released Changelog Download 1-click mod install*
1.0.1 compatlib 2245 Feb 4th at 5:50 AM CompatLib_1.0.1.zip 1-click install

Enhancements:

  • Thread Safety:
    - Replaced `Dictionary` with `ConcurrentDictionary` for `registrations` and `OverrideHandlers` to ensure thread-safe operations.
  • Error Handling and Logging:
    - Enhanced logging to provide more detailed information during handler execution and error occurrences, facilitating easier debugging.
  • Dynamic Enabling/Disabling of Handlers:
    - Introduced the ability to enable or disable specific handlers at runtime, offering greater flexibility in managing compatibility scenarios.
  • Version Compatibility Checks:
    - Implemented checks to ensure handlers are compatible with specific mod versions, preventing potential conflicts due to version mismatches.
  • User Feedback Mechanism:
    - Added mechanisms to inform users about active handlers and any detected conflicts, enhancing transparency and user awareness.
  • Logging Granularity:
    - Introduced different log levels (INFO, WARNING, ERROR) to categorize messages, allowing for more granular control over logging output.
  • Mod Version Caching:
    - Implemented caching for mod versions to optimize performance when retrieving mod information.
  • JSON Export for Compatibility Logs:
    - Added functionality to export compatibility logs in a structured JSON format for easier debugging and analysis.
  • Version Compatibility Ranges:
    - Enhanced version compatibility checks to support specifying compatible mod versions as a range rather than a single value.

Bug Fixes:

  • Resolved minor issues related to handler registration and execution flow.
  • Fixed thread-safety issues with `ConflictLogs` by providing a thread-safe method to access logs.
  • Improved exception handling in `ModChecker` to log errors and aid in debugging.

Notes:

These enhancements aim to improve the robustness, flexibility, and user-friendliness of the CompatLib framework, providing a better experience for both developers and end-users.

1.0.0 compatlib 387 Feb 2nd at 2:31 AM CompatLib_1.0.0.zip 1-click install

Initial Release


3 Comments (oldest first | newest first)

💬 bintoss, Nov 13th at 11:25 AM

I wish more mod developers would give this a chance...

💬 Elocrypt , Feb 2nd at 12:25 PM

Edvardas
I haven't tested with 1.20.0 specifically, although I believe this should work with 1.20.0. 

💬 Edvardas, Feb 2nd at 11:44 AM

Does it work with 1.20.0?
Thank you :)

 (edit comment delete)
Основной веб-сайт | Почтовый сервер | FTP сервер | Административная панель | API интерфейс | Content Delivery Network | Статические файлы | Ресурсы сайта | Изображения | Файловое хранилище | Блог | Интернет-магазин | Техническая поддержка | Справочная система | Документация | Форум | Новости | Загрузки | Демонстрация | Тестовая среда | Приложение | Медиа контент | Разработка | Промежуточная среда | Бета версия | Безопасная зона | Вход в систему | Панель управления | Портал | Система управления контентом