swiftlys2/docs/api/ai/
v1.4.10-beta.5 beta · v1.4.10 stable

A C# framework for Source 2 servers.

Build modern Counter-Strike 2 plugins with the full power of .NET - hot reload, async/await, and native engine access. No wrappers, no compromises.

bash - swiftlys2

~/plugins $ dotnet new install SwiftlyS2.CS2.PluginTemplate

Success: SwiftlyS2.CS2.PluginTemplate installed.

~/plugins $ dotnet new swplugin -n "TestPlugin" --PluginAuthor "Anonymous"

The template "SwiftlyS2 CS2 Plugin" was created successfully.

~/plugins/TestPlugin $ dotnet publish

Build succeeded → build/publish/TestPlugin.dll

~/plugins/TestPlugin $

$ curl api.github.com/repos/swiftly-solution/swiftlys2live
0
stargazers
0
forks
0
open issues
1d ago
last push
Language breakdown
C# 95.6%
C++ 3.5%
Python 0.7%
C 0.1%
Xmake 0.1%
MDX 0.0%

Why SwiftlyS2

Memory-safe by design

Managed abstractions over the raw Source 2 SDK prevent the memory leaks and crashes common in native modding.

Hybrid C++/C# core

A C++ core with a managed C# layer - plugin code calls straight into natives without leaving C#.

Full C# plugin API

Write plugins in modern C# with typed access to entities, cvars, events and more.

Community-driven

Open-source under GPLv3, built in the open with contributions from the CS2 server community.

Console & chat commands

Core

Register console commands, chat commands, and hook client command execution with typed argument parsing.

CVar management

Core

Find or create typed console variables with change callbacks.

Entity system

Core

Query and manipulate entities, read keyvalues, and hook entity inputs and outputs.

Source 2 internals

Core

Direct access to server info, the global variables struct, and map validation.

Game data & signatures

Core

Resolve engine offsets and signatures declared in signatures.jsonc gamedata files.

Match state

Core

Read and control live match data and the current game phase.

Player management

Core

Query online status, player counts, and server capacity.

Permissions

Core

Check wildcard-capable player permissions like admin.*.

Translations & localization

Core

Serve per-player localized strings through the built-in translation service.

Timers & scheduling

Core

Queue next-tick callbacks and delayed or repeating tasks off the game loop.

Performance profiling

Core

Start and stop named profiling recordings to find hot paths in your plugin.

Collision tracing

Core

Run engine hull and ray collision traces with custom filters.

Hot reload

Core

Plugins are told when they've been hot-reloaded so state can survive a reload.

Memory manipulation

Hooks

Resolve addresses by signature, vtable, or interface name, then call or hook them directly.

Engine & entity hooks

Hooks

Hook controller, weapon, movement, pawn, entity, and datamap calls directly.

Game event hooks

Hooks

Hook pre and post native game events with typed event objects.

Tick & world hooks

Hooks

Subscribe to per-tick and world-update callbacks, hibernation-aware.

Protobuf networking

Networking

Hook and exchange fully typed protobuf network messages, both ways.

String tables

Networking

Find and inspect Source 2 network string tables by name or ID.

Database connections

Database

Named MySQL, PostgreSQL, and SQLite connections resolved centrally and shared across plugins.

Menu system

Menus

Builder-pattern menus with configurable navigation, input mode, and buttons.

Audio playback

Media

Create and play native sound events for connected clients.

Top creators

Frequently asked questions

Yes. The C++ core is licensed under GPLv3 and the full source is on GitHub - you can read it and build it yourself.

No. The GPLv3 license carries an explicit MIT exception for derivative works - your plugins, or anything built against the published .NET packages, can stay closed-source or commercial.

C#, using the official dotnet templates (dotnet new swplugin). The framework's core is C++, but plugin code never has to touch it directly.

Counter-Strike 2 today. The core is built engine-first for Source 2 more broadly, but CS2 is the only shipped target right now.

No. It's a server-side scripting framework - players connect and play normally, no client-side installation required.

Yes - plugins are told when they've been hot-reloaded, so they can restore state on the fly with no server restart.

No. SwiftlyS2 is an independent project built by Swiftly Labs and is not affiliated with, endorsed, or sponsored by Valve Corporation.

Join the Discord community for day-to-day help, or open an issue on GitHub for bugs and feature requests.

Build your first plugin

Write it in C#, run it against the real C++ core. Every capability above is one import away.