Jump to content
tjheldna

Zones and portals

Recommended Posts

From what I have seen, I think you guys are going to degrade your performance by trying to hack on an extra culling system.

Share this post


Link to post

We are playing around with the view range and that might be the ticket, but we plan on having a fairly large town (we have some ways to repeat some geometry but still make it seem unique). So having all the thousands of entities that the interiors require to be loaded at once will be a test that we try to see how much memory is taken up and how the editor responds. This is a constant learning process on tweaking things to meet our game requirements. We are getting there.

Share this post


Link to post

This works pretty well, just need one parse in the start() (saves you from setting viewrange manually)

 

    --optimize scene place objects in viewrange based on their aabb radius.

for i=0,world:CountEntities()-1 do

if world:GetEntity(i):GetClass()==Object.ModelClass then

local aabb=world:GetEntity(i):GetAABB(Entity.GlobalAABB)

if aabb and aabb.radius < .1 then world:GetEntity(i):SetViewRange(0)

elseif aabb and aabb.radius < 1 then world:GetEntity(i):SetViewRange(1)

elseif aabb and aabb.radius < 10 then world:GetEntity(i):SetViewRange(2)

elseif aabb and aabb.radius < 20 then world:GetEntity(i):SetViewRange(3)

else world:GetEntity(i):SetViewRange(4) end

end

end

Share this post


Link to post

As we're finding out with this much detail we need to set the view range in the editor or the editor gives us issues and crashes. I assume setting in code at run-time doesn't hold over to design time.

Share this post


Link to post

I see. The thing is we have to set the models view range manually when we place them (have to check if that field holds through prefabs) or else the editor will choke out and crash given the number of things we have when we are designing our town. Design time is more of an issue for us than run-time at this point since we are pointing the camera all over the place to move around freely. Since our camera is a top/down camera at run-time there isn't much visible by the camera, at one time anyway, and the FPS is fairly good when this is the case.

 

The dynamic loading/unloading process at run-time we do is more about memory/entity count management than anything else.

Share this post


Link to post
The thing is we have to set the models view range manually when we place them (have to check if that field holds through prefabs) or else the editor will choke out and crash given the number of things we have when we are designing our town

 

This could be an interesting suggestion topic : Optionnal View range field in model properties on the editor rolleyes.gif

 

 

--optimize scene place objects in viewrange based on their aabb radius.

for i=0,world:CountEntities()-1 do

if world:GetEntity(i):GetClass()==Object.ModelClass then

local aabb=world:GetEntity(i):GetAABB(Entity.GlobalAABB)

if aabb and aabb.radius < .1 then world:GetEntity(i):SetViewRange(0)

elseif aabb and aabb.radius < 1 then world:GetEntity(i):SetViewRange(1)

elseif aabb and aabb.radius < 10 then world:GetEntity(i):SetViewRange(2)

elseif aabb and aabb.radius < 20 then world:GetEntity(i):SetViewRange(3)

else world:GetEntity(i):SetViewRange(4) end

end

end

 

Thanks for the tip.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...