sort of a DoEvents() hack for overwhelming ABM hits

leetelate
Member
 
Posts: 205
Joined: Thu Aug 29, 2013 18:07

sort of a DoEvents() hack for overwhelming ABM hits

by leetelate » Sat Sep 14, 2013 16:52

Overwhelmed by ABM hits dragging the server down?

try this around your abm code

local time1 = 0
local time2 = 0

minetest.register_abm({
nodenames = {"default:sand"},
neighbors = {"default:water_source","default:sand"},
interval = 800,
chance = 88,
action = function(pos, node)

time1 = os.time()
if time1-time2 < 1 then return end
time2 = os.time()

--makes the time between each abm hit down to >1 second between each - fractions of a second are also possible - basically gives the server time to "catch up" especially if you have a lot of stuff going on in your abm

interval and chance are fine, but when there are huge numbers of blocks, sometimes you can get 400-500 abm hits in one second - slowing it down by returning without doing anything gives the server a chance to breathe

source: lua-users wiki and much testing
MT IS MC'S SMARTER BROTHER
minetest 0.4.8 compiled from latest git on linux mint 15 with qjoypad and wired 360 controller
freeminer, pilztest, buildcraft and next are the idea factories
my minetest page is http://1337318.zymichost.com if zymic isn't down - meh, it is free...
 

Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 13 guests

cron