Jump to content

Zones and portals


tjheldna
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Stop toying and make games

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

 Share

×
×
  • Create New...