Hook Question
#24
(11-22-2013, 03:51 PM)xoft Wrote:
(11-22-2013, 08:14 AM)FakeTruth Wrote: ... it could be stored in a fixed size array which should be pretty fast.
That's fast in C++, but giving that list to Lua means creating a Lua table, which means allocating lots of memory chunks off the heap, which is gonna be slow again. And it's not gonna bring the counts that low - 19*19 chunks, 20 times per second, is 7k calls per second, which means 14k thread context switches per second. Barely doable.
You could wrap it with a C++ struct/class so it doesn't require a table in Lua.

(11-22-2013, 03:51 PM)xoft Wrote: Remembering all the blocks eligible for growing is probably going to be too memory-intensive. There's nothing preventing the player from having an entire chunk full of mossy cobble, which would translate to storing 65k coord triplets. Again, too many heap allocations for storing that in a Lua table.

Might just be best to select a random few coords per chunk in each tick, see if there's a mossy cobble there and growing it then. Pity that the plugins don't have access to per-chunk ticking which would make it considerably faster; also there's no way to enumerate the loaded chunks, so probably this is not possible atm.
Like I said, only store potentially growable blocks. If you have an entire chunk full of mossy cobblestone blocks there is nothing left to grow there, it will store 0 blocks of that chunk.
Reply
Thanks given by:


Messages In This Thread
Hook Question - by bearbin - 12-29-2012, 04:04 AM
RE: Hook Question - by xoft - 12-29-2012, 06:14 AM
RE: Hook Question - by bearbin - 12-29-2012, 06:53 AM
RE: Hook Question - by NiLSPACE - 08-08-2013, 04:14 AM
RE: Hook Question - by xoft - 08-08-2013, 05:54 AM
RE: Hook Question - by bearbin - 08-08-2013, 05:56 AM
RE: Hook Question - by xoft - 08-08-2013, 06:24 AM
RE: Hook Question - by NiLSPACE - 08-08-2013, 05:57 AM
RE: Hook Question - by bearbin - 08-08-2013, 05:58 AM
RE: Hook Question - by NiLSPACE - 08-08-2013, 08:08 PM
RE: Hook Question - by xoft - 08-08-2013, 08:43 PM
RE: Hook Question - by NiLSPACE - 08-08-2013, 08:44 PM
RE: Hook Question - by NiLSPACE - 08-08-2013, 11:43 PM
RE: Hook Question - by xoft - 08-09-2013, 12:21 AM
RE: Hook Question - by NiLSPACE - 08-09-2013, 08:08 PM
RE: Hook Question - by xoft - 08-10-2013, 04:25 AM
RE: Hook Question - by xoft - 08-11-2013, 08:26 PM
RE: Hook Question - by NiLSPACE - 11-22-2013, 06:29 AM
RE: Hook Question - by xoft - 11-22-2013, 07:18 AM
RE: Hook Question - by FakeTruth - 11-22-2013, 08:14 AM
RE: Hook Question - by xoft - 11-22-2013, 03:51 PM
RE: Hook Question - by FakeTruth - 11-22-2013, 09:47 PM
RE: Hook Question - by NiLSPACE - 11-22-2013, 07:38 AM
RE: Hook Question - by xoft - 11-22-2013, 07:52 AM
RE: Hook Question - by xoft - 11-22-2013, 09:54 PM
RE: Hook Question - by FakeTruth - 11-23-2013, 06:51 AM
RE: Hook Question - by tigerw - 11-23-2013, 06:33 AM
RE: Hook Question - by NiLSPACE - 11-23-2013, 06:44 AM
RE: Hook Question - by tigerw - 11-23-2013, 07:12 AM
RE: Hook Question - by NiLSPACE - 11-23-2013, 07:17 AM
RE: Hook Question - by xoft - 11-23-2013, 07:19 AM
RE: Hook Question - by FakeTruth - 11-23-2013, 07:37 AM
RE: Hook Question - by tonibm19 - 12-31-2013, 05:11 AM
RE: Hook Question - by NiLSPACE - 12-31-2013, 05:20 AM
RE: Hook Question - by tonibm19 - 12-31-2013, 06:53 AM
RE: Hook Question - by xoft - 12-31-2013, 07:04 AM
RE: Hook Question - by NiLSPACE - 12-31-2013, 07:12 AM
RE: Hook Question - by NiLSPACE - 01-02-2014, 12:35 AM
RE: Hook Question - by tonibm19 - 02-03-2014, 03:28 AM
RE: Hook Question - by xoft - 02-03-2014, 05:16 AM
RE: Hook Question - by tonibm19 - 02-03-2014, 05:19 AM
RE: Hook Question - by xoft - 02-03-2014, 07:11 AM
RE: Hook Question - by NiLSPACE - 08-17-2014, 09:12 PM
RE: Hook Question - by ThuGie - 08-17-2014, 10:24 PM
RE: Hook Question - by xoft - 08-18-2014, 06:14 AM
RE: Hook Question - by NiLSPACE - 08-18-2014, 06:20 AM
RE: Hook Question - by xoft - 08-18-2014, 06:30 AM
RE: Hook Question - by NiLSPACE - 08-18-2014, 06:32 AM
RE: Hook Question - by NiLSPACE - 12-04-2014, 04:36 AM
RE: Hook Question - by xoft - 12-04-2014, 06:34 PM



Users browsing this thread: 15 Guest(s)