Render entity from unlimited distance

User avatar
ratmix
Member
 
Posts: 162
Joined: Mon May 01, 2017 19:45
In-game: ratmix

Render entity from unlimited distance

by ratmix » Sun Mar 10, 2019 19:04

I have a problem with max draw distance for entities set by active_block_range and active_object_send_range_blocks.

I need a large entity (a wall) to be visible from up to 2000 blocks away. I would need to set active_block_range to 125 (125x16 = 2000 blocks) to ensure players would see the entity. This would likely kill the server (and client). (It looks like active_block_range max is 400 blocks) What I'm looking for is a way to send a specific entity to the client which is located at an unlimited distance from their player. Is this at all possible?

Image for context (Thanks to Sires for the idea)...
Image
Last edited by ratmix on Fri Mar 15, 2019 20:17, edited 1 time in total.
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site
 

User avatar
sorcerykid
Member
 
Posts: 1001
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: Render entity from unlimited distance

by sorcerykid » Mon Mar 11, 2019 17:28

To my knowledge, this is currently impossible because activation and deactivation of SAOs are managed entirely on the CPP side. Is there a reason this entity has to be visible from so far away? Even if there was a workaround (like hacking the ServerEnvironment::deactivateFarObjects() function), there are likely to be unanticipated side effects since SAOs are supposed to be removed when active blocks are deactivated.

Edit: It just occurred to me that perhaps you mean that you want the wall to be visible from any lateral distance, not from 2000 meters in front of the player. If that's the case then why not just create 16x16 entities and tile them along the XY or ZY plane? That would still provide the illusion of what you want, and probably better rendering performance.

On a sidenote, I believe somebody mentioned on #minetest-hub a few weeks ago about "pre-rendering" scenes via custom skyboxes. That might be another way to accomplish what you want (altho I don't know if it was just a proposal, or if the method is already supported).
 

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

Re: Render entity from unlimited distance

by texmex » Mon Mar 11, 2019 18:42

IIRC correctly then player entities have no limit of how far away they will render. Thus the ugly hack would be to somehow render a boxy player wher the wall should be xD
 

User avatar
ratmix
Member
 
Posts: 162
Joined: Mon May 01, 2017 19:45
In-game: ratmix

Re: Render entity from unlimited distance

by ratmix » Mon Mar 11, 2019 19:46

sorcerykid wrote:perhaps you mean that you want the wall to be visible from any lateral distance, not from 2000 meters in front of the player


Thanks for the reply. That's correct, I just need the player to see the wall if they are within about 150 blocks adjacent to and within 2000 blocks laterally of the wall entity position. Tiling will create overlaps thereby reducing opacity (which I need)...
Image
In addition, I need to move 6 walls every second so tiling would create a lot of demand on the server. Just trying to keep lag to a bare minimum.

texmex wrote:IIRC correctly then player entities have no limit of how far away they will render. Thus the ugly hack would be to somehow render a boxy player where the wall should be xD


You might be on to something.
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site
 

User avatar
sorcerykid
Member
 
Posts: 1001
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: Render entity from unlimited distance

by sorcerykid » Mon Mar 11, 2019 20:17

Out of curiosity, why are translucent nodes out of the question? It seems that you are trying to adapt an entity to behave in every respect like a wall of nodes, but I'm not sure why.
 

User avatar
ratmix
Member
 
Posts: 162
Joined: Mon May 01, 2017 19:45
In-game: ratmix

Re: Render entity from unlimited distance

by ratmix » Mon Mar 11, 2019 22:00

A wall of nodes means I need to remove and add up to 96 million nodes every second (4000x4000x6walls). Plus, with nodes you will not have a moving animation. I have tried using a node with a really large mesh, but the max render distance is still low, plus the player look direction effects the node's visibility.
Last edited by ratmix on Fri Mar 15, 2019 04:06, edited 1 time in total.
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site
 

User avatar
sorcerykid
Member
 
Posts: 1001
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: Render entity from unlimited distance

by sorcerykid » Tue Mar 12, 2019 00:39

Ah, I didn't realize you needed animations too. In that case it sounds like what you trying to accomplish is well beyond the scope of what Minetest is designed to do. All the potential workarounds seem to have been exhausted. Realistically, this is something that would probably necessitate a fairly sophisticated engine change (both client and server).
 

Skulls
Member
 
Posts: 109
Joined: Thu Dec 21, 2017 17:41
In-game: Skulls

Re: Render entity from unlimited distance

by Skulls » Tue Mar 12, 2019 03:28

If this is only for single player you may try attaching a huge (but low poly) object to the player so the "wall" follows the player around like a gloomy storm cloud.
 

User avatar
ratmix
Member
 
Posts: 162
Joined: Mon May 01, 2017 19:45
In-game: ratmix

Re: Render entity from unlimited distance

by ratmix » Tue Mar 12, 2019 04:01

sorcerykid wrote:what you trying to accomplish is well beyond the scope of what Minetest is designed to do

I know, but I can't give up. Any idea how I might implement texmex's suggestion about spoofing a player entity to achieve this? When you press 'z' to zoom, the player appears first, before the map blocks load. This is likely because the client already has the player loaded, so I think he has a viable idea.

Skulls wrote:you may try attaching a huge (but low poly) object to the player so the "wall" follows the player

Thanks for the idea, but the wall position must remain relative to the world.
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site
 

User avatar
sorcerykid
Member
 
Posts: 1001
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: Render entity from unlimited distance

by sorcerykid » Wed Mar 13, 2019 21:55

ratmix wrote:I know, but I can't give up. Any idea how I might implement texmex's suggestion about spoofing a player entity to achieve this? When you press 'z' to zoom, the player appears first, before the map blocks load. This is likely because the client already has the player loaded, so I think he has a viable idea.


Unfortunately, not without changes to the engine. If this is intended to be a mod, then that means distributing a CPP patch alongside the mod. Personally, I don't see engineering a fake PlayerSAO as a particularly elegant workaround if the purpose is just to show a wall. Also I question whether it's true that players are always rendered at any distance. I think that's an option in minetest.conf. Just some thoughts.
 

User avatar
ratmix
Member
 
Posts: 162
Joined: Mon May 01, 2017 19:45
In-game: ratmix

Re: Render entity from unlimited distance

by ratmix » Wed Mar 13, 2019 22:02

Thanks sorcerykid. I did a bit of searching and found that both AI Alive and Pipeworks use is_player = function() return true end or equivalent to spoof a player object. Testing with that now. I think minetest.conf specifies the visible distance for a player name tag, not the player.

Having a moving wall/boundary is key to being able to produce certain MT games, that is why I am so persistent.
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site
 

User avatar
ratmix
Member
 
Posts: 162
Joined: Mon May 01, 2017 19:45
In-game: ratmix

Re: Render entity from unlimited distance

by ratmix » Thu Mar 14, 2019 08:04

Well... you were right. The spoofed players are only visible up to the same range as normal entities, so that won't work.

On the other hand, real a player can be seen from far away. Changing a player's model to my wall produces this...
Image
So if I can just find a way to send specific objects to clients, rendered as players, I would have a solution.
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site
 

User avatar
sorcerykid
Member
 
Posts: 1001
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: Render entity from unlimited distance

by sorcerykid » Fri Mar 15, 2019 06:05

You'll probably want to look at the network packet handler, since all state changes to SAOs are sent as ActiveObject Messages iirc. I can't remember if that only applies to LuaEntitySAOs or if PlayersSAOs are handled the same way. Either nerzhul or Krock would have better insight on those technical distinctions, so you might try pinging them on IRC.

On a related note, I believe the client is agnostic when it comes to entities vs. players (they are combined as ContentSAOs), so more than likely you're main concern is just tweaking the active object management routines in the server-side environment). You might even consider devising a specialized ContentSAO class, thereby bypassing a lot of the overhead associated with LuaEntitySAOs esp. if you don't need scripting hooks and the like.
 

User avatar
ratmix
Member
 
Posts: 162
Joined: Mon May 01, 2017 19:45
In-game: ratmix

Re: Render entity from unlimited distance

by ratmix » Fri Mar 15, 2019 07:43

Thank you again. That should be very helpful. We made a Github issue and referenced this topic here:
https://github.com/minetest/minetest/issues/8381

Unfortunately my C++(ability) = nil
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site
 

User avatar
Hybrid Dog
Member
 
Posts: 2720
Joined: Thu Nov 01, 2012 12:46

Re: Render entity from unlimited distance

by Hybrid Dog » Fri Mar 15, 2019 13:22

Have you tried to set a visual entity distance while the entity and the player are in the same position yet?

For example, you could create an object with giant mesh model. It consists of a giant rectangle in the y,x plane. The y and x sizes of this rectangle are so large that they cover the whole world and the rectangle is offset by z=1. If you then place this object at the player's position, he/she sees the wall one node in front of him/her. By increasing the visual_size (https://github.com/minetest/minetest/bl ... .txt#L5576), the distance from the rectangle to the player can be increased. While the actual entity position is still the player's position, you can arbitrarily set the distance between the visible rectangle and the player/entity position.
If multiple players stand next to each others, their rectangles may overlap, but they are still at the same distance.

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

User avatar
Linuxdirk
Member
 
Posts: 1871
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Render entity from unlimited distance

by Linuxdirk » Fri Mar 15, 2019 13:54

I've seen the Github issue. What you describe would be awesome if it was an API function for the word border so mods can simply specify the size, movement, effects, outside-border-penalty, etc. like in Minecrafts world border functionality.
 

User avatar
ratmix
Member
 
Posts: 162
Joined: Mon May 01, 2017 19:45
In-game: ratmix

Re: Render entity from unlimited distance

by ratmix » Fri Mar 15, 2019 18:45

Linuxdirk wrote:would be awesome if it was an API function

An API is exactly what it needs. I plan to make a moving boundary mod once I have a visible boundary.

Hybrid Dog wrote:Have you tried to set a visual entity distance while the entity and the player are in the same position yet?


I tried this and, while the boundary was visible from a greater distance, the player needs to look almost directly at the entity for the wall to appear. A view angle of 20 degrees away causes the wall to disappear. In addition, rendering is glitchy and flashes a lot from a distance.

I did some more testing this morning and found that the only way to reliably visualize the wall from an large distance was to use my wall.obj file model as a player's model. I could see the wall from a great distance away from the player, with no flashes. Even active_object_send_range_blocks = 200 (3200 blocks) only worked up to 400 blocks away, after that the wall disappears.

The fact that the engine can currently produce the proper effect, via a player model, means that making this work with entities is not impractical. However, it can't be accomplished by changing active_object_send_range_blocks.
Last edited by ratmix on Sat Mar 16, 2019 04:18, edited 2 times in total.
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site
 

User avatar
Linuxdirk
Member
 
Posts: 1871
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Render entity from unlimited distance

by Linuxdirk » Fri Mar 15, 2019 23:49

ratmix wrote:
Linuxdirk wrote:would be awesome if it was an API function

An API is exactly what it needs. I plan to make a moving boundary mod once I have a visible boundary.

Looking forward to this since it would allow some great games. It should definitely be an engine feature and not a mod.

This is what you can do in Minecraft: https://youtu.be/21B9ig4eKBk?t=81
 

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

Re: Render entity from unlimited distance

by texmex » Sat Mar 16, 2019 03:33

I tried this and, while the boundary was visible from a greater distance, the player needs to look almost directly at the entity for the wall to appear. A view angle of 20 degrees away causes the wall to disappear. In addition, rendering is glitchy and flashes a lot from a distance.

Imo this should also be adressed because it’s a bug that also causes problems in other mods as well such as WorldEdit.
 

User avatar
ratmix
Member
 
Posts: 162
Joined: Mon May 01, 2017 19:45
In-game: ratmix

Re: Render entity from unlimited distance

by ratmix » Sat Mar 16, 2019 22:10

Linuxdirk wrote:This is what you can do in Minecraft: https://youtu.be/21B9ig4eKBk?t=81

Nice. An expanding boundary could be used for some interesting games too.
King of the Hill :: Modern Warfare Server RATMIX.COM:30000 | King of the Hill Community Site
 

User avatar
Linuxdirk
Member
 
Posts: 1871
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Render entity from unlimited distance

by Linuxdirk » Sun Mar 17, 2019 03:51

ratmix wrote:
Linuxdirk wrote:This is what you can do in Minecraft: https://youtu.be/21B9ig4eKBk?t=81

Nice. An expanding boundary could be used for some interesting games too.

Yes, it is pretty awesome and fully integrated into the engine. All chat commands can be used in command blocks (you can pretty much achieve everything except adding new content using command blocks) allowing some very cool games.

A couple of years ago I played a map where the border was very small and for some actions (crafting something special, collecting some stuff, slay mobs, etc.) the border expanded a little bit ending up with a 16x16 large space where all the action happened. All of this was only made by using command blocks and built-in commands. No mods, no nothing. Just some Redstone trickery.

The more I think of this the more I more I wish Minetest had an API for controlling the world border (move, add action for what happens when players are outside, “move outside” buffer, moving the border – all the stuff shown in the video).
 

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

Re: Render entity from unlimited distance

by texmex » Sun Mar 17, 2019 10:04

If this were to be implemented, why not support multiple border boxea while at it?
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 2 guests