Difference between revisions of "Mesecons speed advices"

From Pandorabox
Jump to navigation Jump to search
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
This article exists to provide advices on the speed of Mesecons mod devices.
 
This article exists to provide advices on the speed of Mesecons mod devices.
 
Please add your ideas to discussion so we have easily-readable list of solutions.
 
Please add your ideas to discussion so we have easily-readable list of solutions.
 +
 +
Be sure to read [[Mesecons guidelines]]
  
 
=== Generic advice ===
 
=== Generic advice ===
Line 6: Line 8:
 
* Check how your device uses system resources with "/mesecons_hud on" and try to minimize the use.
 
* Check how your device uses system resources with "/mesecons_hud on" and try to minimize the use.
 
* Long LuaController code tends to be slower than short one, if there's no cycles. If you can, simply use interrupt with a given time and basic logic.
 
* Long LuaController code tends to be slower than short one, if there's no cycles. If you can, simply use interrupt with a given time and basic logic.
 +
 +
==== Sample switcher code ====
 +
 +
<syntaxhighlight lang="Lua">
 +
    interrupt(2)
 +
    port.b = pin.d
 +
    port.d = not pin.d
 +
</syntaxhighlight>
  
 
=== Wire lengths ===
 
=== Wire lengths ===
Line 13: Line 23:
  
 
=== Spacing ===
 
=== Spacing ===
Mesecons devices work after player approaches them and stop some time later.
+
Mesecons devices work after player approaches them and stop when player leaves.
When you make a device, you want to put it far enough from others to avoid too much things working at the same time.
+
When you make a device, you want to put it far away enough from others to avoid too many things working at the same time.
 +
 
 +
There's a concept of mapblocks, not a certain block of the map, but a cube containing a number of normal blocks(nodes). It's 16(X) x 16(Y) x 16(Z) nodes. It's best to put the whole device inside one mapblock.
 +
 
 +
You can see the mapblock you are at with "/mesecons_hud on".
 +
Or using the "/postool" HUD.
 +
 
 +
See also:
 +
 
 +
- [[Mesecons_guidelines|Mesecons Guidlines]]
 +
 
 +
- [https://github.com/SwissalpS/postool postool]
 +
 
 +
- [[Mesecons_Tutorial|Mesecons Tutorial]]
  
There exists a concept of mapblock, not a certain block of the map, but a cube containing a number of normal blocks. I am not really sure, but it's probably 32x32x32 blocks. ''':TODO:''' It's best to put the whole device inside one mapblock.
+
- [[Mesecons_debug|Mesecons Debug]]
  
You can currently see the mapblock you are at with "/mesecons_hud on".
+
[[Category:Mesecons]]
 +
[[Category:Digiline]]
 +
[[Category:Lua controller]]

Latest revision as of 08:51, 10 October 2022

This article exists to provide advices on the speed of Mesecons mod devices. Please add your ideas to discussion so we have easily-readable list of solutions.

Be sure to read Mesecons guidelines

Generic advice

  • Please try to make your device as simple as it needs to be.
  • Check how your device uses system resources with "/mesecons_hud on" and try to minimize the use.
  • Long LuaController code tends to be slower than short one, if there's no cycles. If you can, simply use interrupt with a given time and basic logic.

Sample switcher code

    interrupt(2)
    port.b = pin.d
    port.d = not pin.d

Wire lengths

Each mesecon wire changes its style when switching. It means changing the database and interacting with client, plus lots of Lua processing. By minimizing wire lengths, you minimize the processing delay your device adds and vice versa, so please use shorter wires.

Digiline wires partially help. In general, digiline devices are less active and you can speed up some processing using digiline injectors instead of stackwise ones, at least currently.

Spacing

Mesecons devices work after player approaches them and stop when player leaves. When you make a device, you want to put it far away enough from others to avoid too many things working at the same time.

There's a concept of mapblocks, not a certain block of the map, but a cube containing a number of normal blocks(nodes). It's 16(X) x 16(Y) x 16(Z) nodes. It's best to put the whole device inside one mapblock.

You can see the mapblock you are at with "/mesecons_hud on". Or using the "/postool" HUD.

See also:

- Mesecons Guidlines

- postool

- Mesecons Tutorial

- Mesecons Debug