[Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

User avatar
Nigel
Member
 
Posts: 29
Joined: Fri May 03, 2019 09:08
Location: Corinth, Greece
GitHub: nyje
IRC: Nigel
In-game: Nigel

[Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by Nigel » Mon Nov 25, 2019 07:31

Symmetool Mirror
(c)2019 Nigel Garnett

A building tool for MineTest which places multiple blocks based on the current mode of its marker's symmetry settings.

Description & caveats:
It is designed to speed up building structures which have mirror symmetry in one, two or all three dimensions. It does this by mirroring nodes placed or dug with the tool in the X, Y & Z directions across a 'virtual mirror' which is marked by the tool placed 'in world'.

It can be used in creative mode, or in survival. For survival mode it soft depends on default for its crafting recipe:
Code: Select all
    "default:glass"        "default:steel_ingot"      "default:glass"
    "default:steel_ingot"  "default:meselamp"         "default:steel_ingot"
    "default:glass"        "default:steel_ingot"      "default:glass"

In survival mode, the materials the tool tries to use for building must be available in your main inventory somewhere.


It has only been tested on desktop but only uses the left/right mouse buttons, so should work fine on phones/tablets. In this case I believe "double tap"="right click" (how you place stuff) and "long tap"="left click" (how you dig stuff), although this is entirely untested ;-)

Testing has shown that protection mods are respected, the mod ***should*** be safe to use on multiplayer servers.

Basics:
Place the symmetry tool as you would any normal block. This creates the marker which will act as the mirror across which nodes will be mirrored.

At this stage (or any time the tool is not 'loaded' (see below)) the controls do the following:
  • Left clicking the node will remove it (or it can be dug as normal whilst holding almost any other node).
  • Right clicking on the node will cycle through the symmetry modes, which are shown visually, and in the in game chat. After ten seconds, the visual markers will disappear, but the node's infotext will indicate the mirroring mode.
  • Left clicking another node will load that node into the tool, and from now on right clicking will build with that node.
  • Right clicking another node will move the mirror node to the clicked position (you can only have one mirror node in world at any time).
From now on, until the tool is unloaded:
  • Right Click will place the loaded node in the world, and will also place a node on the opposite side of the mirror node, the same distance as you are from the mirror for every axis you have chosen.
  • Left Click will dig the node you are pointing at, and also dig the node in the mirrored positions for each axis.
  • Left clicking the sky (or nothing) will unload the tool so you can choose another node to build with.

Protection is respected for each individual node placement or removal, so the tool should be safe for multiplayer use.

Happy building ;-)


Screenshot & Video:
Image

Simple example build on YouTube

Dependencies:
It soft depends on minetest_game's default, but ONLY to provide the crafting recipe and to check for survival mode. It should operate without issue on any creative server.

License:
[url="https://github.com/nyje/symmetool/blob/master/LICENSE"]MIT[/url]


Downloads & source code:

Symmetool on Github

Symmetool on ContentDB

Or as a good old fashioned zip file:
symmetool-1.6.zip
v1.6 Ready for action version
(11.81 KiB) Downloaded 5 times
Last edited by Nigel on Thu Nov 28, 2019 10:44, edited 11 times in total.
My Published Mods: Visual Bots | Symmetool Mirror
 

User avatar
Nigel
Member
 
Posts: 29
Joined: Fri May 03, 2019 09:08
Location: Corinth, Greece
GitHub: nyje
IRC: Nigel
In-game: Nigel

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by Nigel » Mon Nov 25, 2019 16:46

Ok, Here is a really quick and simple example video showing the Symmetool in use, making a small building which is symmetrical accross the X & Z axes. (link goes to my new youtube minetest channel)

It is also live on our server "A D V E N T U R E T I M E" which needs a password to enter.
Look the server up on the serverlist & read the information to get the password.
My Published Mods: Visual Bots | Symmetool Mirror
 

User avatar
texmex
Member
 
Posts: 1616
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

User avatar
Nigel
Member
 
Posts: 29
Joined: Fri May 03, 2019 09:08
Location: Corinth, Greece
GitHub: nyje
IRC: Nigel
In-game: Nigel

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by Nigel » Mon Nov 25, 2019 17:53

Thanks ;-)

I got fed up repeating myself on castle & tower builds...
My Published Mods: Visual Bots | Symmetool Mirror
 

User avatar
Melkor
Member
 
Posts: 328
Joined: Sat Sep 24, 2011 01:03
Location: Underground
 

BuckarooBanzay
Member
 
Posts: 319
Joined: Tue Apr 24, 2018 05:58
Location: Switzerland
GitHub: thomasrudin-mt
In-game: BuckarooBanzai
 

User avatar
Nigel
Member
 
Posts: 29
Joined: Fri May 03, 2019 09:08
Location: Corinth, Greece
GitHub: nyje
IRC: Nigel
In-game: Nigel

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by Nigel » Mon Nov 25, 2019 21:41

@Melkor & @BuckarooBanzay

Thanks guys, and you're welcome. The praise & thanks means a lot coming from such talented modders ;-)

Several of my previous servers would not have been the same without your smart mods...
My Published Mods: Visual Bots | Symmetool Mirror
 

User avatar
rubenwardy
Moderator
 
Posts: 5886
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by rubenwardy » Tue Nov 26, 2019 00:01

This is pretty cool. Do you plan to make it consume nodes and have a craft recipe so it can be used in creative?
 

CalebJ
Member
 
Posts: 179
Joined: Sat Dec 29, 2018 19:21
Location: Tunnelers' Abyss
GitHub: KaylebJay
IRC: KaylebJay
In-game: CalebJ

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by CalebJ » Tue Nov 26, 2019 00:24

Mmmm... very interesting. Great work!!
If you want realism, you're in the wrong place. Get off your mobile.
 

User avatar
texmex
Member
 
Posts: 1616
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by texmex » Tue Nov 26, 2019 10:23

rubenwardy wrote:This is pretty cool. Do you plan to make it consume nodes and have a craft recipe so it can be used in creative?

You mean survival?
 

User avatar
Nigel
Member
 
Posts: 29
Joined: Fri May 03, 2019 09:08
Location: Corinth, Greece
GitHub: nyje
IRC: Nigel
In-game: Nigel

Re: [Mod] Symmetool Mirror - Build helper [v1.5][symmetool]

by Nigel » Tue Nov 26, 2019 10:40

@rubenwardy: thanks. I did not have plans to add survival mode, but have now done so.

@CalebJ: Thanks a lot for the kind words...

@texmex: I assumed he did ;-)

@all: NEW VERSION AVAILABLE - v1.5

The mod should now work in Survival or Creative mode.
see the1st post for github link, or grab it from ContentDB.

Happy Building ;-)
My Published Mods: Visual Bots | Symmetool Mirror
 

User avatar
Nigel
Member
 
Posts: 29
Joined: Fri May 03, 2019 09:08
Location: Corinth, Greece
GitHub: nyje
IRC: Nigel
In-game: Nigel

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by Nigel » Tue Nov 26, 2019 13:32

New release v1.6

  • Improved handling of resources in survival mode
  • further checks to respect protection; all operations will succeed in protected areas, but nothing will be dug or placed.
  • code refactoring in main functions to squash those pesky bugs.

Please refer to the 1st post for download options.

I am now not aware of any outstanding bugs in the mod, so please, if you find any problems with the code, go here to report them.

If you have any suggestions, comments or feature requests, feel free to post them here.

Happy Building ;-)
My Published Mods: Visual Bots | Symmetool Mirror
 

User avatar
texmex
Member
 
Posts: 1616
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by texmex » Tue Nov 26, 2019 14:40

As a simplification, would it be possible to have a placement of the symmetry node as the only requirement for mirroring? What I mean is that, technically, if a node is placed within a radius of the center symmetry node then it is automatically mirrored in the directions , without the need to also wield it at all. Modes can be toggled on the center node directly.
 

User avatar
Codesound
Member
 
Posts: 231
Joined: Thu Jun 09, 2016 14:56
 

User avatar
Nigel
Member
 
Posts: 29
Joined: Fri May 03, 2019 09:08
Location: Corinth, Greece
GitHub: nyje
IRC: Nigel
In-game: Nigel

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by Nigel » Tue Nov 26, 2019 16:35

@codesound: thanks for the complementary remarks.As to the video, I was just worried people wouldn't understand what on earth this mod was for from my bad descriptions ;-)

@texmex: possible? yes of course... anything is possible ;-) However I'm unlikely to go that way unless someone gives me a brilliant & efficient method to do so...

All the ways I could think of doing it without a handler tool ended up way too inefficient, as I would basically have to watch the on_place of EVERY node (messy) or use a global callback or timer to keep an eye on the whole area for new blocks (inefficient).

Hence we have the placer tool (which was inspired by the build helpers on the fantastic 'Inside the Box' server by Nore and Sofar).

I am of course open to any ideas anyone may have as to how it could be done, as it would be nice, and simpler. You are of course welcome to try to get it to work yourself ;o)
Last edited by Nigel on Tue Nov 26, 2019 20:15, edited 1 time in total.
My Published Mods: Visual Bots | Symmetool Mirror
 

BuckarooBanzay
Member
 
Posts: 319
Joined: Tue Apr 24, 2018 05:58
Location: Switzerland
GitHub: thomasrudin-mt
In-game: BuckarooBanzai

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by BuckarooBanzay » Tue Nov 26, 2019 17:47

Nigel wrote:All the ways I could think of doing it without a handler tool ended up way too inefficient, as I would basically have to watch the on_place of EVERY node (messy) or use a global callback or timer to keep an eye on the whole area for new blocks (inefficient).


There is
Code: Select all
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing))


Reference: https://github.com/minetest/minetest/bl ... .txt#L4094

It is not recommended to use it, but it fits the exact use case... ¯\_(ツ)_/¯
 

User avatar
texmex
Member
 
Posts: 1616
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

User avatar
rubenwardy
Moderator
 
Posts: 5886
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by rubenwardy » Tue Nov 26, 2019 18:44

It's better to use register_on_placenode if you want to be alerted to the placement of any node. The bigger problem is finding whether the node is placed in a symmetric region, but I'd avoid premature optimisation and just do a simple node search to begin with
 

User avatar
texmex
Member
 
Posts: 1616
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by texmex » Tue Nov 26, 2019 19:14

How about storing the position of symmetry nodes is mod storage as soon as they’re placed? By doing so the first step in the added register_on_placenode logic would cost near nothing (checking for the existance of any placed symmetry node at all). If there’s a known node’s pos stored, then check whether the newly placed normal node is in range of a symmetry node. If so, mirror it.

But yes, rubenwardy’s idea is a good first step!
 

User avatar
rubenwardy
Moderator
 
Posts: 5886
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by rubenwardy » Tue Nov 26, 2019 19:17

texmex wrote:How about storing the position of symmetry nodes is mod storage as soon as they’re placed?


On large servers, this could cause a large linear search. And it's a pain to keep updated. It's worth doing something simple and using the profiler to check the mod's performance impact.

get_node is slow mostly because of the time it takes to go between C++ and Lua. Using a single function like get_node_near or get_node_in_area will not have this issue
 

User avatar
Nigel
Member
 
Posts: 29
Joined: Fri May 03, 2019 09:08
Location: Corinth, Greece
GitHub: nyje
IRC: Nigel
In-game: Nigel

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by Nigel » Tue Nov 26, 2019 20:08

@BuckarooBanzay:
indeed, it's the perfect use case, but as rubenwardy notes, on a server even an N style problem gets slow, fast. But you know that and I'm sure there was a /s missing from your comment ;-) Oh no, wait, nothing was missing ;-)

@rubenwardy & @texmex
Indeed, I had considered most of these points, but BOY, thanks for the input. I was gonna have a limited set of 'symmetricable' nodes in a lookup table or tree, but thought better of it in the end, and decided the open endedness and speed (excepting my poor quality code) of the tool based solution was the best bet.. especially considering the HUGE number of registered nodes on my current live server, I didn't want to slow down building operations in general for a specific use tool.

As an aside, we just had several players building with it simultaneously on ADVENTURETIME with no issue at all, and my VPS is rather under-powered right now due to lack of funds...

@rubenwardy:
I get the hint, and I agree, the code needs much optimization at this point, It was a proof of concept. I can reduce MANY of the expensive calls or remove them altogether. Thanks for the input, your code and your explanations in the modding book has been a big part how I could make this mod in the first place ;-)
My Published Mods: Visual Bots | Symmetool Mirror
 


Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 3 guests