Open World - City - Efficient loading

Hello,

We are looking to create an open world that would have the following characteristics:

  • It is massive but has a finite size.
  • It is composed of one entity road and one entity house that are repeated until the end of the map.
  • Each house entity on the map will have a few of its child entity being switched on and off to make them look slightly different.

We have tried the following things:

  1. Duplicating the house and road entity X and Y time in the editor directly to fill the map as we want.

The advantage is that it allows us to arrange each houses the way we want and to have an exact and total view of the open world. The first problem is that it is a pain to duplicate each entity manually and position them exactly one by one. The second problem, that is a bigger concern for us, is that the more house we have on the map, the slower it gets in game. What we find weird is that even though not all the houses are rendered - we can see them fading away as we walk away from them - it still gets extremely slow when we increase the number of houses on the map.

  1. Having a subset of the houses and roads of the map (created in the editor) with a representation of the map coded to move the entities around as the user move on the map.

The idea is to have a pool of houses and roads that we move when the user move. ie: if the user move from 0x to 50x, the house located at -50x is moved at 100x. To put it in words, as the user move, the farthest house away from the direction where the user is going to is moved to expand the map in the direction where the user is going to.
The advantage is that it has absolutely no slowness because we control the number of houses active on the map. The disadvantage is that we do not see the entire map in edit mode.

This brings us two questions:

In the case where we would like a world with 1,000 houses.

  1. How would you do it ?
  2. Why is the first option so slow ? I naively thought that as the engine render only from a certain distance, in my case 3 houses away, there would be no differences between setting up 10 houses or setting up 500 of them.

Let me know if I’m unclear and if you need more details.
Thank you !

1 Like

Hi @ezyh and welcome,

So the main issue with too many models in view is the number of draw calls increasing, and that lowers performance.

Things to do to tackle that and take it from there:

  1. Enable frustum culling in your active camera. That will have the engine render only the models that are inside the camera viewport.

  2. Add batch groups and enable batching for all those models. Find more about that here:

https://developer.playcanvas.com/en/user-manual/optimization/batching/

1 Like

also have a look at this thread perhaps

2 Likes