Difference between revisions of "Mesecons guidelines"

From Pandorabox
Jump to navigation Jump to search
m (BuckarooBanzai moved page Mesecons optimization to Mesecons guidelines)
(Added explanation for "Penalty")
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[File:screenshot_20190918_192832.png|400px]]
 
  
[[Category:Stub]]
+
{| class="wikitable" style="float:right;"
 +
!colspan="10"| just... why?
 +
|-
 +
!colspan="10"|[[File:screenshot_20190918_192832.png|480px]]
 +
|}
 +
 
 +
=== Overview ===
 +
 
 +
This page should help to keep the mesecons performant and efficient so
 +
that everybody can play with them
 +
 
 +
==== On/Off switches ====
 +
 
 +
* Please add On/Off switches to your machinery and toggle them on only if you use them
 +
 
 +
==== Intervals ====
 +
 
 +
* Use intervals of 5 seconds or more, depending on how much is connected to the wire
 +
* Shorter intervals are ok if the executed action is not that heavy (for example: a simple light or signal)
 +
 
 +
==== Size/Length limits ====
 +
 
 +
* Try to limit the amount of machines triggered by LuaC's or blinkys
 +
 
 +
{| class="wikitable" style="float:right;"
 +
!colspan="10"| This should work fine with a 3 to 5 seconds interval
 +
|-
 +
!colspan="10"|[[File:monitoring-mesecons-2.png|400px]]
 +
|}
 +
 
 +
==== Luacontroller with on/off switch ====
 +
 
 +
The following program generates a signal-change every 5 seconds.
 +
It can be toggled with a switch on '''port A''' and generates the signal on '''port B'''
 +
 
 +
<syntaxhighlight lang="Lua">
 +
if event.type == "program" or event.type == "interrupt" then
 +
interrupt(5)
 +
if not pin.a then
 +
  return
 +
end
 +
port.b = not port.b
 +
end
 +
</syntaxhighlight>
 +
 
 +
==== Debugging ====
 +
 
 +
* Use the Monitoring page to see how the mesecons are working right now: https://monitoring.minetest.land/d/LjYzPumWz/mesecons?orgId=1&refresh=5s
 +
* You can check out the lag-stats, if the average value is above ~750 milliseconds there is something wrong...
 +
* Please also enable the mesecons hud with '''"/mesecons_hud on"''' to see how much CPU ''usage'' the current mapblock/position consumes
 +
* You can also see the ''Penalty'' the ''usage'' results in. ''Penalty'' refers to the throttling of mesecons activity in that mapblock.
 +
{| class="wikitable" style="float:right;"
 +
!colspan="10"| Example of heavy mesecons activity
 +
|-
 +
!colspan="10"|[[File:monitoring-mesecons-1.png|400px]]
 +
|}
 +
 
 +
 
 +
 
 +
 
 +
[[Category:Mesecons]]

Latest revision as of 12:33, 20 October 2020

just... why?
Screenshot 20190918 192832.png

Overview

This page should help to keep the mesecons performant and efficient so that everybody can play with them

On/Off switches

  • Please add On/Off switches to your machinery and toggle them on only if you use them

Intervals

  • Use intervals of 5 seconds or more, depending on how much is connected to the wire
  • Shorter intervals are ok if the executed action is not that heavy (for example: a simple light or signal)

Size/Length limits

  • Try to limit the amount of machines triggered by LuaC's or blinkys
This should work fine with a 3 to 5 seconds interval
Monitoring-mesecons-2.png

Luacontroller with on/off switch

The following program generates a signal-change every 5 seconds. It can be toggled with a switch on port A and generates the signal on port B

if event.type == "program" or event.type == "interrupt" then
 interrupt(5)
 if not pin.a then
  return
 end
 port.b = not port.b
end

Debugging

  • Use the Monitoring page to see how the mesecons are working right now: https://monitoring.minetest.land/d/LjYzPumWz/mesecons?orgId=1&refresh=5s
  • You can check out the lag-stats, if the average value is above ~750 milliseconds there is something wrong...
  • Please also enable the mesecons hud with "/mesecons_hud on" to see how much CPU usage the current mapblock/position consumes
  • You can also see the Penalty the usage results in. Penalty refers to the throttling of mesecons activity in that mapblock.
Example of heavy mesecons activity
Monitoring-mesecons-1.png