Page 63 of 144

Re: Xanadu Server

PostPosted: Sun Mar 20, 2016 03:51
by auouymous
Kilarin wrote:I had suggested different sized protectors once before, and Ten pointed out to me that it would slow down the mod. Currently the protector mod must check to see if a node is within a standard preset distance (10 in this case) of any existing protector. If we add, say, one small protector with a radius of 3, then we now have to have TWO lists of protectors, and do TWO checks to see if the node is within a distance of 3 from a protector on the small list, and if not, THEN we have to check if it is within a distance of 10 from a large protector. thereby doubling the number of checks required for every interaction with a node on the server.


That's not entirely true. The code must check 9261 blocks for radius 10 but only 343 blocks for radius 3. If the code were to perform the radius 3 test first and found a small or large protector, it would eliminate the need to perform the more costly radius 10 test. If no protector is found in the radius 3 test it would only increase the work by 4%, no where near double. A radius 5 protector would check 1331 blocks and adding a radius 3 check on top of that would be a 26% increase in work, still not double but enough to be noticable. But with radius 10 protectors the radius 3 protector adds almost nothing and has the potential to boost performance.

A player digging in the wild would cause both checks to happen. A player building a road with small protectors would only cause the much faster radius 3 checks. A player building inside their radius 10 protected base would cause both checks unless within 3 blocks from the protector. So in most cases both checks would happen. But any action that only triggers the radius 3 check would be 27 times faster!

The new radius 10 checks are 7 times slower than the old radius 5 checks. In the worst case, adding on a second radius 3 check would only make it a measly 7.2 times slower. ;)

Re: Xanadu Server

PostPosted: Sun Mar 20, 2016 04:00
by Kilarin
auouymous wrote:The new radius 10 checks are 7 times slower than the old radius 5 checks. In the worst case, adding on a second radius 3 check would only make it a measly 7.2 times slower. ;)

Well, that analysis sounds very promising!

Re: Xanadu Server

PostPosted: Sun Mar 20, 2016 04:06
by auouymous
Kilarin wrote:Well, that analysis sounds very promising!


The new map being 7 times slower (with or without radius 3 protectors) doesn't sound promising...

Re: Xanadu Server

PostPosted: Sun Mar 20, 2016 04:39
by Kilarin
I must have misunderstood how the protector mod worked. I assumed there was a list/database of protectors which was searched for protectors near to a node. I guess I need to pull the code and dig through it sometime.

Re: Xanadu Server

PostPosted: Sun Mar 20, 2016 06:04
by auouymous
Kilarin wrote:I must have misunderstood how the protector mod worked. I assumed there was a list/database of protectors which was searched for protectors near to a node. I guess I need to pull the code and dig through it sometime.


Storing all loaded protectors in an octree would probably be faster than checking 9200 blocks, but it would require a little bit of memory and some overhead when loading and unloading areas. Each action would result in 1-20 lookups into the octree and return 0-8 lists of protectors in a 32x32x32 area around the target block. The code then iterates the lists and checks if each protector is in range of the block, based on the given protector's radius.

In the wild, the check would abort before doing 13 lookups and nothing else would need to be done. When near any protectors, it would do all 20 lookups and then iterate over what it found.

This assumes a -32k to +32k world, for worlds with -65k to +65k (max size of minetest worlds) it requires one additional lookup.

--

A flat list of protectors would also use memory (but not as much as an octree, whch isn't much more) and also have overhead when loading and unloading areas. Every action would need to iterate over the entire list (only once, no matter how many sizes of protectors) and do the same range check as the octree would do, but the octree only does the range check for the blocks in the 32x32x32 area around the target block, the flat list does it for all blocks in the list. If only a few protectors were visible by all players then a flat list would be faster than an octree. But the octree becomes much faster once the number of visible protectors increases.

Re: Xanadu Server

PostPosted: Sun Mar 20, 2016 18:01
by firefox
auouymous wrote:A flat list of protectors would also use memory (but not as much as an octree, whch isn't much more) and also have overhead when loading and unloading areas. Every action would need to iterate over the entire list (only once, no matter how many sizes of protectors) and do the same range check as the octree would do, but the octree only does the range check for the blocks in the 32x32x32 area around the target block, the flat list does it for all blocks in the list. If only a few protectors were visible by all players then a flat list would be faster than an octree. But the octree becomes much faster once the number of visible protectors increases.

ist it possible to use both methods?
so that the large protectors (where there should be less visible pieces around) use the old method,
and the small protectors (where there would be many) use the faster octree method.
or does that create conflicts when both protector types are used in one area?

Re: Xanadu Server

PostPosted: Sun Mar 20, 2016 23:26
by auouymous
firefox wrote:ist it possible to use both methods?
so that the large protectors (where there should be less visible pieces around) use the old method,
and the small protectors (where there would be many) use the faster octree method.
or does that create conflicts when both protector types are used in one area?


The octree has the same overhead if used for one or both. The old (current) method gets magnitudes slower with each increase of the protector radius. If the overhead for octree is acceptable, it should be used for all protector sizes, the whole point of the octree is to speed up the very slow radius 10 checks.

A 64bit server with 32 players each in a different area and each player able to see 1000 protectors in their area would require about 3MB of memory on the server.

Re: Xanadu Server

PostPosted: Mon Mar 21, 2016 18:02
by IceAgeComing
Image

Made some new friends today. :D
And yes, they were naturally spawned.

Re: Xanadu Server

PostPosted: Tue Mar 22, 2016 02:25
by neri2
Gee! And I thought booneh was the wrong crowd to hang wiff chu got us beat there iceypop xD

Re: Xanadu Server

PostPosted: Tue Mar 22, 2016 02:46
by auouymous
It appears that minetest might not have the ability to notify the mod when a node is loaded into memory. This means the octree can't be done. :(

I added large and small protectors to the mod at http://mt.qzx.com/protector/ and did some benchmarks. But the optimization of scanning radius 3 first and then only scanning radius 10 if no radius 3 protectors where found can't be done because a radius 10 might prohibit the player even though the radius 3 allowed it.

These are average times on my machine in microseconds for comparison purposes only. "Old" is the current mod on Xanadu with only one size protector, "new" is the mod with large and small protectors.

Small radius 3 protectors don't matter when digging, placing or accessing nodes, only the size of the largest protector.

- dig/place/access with radius 5: old=80 new=90
- dig/place/access with radius 10: old=450 new=500

So having small and large protectors will be about 11% slower.

- placing a small radius 3 protector: new=1000
- placing a radius 5 protector: old=450
- placing a radius 10 protector: old=3100 new=3100

Placing a large protector on either mod is same speed, about 7 times slower than placing a radius 5 protector on current Xanadu map. But placing the small protector would only be 2 times slower. Good reason to make large protectors cost more to craft, if implemented.

If wanted, just drop the two files into the current mod and maybe add new textures for small protectors.

Re: Xanadu Server

PostPosted: Tue Mar 22, 2016 11:08
by Hybrid Dog
you could cache the protector node positions

you need to add them when they are loaded first and add / remove them if the node is added / removed
then you can use a function looking big but working fast to search for protectors
the set, remove and get functions are from vector_extras
you can e.g. set the name and range in a table to a specific position, you can store the range and name in meta, put them from there into the cache table when caching it and change the big function to test the range and player
but if you use the names as index, you can skip the protection blocks of the player when searching
you should set a maximum range because protecting only works if the node has been loaded yet after the server start

Re: Xanadu Server

PostPosted: Tue Mar 22, 2016 14:26
by IceAgeComing
neri2 wrote:Gee! And I thought booneh was the wrong crowd to hang wiff chu got us beat there iceypop xD


At least theres just 1 bonny!

Re: Xanadu Server

PostPosted: Tue Mar 22, 2016 15:06
by firefox
Hybrid Dog wrote:you could cache the protector node positions

you need to add them when they are loaded first and add / remove them if the node is added / removed
then you can use a function looking big but working fast to search for protectors
the set, remove and get functions are from vector_extras
you can e.g. set the name and range in a table to a specific position, you can store the range and name in meta, put them from there into the cache table when caching it and change the big function to test the range and player
but if you use the names as index, you can skip the protection blocks of the player when searching
you should set a maximum range because protecting only works if the node has been loaded yet after the server start

i have no idea what this means, but it sounds great :P
(was this tested already or is it just a theory?
i imagine the "skip checking your own protectors" thing to be very handy for building.)

IceAgeComing wrote:At least theres just 1 bonny!

but not for long ...
we just need a cupcake and a cloning machine. i guess you know how this works =(^.^)=
:P

Re: Xanadu Server

PostPosted: Tue Mar 22, 2016 19:09
by auouymous
Hybrid Dog wrote:you could cache the protector node positions


I was aware of LBMs, on_construct and on_destruct, but what about removing the protectors from the cache/octree when the mapblock is unloaded?

Re: Xanadu Server

PostPosted: Tue Mar 22, 2016 23:43
by Kilarin
would it be good to move this discussion to the protector thread?
https://forum.minetest.net/viewtopic.php?f=11&t=9376&start=100

PostPosted: Wed Mar 23, 2016 10:38
by Hybrid Dog
auouymous, removing it when the chunk gets unloaded might add a security risk
l tried to write the code:
https://gist.github.com/HybridDog/e1145141ca4b1c012a87

idk if moving the discussion to that thread is good, protector changes have a direct impact on players and they are the ones who have the most experience with using them

Re: Xanadu Server

PostPosted: Wed Mar 23, 2016 21:13
by TenPlus1
YOU CHOOSE THE WORLD SEED:

Grab your Minetest with Ethereal installed and active and submit your requests for the new seed on Xanadu when the server is reset :)

Re: Xanadu Server

PostPosted: Thu Mar 24, 2016 01:12
by maikerumine
TenPlus1 wrote:YOU CHOOSE THE WORLD SEED:

Grab your Minetest with Ethereal installed and active and submit your requests for the new seed on Xanadu when the server is reset :)


this is my personal fav:
2473794698767688778

Re: Xanadu Server

PostPosted: Thu Mar 24, 2016 01:41
by Kilarin
but you are going to be using 4.14 with the new mapgen, right?

Re: Xanadu Server

PostPosted: Thu Mar 24, 2016 08:19
by TenPlus1
The new mapgen blends biomes that little bit better although the general biome layout and caves are still seed specific... Test on latest 0.4.13 daily build to make sure it looks same though :)

Re: Xanadu Server

PostPosted: Thu Mar 24, 2016 09:46
by firefox
i will try my best, nya~

also is there a specific date for the map change?
on the last day of the old map i want to throw all my gold and gems into the spawn to make everyone happy
and then troll them when everything gets reset :P

Re: Xanadu Server

PostPosted: Thu Mar 24, 2016 10:44
by Hybrid Dog
seed 0

Re: Xanadu Server

PostPosted: Thu Mar 24, 2016 10:54
by firefox
i tried some seeds and here are the results:
(i teleported to 0,0,0 and explored the surroundings)

TenPlus1
similar to noob area

Shinji_Ikari
green mountain in the middle of the dry lands

bonny
ocean surrounded by bizarre mountain islands

IceAgeComing
big ocean with desert on one side and pine forests at the other side

Red_Fox
big mountain island, made of desert stone and snowy biomes, green land further away

Phiwari123
mostly scorched plains and savanna, mushrooms and green stuff on a high mountain

iska
similar to bonny but with less islands

nya~ =(^.^)=
funny terrain with high cliffs and plateaus, but mostly dry biomes with very few green stuff

Kelena
totally messed up mounatin made of clay and snow and full of deadly pitfalls
(sorry Kel-chan ... =(-.-)= )


the bonny map has the most biome diversity of this selection.

Re: Xanadu Server

PostPosted: Thu Mar 24, 2016 16:24
by twoelk
firefox wrote:i tried some seeds and here are the results:
...

seems you missed Xanadu and Minetest as seeds ;-P

Re: Xanadu Server

PostPosted: Thu Mar 24, 2016 18:58
by myster
What would the optimal map be? We can be searching for it. Something similar to the current map? Or, would spawn be better on top of a mountain?