1 (edited by 2013-05-21 12:14:44)

Topic: Plugins client

Hi everybody,

I don't know if i should post this in "Modifications" sub-forum or other, so I post it here. ^^

I've forked teeworlds main repository, and modified the client/server by adding a plugins/events system in core engine.

A the moment, there is just the plugins/events system, and a command in both server and client to load plugin file (ex: loadplugin /path/to/plugin.so).
To make this mod useful, it just need to add some event at some points of server and client code, but i post this here in case someone is interested by this modification smile

The mod repository: https://github.com/KokaKiwi/teeworlds (branch: plugins)

Currently, I'm searching a way to allow plugins to register their own gamemode, but I don't find good solutions sad
If anybody have an idea... tongue

2

Re: Plugins client

Well you sure seem to know what you're doing. Are you aiming for anything specific with this?

3

Re: Plugins client

I don't aim anything, i just wanted to make teeworlds more...modulable smile
In fact, i aim doing a pull request to the main repository with a reliable plugins/events system, according to the TODO-list of the 0.7 version about a plugin system smile

4

Re: Plugins client

As i understood, your work might allow to make mods easier, and easier sharing code without merge conflicts? If it's so, i'm a fan of this idea too^^
But i'd like to see any examples of plugins (even small, even on pastebin).

5

Re: Plugins client

I just commited a small test plugin, which register a callback function to an event "OnTick" and register a new gamemode "kiwi" smile

The plugin directory: https://github.com/KokaKiwi/teeworlds/t … ugins/test

6

Re: Plugins client

To add plugin, i should only add .h and .cpp files to the plugins folder, implement some interfaces, and it should compile successfully? And i can make everything i want by only adding plugins, or i still need to make some changes in original source?

7

Re: Plugins client

In theory, yes.
But the plugins system misses some functionnalities, like base events to connect to for the plugin.
But actually, it handle custom game modes, and customs commands registering (in fact, all what can you do with core engine elements)

8

Re: Plugins client

I like your idea, I just look through your code and its seems clean and small for now.
You use

dlopen()

to load your plugin, but this function is not supported on Windows.

What about the licenses of plugins ?
Plugin must be compiled, we can found later Windows-only plugin and I don't think that would be good for Teeworlds.

But I like the idea, if a server can be extended without changing the binairie or reload everything, it would be very cool !

9

Re: Plugins client

needs wrote:

I like your idea, I just look through your code and its seems clean and small for now.
You use

dlopen()

to load your plugin, but this function is not supported on Windows.

Oh, I didn't develop under Windows, so I haven't searched how to load shared libraries on Windows, but it's planned wink

needs wrote:

What about the licenses of plugins ?

Hum, I haven't think about that. yikes
Maybe the same license that Teeworlds, or plugin author selectable.

needs wrote:

Plugin must be compiled, we can found later Windows-only plugin and I don't think that would be good for Teeworlds.

Or maybe the plugin authors will provide, as Teeworlds, plugins built for each platform wink
And if the plugin author provide the sources (depending of plugin license), the user can compile them in order to have the plugin on his platform.

10

Re: Plugins client

If we can't get the source and there are only Windows binairies, that's a problem. If the plugin become popular, every Linux/Mac/... player will be excluded.

Anyway, Your project is interresting, keep up the good work !

11

Re: Plugins client

needs wrote:

If we can't get the source and there are only Windows binairies, that's a problem. If the plugin become popular, every Linux/Mac/... player will be excluded.

Yeah, I also think that Windows-only plugins will be a problem, but I don't think that plugin authors will not share their plugins only on Windows.
I think that plugins will be on a open-source license, in order to keep the "gratuitousness" of Teeworlds.