![]() |
Chunks pre-generation - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: Chunks pre-generation (/thread-432.html) |
RE: Chunks pre-generation - xoft - 05-31-2012 Do you have mobs turned on? There've been crashes observed concerning that (mobs + generating chunks), and Rev 521 should have fixed it. The queue size is arbitrary, there's no actually problem enlarging it. The log message was mainly meant as a means for us devs to know if the chunk generation is fast enough. I think what you'd need more is a means to know when a chunk has been generated, some sort of a hook, perhaps? But I'm not sure if I can do such a thing, after all, Lua integration has been done by FakeTruth. I'd prefer if he did that ![]() FakeTruth, could you make a new hook, "chunk ready", that is triggerred in cWorld::SetChunkData() ? I know that hook would be called for chunks loaded as well as generated, but then the plugin can check the size of the generator queue to decide whether to queue more chunks. I can make a simple query function that would return the number of chunks in the generator queue (and possibly in the lighting queue as well), that should be as simple as marking a function "tolua_export", shouldn't it? EDIT: The query functions have been done (Rev 524): cWorld::GetGeneratorQueueLength(); cWorld::GetLightingQueueLength(); cWorld::GetStorageLoadQueueLength(); cWorld::GetStorageSaveQueueLength(); You might want to check the lighting queue as well as the generator queue, because lighting is actually done right after generating a chunk (if it has all neighbors). RE: Chunks pre-generation - Taugeshtu - 05-31-2012 Quote:Do you have mobs turned on?Yes I do) Quote:I think what you'd need more is a means to know when a chunk has been generated, some sort of a hook, perhaps?I'm not sure if "hook" concept is familiar to me, I'll look more about them Quote:I can make a simple query function that would return the number of chunks in the generator queue (and possibly in the lighting queue as well)Exactly my thought! Thanks a lot for your help ![]() RE: Chunks pre-generation - xoft - 05-31-2012 Hook = your Lua function that gets called if something happens. For example, "OnBlockDig" is a hook that is called when a player holds left mouse button and the client decides that the block should be dug up. RE: Chunks pre-generation - Taugeshtu - 05-31-2012 Oh, yes, got it ![]() Now I need some time to write some stuff, and first ChunkWorx release will be there! RE: Chunks pre-generation - Taugeshtu - 05-31-2012 Ran into problems accessing worlds through plugin (I want to make a table, like in "Playerlist", for selecting world for operations) - all worlds (except default one) have same ValueName. How do I get a list of all worlds then? (I expect cIniFile to return first world name found). RE: Chunks pre-generation - NiLSPACE - 05-31-2012 Maybe is it possible to let the server generate terain when nobody is in the server RE: Chunks pre-generation - Taugeshtu - 05-31-2012 Quote:Maybe is it possible to let the server generate terain when nobodyis in the serverAlready done, see ChunkWorx somewhere nearby ![]() One more tiny issue: how to convert cWorld to string? GetWorld() needs world name and won't accept world pointer, and cWorld seems to have no GetName() method... RE: Chunks pre-generation - xoft - 05-31-2012 cWorld:GetName() should work. If not, there's something rotten in the code ![]() I think what STR_Warrior meant is that the plugin should stop pre-generating if someone joins, and continue when they disconnect. And possibly that the pre-generation should run without the coords being specified, just when the server is "idling", let it generate chunks around the spawn a bit. This could be useful for a few days, but then the chunks would surely be generated uselessly and the world would grow too much without players actually exploring the it. I don't know, it's about finding the balance... Perhaps a limit that can be pushed further once players go further away. RE: Chunks pre-generation - Taugeshtu - 05-31-2012 Quote:there's something rotten in the codeUh... It works ![]() Now, point regeneration - and v2 ChunkWorkx is there! Still, how do I get a list of worlds (similar to players list)? Not that I need it much... But it would be nice to have. RE: Chunks pre-generation - xoft - 05-31-2012 I think most of your API questions can be answered easily by looking at the C++ code. Can you have a look at it? In the cWorld.h, cRoot.h, cPlayer.h etc. files, you'll find the C++ declarations for the classes, and functions marked with "// tolua_export" are exported to Lua. Simple as that ![]() -- or -- Have a look at source/Bindings.cpp, at the very bottom there's a function Code: TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) |