[Modpack] Wireworld Mod [minetest-wireworld]

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

[Modpack] Wireworld Mod [minetest-wireworld]

by Byakuren » Tue Apr 14, 2015 02:03

I read this: https://unnikked.ga/simulate-logic-circuits-wireworld

and decided it might be neat to implement in minetest.

This is my first mod other than the tutorial one on the wiki, so any pointers are appreciated.

Repo: https://github.com/raymoo/minetest-wireworld

Latest Release (0.0.4):
https://github.com/raymoo/minetest-wireworld/archive/v0.0.4-2.zip

Old Versions:
0.0.3 (Broken) - https://github.com/raymoo/minetest-wireworld/archive/v0.0.3.zip
0.0.2 - https://github.com/raymoo/minetest-wireworld/archive/v0.0.2.zip
0.0.1 - https://github.com/raymoo/minetest-wireworld/archive/v0.0.1.zip

Item Descriptions:
The wireworld blocks, other than the interface, correspond to the normal wireworld cells.

A zapper is a tool that lets you turn conductors into electron heads by left-clicking them.

The on and off interfaces are like new kinds of cells - When one or more electron heads are in its Moore neighborhood, it changes state to on. Otherwise, it turns off (or stays off). This means that the interface will react to neighboring electron heads with a delay of one simulation step.

Mesecons:
Conductors will turn into electron heads on the rising edge of a mesecons signal.

Interfaces output mesecons signals. If you don't want interfaces to interfere with your wireworld circuits, put them so that they are only touching one wireworld cell - that way it won't activate anything when the signal turns on. Of course, there are probably good applications of actually having them interfere. An easy example is instant transmission of wireworld electrons.


IDs:
+ Spoiler



Crafting Recipes:
+ Spoiler


Screenshots:

+ Spoiler

As you can see, it is fairly bare-bones.
Last edited by Byakuren on Wed Jan 10, 2018 21:10, edited 16 times in total.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [Mod] Wireworld Mod

by Evergreen » Tue Apr 14, 2015 02:37

Could you post some screenshots of this? Also, the git repository should be the root of the project, there should be an extra folder.
Back from the dead!
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Wireworld Mod

by Byakuren » Tue Apr 14, 2015 02:39

Evergreen wrote:Could you post some screenshots of this? Also, the git repository should be the root of the project, there should be an extra folder.


Where should the extra folder be? And I'll get some screenshots.
Every time a mod API is left undocumented, a koala dies.
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Wireworld Mod

by Byakuren » Tue Apr 14, 2015 02:57

I'm assuming you meant that I shouldn't have an extra folder, so I have moved everything up a directory. Also added some screenshots and a new release.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
Krock
Developer
 
Posts: 4145
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [Mod] Wireworld Mod

by Krock » Tue Apr 14, 2015 06:12

It's great to see a new version of this mod.
The old one from PilzAdam was limited to the x and z axis.

Please change the title to [Modpack] because those mods need each other.
An idea would also be the compatibility with mesecons, so it would be possible to send a signal with a wireworld circuit.
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Wireworld Mod

by Byakuren » Tue Apr 14, 2015 06:28

Krock wrote:It's great to see a new version of this mod.
The old one from PilzAdam was limited to the x and z axis.

Please change the title to [Modpack] because those mods need each other.
An idea would also be the compatibility with mesecons, so it would be possible to send a signal with a wireworld circuit.


Thanks. I didn't know there was a previous wireworld mod, or that there was significant interest. Mesecons compatibility is something I was already thinking about, but I'll have to look at the mesecons api and figure it out.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [Mod] Wireworld Mod

by Evergreen » Tue Apr 14, 2015 11:46

Byakuren wrote:I'm assuming you meant that I shouldn't have an extra folder, so I have moved everything up a directory. Also added some screenshots and a new release.

Yes, that is what I meant. Also, this looks very interesting, I'll try it the next chance I get.
Back from the dead!
 

twoelk
Member
 
Posts: 1257
Joined: Fri Apr 19, 2013 16:19
Location: northern Germany
GitHub: twoelk
IRC: twoelk
In-game: twoelk

Re: [Modpack] Wireworld Mod

by twoelk » Tue Apr 14, 2015 12:56

somehow I always keep clicking this thread to look for a wireframe view mod XD
 

User avatar
ExeterDad
Member
 
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: [Modpack] Wireworld Mod

by ExeterDad » Tue Apr 14, 2015 19:17

twoelk wrote:somehow I always keep clicking this thread to look for a wireframe view mod XD

Guilty as well :)
 

prestidigitator
Member
 
Posts: 640
Joined: Thu Feb 21, 2013 23:54

Re: [Modpack] Wireworld Mod

by prestidigitator » Tue Apr 14, 2015 19:57

The main mod itself looks cool, but...

Two extra mods and dozens of functions just to loop over the nodes in adjacent positions? That's some mighty obfuscation there. You might want to try just a triple-nested loop, or some mod arithmetic. That way you can easily optimize a bit, too (since it doesn't matter if you have more than 3 heads...). Something like:

Code: Select all
local function count_neighbors(pos, filter, limit)
   local x, y, z = pos.x, pos.y, pos.z;
   if not limit then limit = 26; end;
   
   local c = 0;
   for dx = -1, 1 do
      for dy = -1, 1 do
         for dz = -1, 1 do
            if (dx ~= 0 or dy ~= 0 or dz ~= 0) and filter(minetest.get_node({x=x+dx, y=y+dy, z=z+dz})) then
               c = c + 1;
               if c >= limit then return c; end;
            end;
         end;
      end;
   end;
   
   return c;
end;

local function is_electron_head(node)
   return node.name == "wireworld:electron_head";
end;

local function count_electron_head_neighbors(pos)
   return count_neighbors(pos, is_electron_head, 3);
end;


EDIT: For that matter, you could even just do it like this, since you only count electron heads for a node that is, itself, not one:

Code: Select all
local function count_electron_head_neighbors(pos)
   local pMin = {x=pos.x-1, y=pos.y-1, z=pos.z-1};
   local pMax = {x=pos.x+1, y=pos.y+1, z=pos.z+1};
   local heads = minetest.find_nodes_in_area(pMin, pMax, { "wireworld:electron_head" });
   return #heads;
end;
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Modpack] Wireworld Mod

by Byakuren » Tue Apr 14, 2015 23:24

prestidigitator wrote:The main mod itself looks cool, but...

Two extra mods and dozens of functions just to loop over the nodes in adjacent positions? That's some mighty obfuscation there. You might want to try just a triple-nested loop, or some mod arithmetic. That way you can easily optimize a bit, too (since it doesn't matter if you have more than 3 heads...). Something like:

Code: Select all
local function count_neighbors(pos, filter, limit)
   local x, y, z = pos.x, pos.y, pos.z;
   if not limit then limit = 26; end;
   
   local c = 0;
   for dx = -1, 1 do
      for dy = -1, 1 do
         for dz = -1, 1 do
            if (dx ~= 0 or dy ~= 0 or dz ~= 0) and filter(minetest.get_node({x=x+dx, y=y+dy, z=z+dz})) then
               c = c + 1;
               if c >= limit then return c; end;
            end;
         end;
      end;
   end;
   
   return c;
end;

local function is_electron_head(node)
   return node.name == "wireworld:electron_head";
end;

local function count_electron_head_neighbors(pos)
   return count_neighbors(pos, is_electron_head, 3);
end;


EDIT: For that matter, you could even just do it like this, since you only count electron heads for a node that is, itself, not one:

Code: Select all
local function count_electron_head_neighbors(pos)
   local pMin = {x=pos.x-1, y=pos.y-1, z=pos.z-1};
   local pMax = {x=pos.x+1, y=pos.y+1, z=pos.z+1};
   local heads = minetest.find_nodes_in_area(pMin, pMax, { "wireworld:electron_head" });
   return #heads;
end;


Thanks for the feedback.

I already implemented the find_nodes_in_area fix in the repo version a few hours ago (This commit: https://github.com/raymoo/minetest-wire ... e21b1a4958).

I didn't intend to do any obfuscation with those two modules. The Church module was intended to reimplement some functions I was familiar with - they wouldn't normally be custom functions. I can probably reduce the size of bobutil though, since I'm not using the neighbors function I was using before.


EDIT: Actually, the only thing that might deserve to be its own module is Church, unless I expanded BobUtil to be a bit more general, and there are probably already similar libraries around. The reason I made them separate mods though, is that I haven't figured out how to split my code across different files otherwise. Since the mod folder doesn't seem to be part of the lua path, I don't know how to include other files.

EDIT2: I also did not know about the pound sign operator. I will include that in my code too.
Every time a mod API is left undocumented, a koala dies.
 

prestidigitator
Member
 
Posts: 640
Joined: Thu Feb 21, 2013 23:54

Re: [Modpack] Wireworld Mod

by prestidigitator » Wed Apr 15, 2015 05:17

Byakuren wrote:I haven't figured out how to split my code across different files otherwise. Since the mod folder doesn't seem to be part of the lua path, I don't know how to include other files.

Ah. Yeah. It's a bit of a shame the Minetest environment doesn't take advantage of standard Lua modules/packages/require. You can make it work, but it's a pain. Actually modules could really have been used pretty much instead of the whole mod+depends.txt thing. But whatever.

To execute code in another file use minetest.get_current_modname(), minetest.get_modpath(), and dofile(). Using dofile() will essentially call the code in another file as if it is in the body of a function with no parameters. It returns whatever that code returns. So you can either call and expect side effects (e.g. addition of global variables), or you can return value(s) from it. For example, you could write something like:

Code: Select all
local MOD_NAME = minetest.current_modname();
local MOD_PATH = minetest.get_modpath(MOD_NAME);

local BobUtil = dofile(MOD_PATH .. "/BobUtil.lua");


And you could have BobUtil.lua leave up to the caller the choice of whether or not to add it to the global namespace:

Code: Select all
local BobUtil = {};

local function BobUtil.myfunc()
   -- ...
end;

return BobUtil;


It looks sort of like Lua modules, just without the nice module() and require() functions and their use of the standard package.* stuff.
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Modpack] Wireworld Mod

by Byakuren » Wed Apr 15, 2015 06:00

I didn't know you could return functions with dofile and lua files, that will let me keep BobUtil from escaping into the global scope. Thanks again.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [Modpack] Wireworld Mod

by Evergreen » Wed Apr 15, 2015 14:54

I just tried this, and it works very nicely. Good job on reviving tis idea.
Back from the dead!
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Modpack] Wireworld Mod

by Byakuren » Wed Apr 15, 2015 20:32

Added mesecons support, and a crafting recipe for the zapper.

EDIT: Actually, that broke something. I should have tested it a bit more.

EDIT2: I think I have a good idea for a fix.
Every time a mod API is left undocumented, a koala dies.
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Modpack] Wireworld Mod

by Byakuren » Wed Apr 15, 2015 22:06

Released version 0.0.4. This version fixes the problem with 0.0.3 by adding special blocks for detecting wireworld electrons, rather than having electron heads be receptors themselves. Also added more information to the OP
Every time a mod API is left undocumented, a koala dies.
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [Modpack] Wireworld Mod

by Evergreen » Thu Apr 16, 2015 00:27

It appears your code still depends on bobutil, even though it doesn't exist in the current version:

Code: Select all
2015-04-15 20:24:58: ERROR[main]: The following mods could not be found: "bobutil"
2015-04-15 20:24:58: ERROR[main]: ========== ERROR FROM LUA ===========
2015-04-15 20:24:58: ERROR[main]: Failed to load and run script from
2015-04-15 20:24:58: ERROR[main]: /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua:
2015-04-15 20:24:58: ERROR[main]: cannot open /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/lib/bobutil.lua: No such file or directory
2015-04-15 20:24:58: ERROR[main]: stack traceback:
2015-04-15 20:24:58: ERROR[main]:       [C]: in function 'dofile'
2015-04-15 20:24:58: ERROR[main]:       ...ns/minetest-dev/bin/../mods/wireworld/wireworld/init.lua:3: in main chunk
2015-04-15 20:24:58: ERROR[main]: ======= END OF ERROR FROM LUA ========
2015-04-15 20:24:58: ERROR[main]: Server: Failed to load and run /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua
2015-04-15 20:24:58: ERROR[main]: ModError: ModError: Failed to load and run /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua
Back from the dead!
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Modpack] Wireworld Mod

by Byakuren » Thu Apr 16, 2015 00:45

Evergreen wrote:It appears your code still depends on bobutil, even though it doesn't exist in the current version:

Code: Select all
2015-04-15 20:24:58: ERROR[main]: The following mods could not be found: "bobutil"
2015-04-15 20:24:58: ERROR[main]: ========== ERROR FROM LUA ===========
2015-04-15 20:24:58: ERROR[main]: Failed to load and run script from
2015-04-15 20:24:58: ERROR[main]: /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua:
2015-04-15 20:24:58: ERROR[main]: cannot open /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/lib/bobutil.lua: No such file or directory
2015-04-15 20:24:58: ERROR[main]: stack traceback:
2015-04-15 20:24:58: ERROR[main]:       [C]: in function 'dofile'
2015-04-15 20:24:58: ERROR[main]:       ...ns/minetest-dev/bin/../mods/wireworld/wireworld/init.lua:3: in main chunk
2015-04-15 20:24:58: ERROR[main]: ======= END OF ERROR FROM LUA ========
2015-04-15 20:24:58: ERROR[main]: Server: Failed to load and run /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua
2015-04-15 20:24:58: ERROR[main]: ModError: ModError: Failed to load and run /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua


Are you sure? bobutil isn't in the depends for wireworld, and I'm not getting the same error.

EDIT: Found the problem to the file not found error, but it was because I hadn't added the new bobutil file to the repo. I probably should have just done a git mv. I think the "mod missing" message is because you still have bobutil included in your world, though.

EDIT2: I have applied the fix.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [Modpack] Wireworld Mod

by Evergreen » Thu Apr 16, 2015 01:07

Byakuren wrote:
Evergreen wrote:It appears your code still depends on bobutil, even though it doesn't exist in the current version:

Code: Select all
2015-04-15 20:24:58: ERROR[main]: The following mods could not be found: "bobutil"
2015-04-15 20:24:58: ERROR[main]: ========== ERROR FROM LUA ===========
2015-04-15 20:24:58: ERROR[main]: Failed to load and run script from
2015-04-15 20:24:58: ERROR[main]: /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua:
2015-04-15 20:24:58: ERROR[main]: cannot open /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/lib/bobutil.lua: No such file or directory
2015-04-15 20:24:58: ERROR[main]: stack traceback:
2015-04-15 20:24:58: ERROR[main]:       [C]: in function 'dofile'
2015-04-15 20:24:58: ERROR[main]:       ...ns/minetest-dev/bin/../mods/wireworld/wireworld/init.lua:3: in main chunk
2015-04-15 20:24:58: ERROR[main]: ======= END OF ERROR FROM LUA ========
2015-04-15 20:24:58: ERROR[main]: Server: Failed to load and run /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua
2015-04-15 20:24:58: ERROR[main]: ModError: ModError: Failed to load and run /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua


Are you sure? bobutil isn't in the depends for wireworld, and I'm not getting the same error.

EDIT: Found the problem to the file not found error, but it was because I hadn't added the new bobutil file to the repo. I probably should have just done a git mv. I think the "mod missing" message is because you still have bobutil included in your world, though.

EDIT2: I have applied the fix.

Good, it works now. Also, you should probably make the on state of the mesecons interface not available in teh creative inventory, and you should also make it drop the off state version of it when dug.
Back from the dead!
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Modpack] Wireworld Mod

by Byakuren » Thu Apr 16, 2015 01:11

Evergreen wrote:
Byakuren wrote:
Evergreen wrote:It appears your code still depends on bobutil, even though it doesn't exist in the current version:

Code: Select all
2015-04-15 20:24:58: ERROR[main]: The following mods could not be found: "bobutil"
2015-04-15 20:24:58: ERROR[main]: ========== ERROR FROM LUA ===========
2015-04-15 20:24:58: ERROR[main]: Failed to load and run script from
2015-04-15 20:24:58: ERROR[main]: /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua:
2015-04-15 20:24:58: ERROR[main]: cannot open /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/lib/bobutil.lua: No such file or directory
2015-04-15 20:24:58: ERROR[main]: stack traceback:
2015-04-15 20:24:58: ERROR[main]:       [C]: in function 'dofile'
2015-04-15 20:24:58: ERROR[main]:       ...ns/minetest-dev/bin/../mods/wireworld/wireworld/init.lua:3: in main chunk
2015-04-15 20:24:58: ERROR[main]: ======= END OF ERROR FROM LUA ========
2015-04-15 20:24:58: ERROR[main]: Server: Failed to load and run /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua
2015-04-15 20:24:58: ERROR[main]: ModError: ModError: Failed to load and run /home/evergreen/programs/minetest_versions/minetest-dev/bin/../mods/wireworld/wireworld/init.lua


Are you sure? bobutil isn't in the depends for wireworld, and I'm not getting the same error.

EDIT: Found the problem to the file not found error, but it was because I hadn't added the new bobutil file to the repo. I probably should have just done a git mv. I think the "mod missing" message is because you still have bobutil included in your world, though.

EDIT2: I have applied the fix.

Good, it works now. Also, you should probably make the on state of the mesecons interface not available in teh creative inventory, and you should also make it drop the off state version of it when dug.


It does drop the off version, but I'll set it to not appear in creative,
Every time a mod API is left undocumented, a koala dies.
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [Modpack] Wireworld Mod

by Evergreen » Thu Apr 16, 2015 15:14

Good job! This could potentially be very useful for mesecons contraptions.
Back from the dead!
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Modpack] Wireworld Mod

by Byakuren » Thu Apr 16, 2015 17:12

Evergreen wrote:Good job! This could potentially be very useful for mesecons contraptions.


There isn't really anything you can compute with wireworld that you can't already due with mesecons more easily, even if you exclude luacontrollers. The advantages with wireworld I see is that it looks nice, and you can have fun messing with more configurations.

Another thing is that the active range limits the size of wireworld circuits, since clock generators/loops will go out of sync if they leave your active range. This could be solved by increasing the active range, but that might be impractical if you are using a low-power machine, or are a server.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [Modpack] Wireworld Mod

by Evergreen » Thu Apr 16, 2015 21:07

Byakuren wrote:
Evergreen wrote:Good job! This could potentially be very useful for mesecons contraptions.


There isn't really anything you can compute with wireworld that you can't already due with mesecons more easily, even if you exclude luacontrollers. The advantages with wireworld I see is that it looks nice, and you can have fun messing with more configurations.

Another thing is that the active range limits the size of wireworld circuits, since clock generators/loops will go out of sync if they leave your active range. This could be solved by increasing the active range, but that might be impractical if you are using a low-power machine, or are a server.

You could use rubenwardy's anchor mod to keep the chunks loaded, but you are right. It is more about novelty than anything else.
Back from the dead!
 

prestidigitator
Member
 
Posts: 640
Joined: Thu Feb 21, 2013 23:54

Re: [Modpack] Wireworld Mod

by prestidigitator » Fri Apr 17, 2015 04:00

Evergreen wrote:You could use rubenwardy's anchor mod to keep the chunks loaded, but you are right. It is more about novelty than anything else.

You could also run the simulation independently of the nodes, and simply have the nodes act as a GUI for the simulation (a view-controller for the simulation's model). That would also be a good way to ensure the integrity of the cellular automata, though it also introduces complications such as determining which nodes belong to which simulations (it wouldn't work too well to have a simulation that's big enough to cover all nodes everywhere at once—or, at least, it introduces data structure complications for determining neighbors, etc.).
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Modpack] Wireworld Mod

by Byakuren » Fri Apr 17, 2015 04:58

prestidigitator wrote:
Evergreen wrote:You could use rubenwardy's anchor mod to keep the chunks loaded, but you are right. It is more about novelty than anything else.

You could also run the simulation independently of the nodes, and simply have the nodes act as a GUI for the simulation (a view-controller for the simulation's model). That would also be a good way to ensure the integrity of the cellular automata, though it also introduces complications such as determining which nodes belong to which simulations (it wouldn't work too well to have a simulation that's big enough to cover all nodes everywhere at once—or, at least, it introduces data structure complications for determining neighbors, etc.).


Since empty space doesn't do anything in wireworld, I was thinking I could have some way to register a group of "connected" blocks as a simulation, where two nodes are connected if they are in each other's Moore neighborhood, or if they are both connected to a third node.

Simulating wireworld separate from the nodes would also let me use a timestep lower than 1.

Some disadvantages I see with this approach would be that it takes more effort (and potential bugginess) in handling what happens to a simulation when nodes are removed. The simplest solution would just be to break the simulation, I guess. The nodes that become part of a simulation could store some unique name for the simulation, and then tell it to die if the node is removed.

I have a couple of modding questions, though. How would I make something happen at a set interval, independent of nodes? Use minetest.after on a function that itself passes itself to after? Also, I don't know what the popular way to serialize mod data. Writing a file to the mod directory would work, but maybe there is some built in data store place designed for storing mod state.
Every time a mod API is left undocumented, a koala dies.
 

Next

Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 3 guests