Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

LaVashikk/source-plugin-rs

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Source Engine Rust Plugin (source-plugin-rs)

A minimal, cross-platform proof-of-concept for creating Source Engine server plugins using Rust.

Important

This is a proof-of-concept and has only been tested to load successfully in Portal 2 on Windows and Linux. It serves as a starting point and demonstrates the correct ABI setup for both platforms.

Building

Windows (32-bit)

  1. Add the target toolchain:
    rustup target add i686-pc-windows-msvc
  2. Build the project:
    cargo build --target i686-pc-windows-msvc --release
  3. The output will be target/i686-pc-windows-msvc/release/source_plugin_rs.dll.

Linux (32-bit)

  1. Install multilib build tools (e.g., sudo apt-get install gcc-multilib).
  2. Add the target toolchain:
    rustup target add i686-unknown-linux-gnu
  3. Build the project:
    cargo build --target i686-unknown-linux-gnu --release
  4. The output will be target/i686-unknown-linux-gnu/release/libsource_plugin_rs.so.

Key Functions

The plugin implements IServerPluginCallbacks003:

Function When Called Use Case
load() Plugin loaded Initialize resources
server_activate() Map loaded Hook game state
game_frame() Every tick Game logic
unload() Plugin unloaded Cleanup

See Valve's SDK docs for details.

Adding Your Logic

Edit the functions in src/lib.rs:

define_vtable_fn!(fn server_activate(_edict_list: *const c_void, _edict_count: i32, _client_max: i32) {
    eprintln!("[RUST_PLUGIN] Map loaded! Let's do something cool...");

    // Your code here
});

Contributing

Contributions welcome! Please open an issue or PR.

Credits: Thanks to 0xNULLderef for technical guidance.

License

MIT License - see LICENSE file.

About

A minimal, cross-platform boilerplate for creating Source Engine server plugins in Rust.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.