[Server] Xanadu

auouymous
Member
Posts: 195
Joined: Sun Dec 07, 2014 09:39
GitHub: auouymous
IRC: air
In-game: auouymous

Re: Xanadu Server

by auouymous » Post

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. ;)

User avatar
Kilarin
Member
Posts: 894
Joined: Mon Mar 10, 2014 00:36
GitHub: Kilarin

Re: Xanadu Server

by Kilarin » Post

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!

auouymous
Member
Posts: 195
Joined: Sun Dec 07, 2014 09:39
GitHub: auouymous
IRC: air
In-game: auouymous

Re: Xanadu Server

by auouymous » Post

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...

User avatar
Kilarin
Member
Posts: 894
Joined: Mon Mar 10, 2014 00:36
GitHub: Kilarin

Re: Xanadu Server

by Kilarin » Post

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.

auouymous
Member
Posts: 195
Joined: Sun Dec 07, 2014 09:39
GitHub: auouymous
IRC: air
In-game: auouymous

Re: Xanadu Server

by auouymous » Post

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.

User avatar
firefox
Member
Posts: 1709
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox
Location: Xanadu

Re: Xanadu Server

by firefox » Post

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?
✨🏳️‍🌈♣️✨

auouymous
Member
Posts: 195
Joined: Sun Dec 07, 2014 09:39
GitHub: auouymous
IRC: air
In-game: auouymous

Re: Xanadu Server

by auouymous » Post

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.

User avatar
IceAgeComing
Member
Posts: 123
Joined: Sat May 17, 2014 21:19

Re: Xanadu Server

by IceAgeComing » Post

Image

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

neri2
Member
Posts: 28
Joined: Thu May 21, 2015 12:36

Re: Xanadu Server

by neri2 » Post

Gee! And I thought booneh was the wrong crowd to hang wiff chu got us beat there iceypop xD

auouymous
Member
Posts: 195
Joined: Sun Dec 07, 2014 09:39
GitHub: auouymous
IRC: air
In-game: auouymous

Re: Xanadu Server

by auouymous » Post

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.

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Xanadu Server

by Hybrid Dog » Post

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

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
IceAgeComing
Member
Posts: 123
Joined: Sat May 17, 2014 21:19

Re: Xanadu Server

by IceAgeComing » Post

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!

User avatar
firefox
Member
Posts: 1709
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox
Location: Xanadu

Re: Xanadu Server

by firefox » Post

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
✨🏳️‍🌈♣️✨

auouymous
Member
Posts: 195
Joined: Sun Dec 07, 2014 09:39
GitHub: auouymous
IRC: air
In-game: auouymous

Re: Xanadu Server

by auouymous » Post

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?

User avatar
Kilarin
Member
Posts: 894
Joined: Mon Mar 10, 2014 00:36
GitHub: Kilarin

Re: Xanadu Server

by Kilarin » Post

would it be good to move this discussion to the protector thread?
viewtopic.php?f=11&t=9376&start=100

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

by Hybrid Dog » Post

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

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: Xanadu Server

by TenPlus1 » Post

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 :)

User avatar
maikerumine
Member
Posts: 1420
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: Xanadu Server

by maikerumine » Post

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
Talamh Survival Minetest-->viewtopic.php?f=10&t=12959

User avatar
Kilarin
Member
Posts: 894
Joined: Mon Mar 10, 2014 00:36
GitHub: Kilarin

Re: Xanadu Server

by Kilarin » Post

but you are going to be using 4.14 with the new mapgen, right?

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: Xanadu Server

by TenPlus1 » Post

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 :)

User avatar
firefox
Member
Posts: 1709
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox
Location: Xanadu

Re: Xanadu Server

by firefox » Post

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
✨🏳️‍🌈♣️✨

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Xanadu Server

by Hybrid Dog » Post

seed 0

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
firefox
Member
Posts: 1709
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox
Location: Xanadu

Re: Xanadu Server

by firefox » Post

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.
✨🏳️‍🌈♣️✨

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

Re: Xanadu Server

by twoelk » Post

firefox wrote:i tried some seeds and here are the results:
...
seems you missed Xanadu and Minetest as seeds ;-P

myster
Member
Posts: 61
Joined: Tue Jun 30, 2015 14:34
In-game: myster
Location: In And Out Of Heaven

Re: Xanadu Server

by myster » Post

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?
In the name of Justice! -- Mr. mystery :)

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot] and 22 guests