06-12-2012, 05:10 AM
Threaded mods? what do you mean?
Mobs are fixed, they need to be handled in the world's tick thread and there could be only one tick thread per world.
Current mobs are crappy, hopefully we'll get a new AI one day. But still, all in one thread. That's one of the reasons that the minecraft servers are so CPU-heavy.
It's not so much "one thread per plugin" as "no more than one thread executing one plugin's code". Plugins run in the thread in which their hook has happenned - OnTick is called in the context of the tick thread, OnChat is called in the player comm handling thread, etc. But there's a simple guarantee that no more than one thread is executing any single plugin's code (otherwise it would be a mess).
A while ago I was pondering about plugin-created threads - so that plugins can queue tasks for later execution etc. But it's quite difficult with the current Lua integration (i. e. I have no idea on how to do that )
Mobs are fixed, they need to be handled in the world's tick thread and there could be only one tick thread per world.
Current mobs are crappy, hopefully we'll get a new AI one day. But still, all in one thread. That's one of the reasons that the minecraft servers are so CPU-heavy.
It's not so much "one thread per plugin" as "no more than one thread executing one plugin's code". Plugins run in the thread in which their hook has happenned - OnTick is called in the context of the tick thread, OnChat is called in the player comm handling thread, etc. But there's a simple guarantee that no more than one thread is executing any single plugin's code (otherwise it would be a mess).
A while ago I was pondering about plugin-created threads - so that plugins can queue tasks for later execution etc. But it's quite difficult with the current Lua integration (i. e. I have no idea on how to do that )