Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin system ideas / expections #43

Closed
AeonLucid opened this issue Oct 4, 2020 · 18 comments
Closed

Plugin system ideas / expections #43

AeonLucid opened this issue Oct 4, 2020 · 18 comments
Assignees
Labels

Comments

@AeonLucid
Copy link
Collaborator

The plan is to create a plugin system for Impostor, allowing you to create plugins such as:

  • Auto mute on discord
  • Custom gamemodes (i.e. hide and seek)

You will need to create a C# project (.NET 5 library) and reference the Impostor library. The resulting .dll can be placed in a plugins directory with optionally a directory for the plugin where configs or other data can be stored.

Any ideas / wishes you might have regarding the plugin system can be posted in this issue.

@AeonLucid AeonLucid self-assigned this Oct 4, 2020
@GerardSmit
Copy link
Contributor

We'll need to disable PublishTrimmed so plugins don't get the issue that methods / assemblies are being trimmed that they want to use.

@js6pak
Copy link
Member

js6pak commented Oct 4, 2020

Simple and cool events based on attributes, i.e.

[Plugin] // info about plugin should be gathered from assembly attributes :)
public class TestPlugin
{
	public TestPlugin([Inject] EventManager eventManager) // Dependency injection on constructor and properties?
	{
		eventManager.Subscribe(this);
	}

	[EventHandler]
	public void OnPlayerConnect(PlayerConnectEvent @event)
	{
		this.Logger.LogInfo(@event.Player.Name); // Microsoft.Extensions.Logging?
	}
}

I guess I just like reflection

@AeonLucid
Copy link
Collaborator Author

@GerardSmit I want to put the plugin API stuff in a separate library so it can just be disabled in there. I believe it is also possible to exclude stuff from trimming with annotations but I can't find where I read that anymore.

@BrightSkyz
Copy link
Contributor

I would like to see a way to get low level packet data for if something isn't implemented yet or you just need it. Also, I would like to see a way to cancel relaying the packet to the other players.

@Mm2PL
Copy link
Contributor

Mm2PL commented Oct 5, 2020

I would like to have a simple enough API for high level things, like chat, maybe commands. IMO it would be nice if plugins could change properties of players and Games directly. A good example to use here is a plugin that would change the number of impostors or the current map, which should technically be possible AFAIK, but isn't in the game probably due to searching for public lobbies. IMO Enabling things that aren't possible with the client's UI is a good use of commands.

@Akilestar
Copy link

I would like to have a simple enough API for high level things, like chat, maybe commands. IMO it would be nice if plugins could change properties of players and Games directly. A good example to use here is a plugin that would change the number of impostors or the current map, which should technically be possible AFAIK, but isn't in the game probably due to searching for public lobbies. IMO Enabling things that aren't possible with the client's UI is a good use of commands.

+1, especially for changing the number of imposters. We have "house rules" for game types that require different numbers of imposters. Adding the ability to modify the min and max settings for the in game rules would be nice too. ie. Override the Kill Cooldown minimum to 1 second. Adding webhooks would be really nice too. Even for something as simple as the server running.

@roobscoob

This comment was marked as spam.

@A-Cloud-Ninja
Copy link

This is awesome! I'm looking for access to to events such as

Functions:
 - Create Game
 - Destroy Game

Events:
 - Game Start
 - On Meeting Start
 - On Meeting end

Live Data:
 - Connected Players
 - States of connected players (Name / Color / Hat / Position / Is Dead, etc.)

In terms of the live data, i think it would be better suited to effectively just serve those as events. Connected players? Just log all players who connect with an event callback. States of them? In theory, I would want to have them as an object to manipulate, or at the very least for querying info about them, and having a "playerUpdate" callback that receives the new updated player object whenever something happens to them.

@roobscoob

This comment was marked as spam.

@js6pak
Copy link
Member

js6pak commented Oct 8, 2020

I would like to have a WebSocket or TCP connection to Imposter, that way it can be interfaced with any language or multiple programs at once.

Thats plugin territory

@GerardSmit GerardSmit mentioned this issue Oct 9, 2020
3 tasks
@maks100

This comment has been minimized.

@Fredthedoggy
Copy link

1 Suggestion that I talked with AeonLucid about on discord, is a way to cancel events.
This way I could cancel a meeting event if I wanted to, or cancel a message from being sent to everyone (Custom Filters/Chat)
This would not remove the action on the users-end, but would cancel it for everyone else (but canceling a meeting would have to cancel it for everyone).

@Trolldemorted
Copy link

Registering to all kind of events (movement, kill, vent usage, object usage) would be awesome, I'd like to create heatmaps like wot has.

@DiamondDagger590
Copy link

Currently working on a system for decoding packets to turn these into events. Current project is the settings change packet and I plan to hook that into an event. I also have a semi functional PlayerJoinGame event with cancellable status, however it doesn't cleanly kick the player so there needs to be further modifications to make that work

@real2two
Copy link

This is awesome! I'm looking for access to to events such as

Functions:
 - Create Game
 - Destroy Game

Events:
 - Game Start
 - On Meeting Start
 - On Meeting end

Live Data:
 - Connected Players
 - States of connected players (Name / Color / Hat / Position / Is Dead, etc.)

maybe "On connect", "On join" and "On disconnect" if not already.

"on connect" would be while joining. (possibly cancellation of kicking the player even if the max players is already greater than 10)
"on join" would be if you successfully join the game (like the player successfully joins without any errors like there is already max players in the game).
"on disconnect"... well if you disconnect from the game.

@real2two
Copy link

If anyone actually is going to make plugins here, here's suggestions:

  • Chat moderation plugin.
  • Anticheat.
  • Spectator (not you being a ghost... a spectator).
  • Better chatting. (possibly make a "/imposchat" as an addition for chatting)

@gideongrinberg
Copy link

What about using another scripting language for extensions. Also are extensions server or client?

@AeonLucid
Copy link
Collaborator Author

AeonLucid commented Oct 25, 2020

The initial beta api is now out, please see https://github.com/Impostor/Impostor/blob/dev/docs/Writing-a-plugin.md and use the issues on the bottom for further discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests