Subdivided Exterior Grid

Feedback on past, current, and future development.
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Subdivided Exterior Grid

Post by CMAugust »

An exterior cell in Morrowind is 8192 units by 8192 units (or 385x385ft or 117x117m). In later Elder Scrolls titles like Skyrim they are 4096 units by 4096 units (or 192x192ft or 58.5x58.5m). I've never come across any explanation why this was changed, but I can guess it's for performance reasons. As the player moves from one exterior cell to the next, Morrowind must load and unload twice as much surface area (with draw calls/scripts/etc) at once compared to later titles. Combined with Morrowind's frightfully draw-heavy assets, even a powerful computer can see hitches and stutters when traversing cells outdoors.

If there was a way to subdivide the exterior cell grid to Oblivion/Skyrim size there would be less work hitting the CPU at once, removing another candidate for stutter during play.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Subdivided Exterior Grid

Post by scrawl »

They've probably changed it because there are more objects in those games compared to Morrowind's sparsely populated landscape, and they tested the number that actually works best for each game. Smaller cells doesn't necessarily mean better performance, because you'll have more overhead traversing each cell, figuring out which cells are active, finding which cell an object is in, etc. Another variable is the culling granularity, which is currently tied to a cell (i.e. if an entire cell's bounds aren't in the view frustum, the culling stage can skip it).

It's difficult to change the cell size after the fact, because the data files are organised according to it. To get the full benefit (if there is one) we'd have to re-save Morrowind.esm according to the new structure. And that is problematic, because we know there are some shoddy scripts/quests/other situations that will break if a cell is loaded sooner or later than it would normally be.

As far as the rendering goes, there are some options that can help us break away from the 'cells' notion. For example, the terrain renderer collects the cells into a quad tree, so that nearer cells get sub-divided and further away cells get combined, to make the culling and rendering more efficient. The distant objects feature is probably going to make use of something like this, too. It's easy enough to do when your data is static. When it's not, you can still try - see Octree/Quadtree scene managers - but the benefits will not be as clear.
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: Subdivided Exterior Grid

Post by CMAugust »

If cell loading and rendering can be broken into more manageable pieces as you say without changing the cell size, that would alleviate the problem too. Apart from the vanilla content struggling as it is, any new project running in OpenMW will certainly aspire to the object density of a modern game, so these kind of solutions are essential. You seem to have given some thought to this, so I'm curious if they already a part of a roadmap.
User avatar
AnyOldName3
Posts: 2666
Joined: 26 Nov 2015, 03:25

Re: Subdivided Exterior Grid

Post by AnyOldName3 »

I imagine that if a new project wanted smaller cells, they could make the player character twice as tall and achieve a similar effect (although they also might want to recommend that users use a higher-than-default exterior cell load distance). New projects aren't limited by the same things as Morrowind, and as the cell size is a number in arbitrary Morrowind distance units, there's no need for a new project to interpret them in the same way.
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: Subdivided Exterior Grid

Post by CMAugust »

Good point, I overlooked that the distance units themselves are arbitrary. My main concern is Morrowind itself and the scale it chose to use. OpenMW doesn't have enough tricks up its sleeve (yet) to prevent the game skipping as new cells and their contents appear, even on a good PC.

Perhaps in addition to Scrawl's quad/octree suggestion, there could be various sliders for object/item/actor/grass fade in settings as later Elder Scrolls games have done, so that not necessarily everything need appear at once as new cells are loaded.
User avatar
AnyOldName3
Posts: 2666
Joined: 26 Nov 2015, 03:25

Re: Subdivided Exterior Grid

Post by AnyOldName3 »

The distant statics feature will probably have a distance cap (or small feature culling will result in an effective distance cap) when it eventually gets implemented, so we won't load everything off into infinity. There's a smaller need for sliders which affect things in currently loaded cells we have far fewer cells loaded at a time than the later games.
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: Subdivided Exterior Grid

Post by CMAugust »

If you mean to say that having fewer cells loaded at a time (9 in Morrowind vs 25 in Skyrim) implies better performance, I don't know if that's the case. I'm no good at maths, but if I understand correctly, crossing a cell border in Skyrim loads 5 new 58.5x58.5m cells: 585 square meters altogether. Crossing a cell border in Morrowind creates 3 new 117x117m cells, a total of 1170 square meters. That's not a trivial amount of extra space being loaded simultaneously, especially if they're populated by nasty, draw-call-hungry Morrowind assets. scrawl makes a good case why changing cell size could be more trouble than it's worth, but in my view this reality still needs to be addressed in some fashion. Stuttering on cell transition is all too common, and is begging for more gradual ways to load cell contents.
User avatar
AnyOldName3
Posts: 2666
Joined: 26 Nov 2015, 03:25

Re: Subdivided Exterior Grid

Post by AnyOldName3 »

Your totals seem to be made up numbers to me as I can't make my calculator spit them out, but I do concede that more world space gets loaded on a Morrowind cell transition.
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: Subdivided Exterior Grid

Post by CMAugust »

You're right, it's because I wrongly assumed I could multiply the square total of a cell by 5 to get the overall size. Edit: or I could have followed my original method and simply not get the square calculation wrong (58.5x2 instead of the correct 58.5x58.5). I did say maths isn't my forte...

A correct measurement for Skyrim's newly generated cells at 58.5x58.5m each appears to be width (58.5x5=292.5) times length (58.5) equals 17,111.25m2. Morrowind's 3 new cells at 117x117m2 would come to 41,067m2, so it's actually a bit more than double. Sorry for the confusion.
luthis
Posts: 6
Joined: 21 Feb 2018, 19:45

Re: Subdivided Exterior Grid

Post by luthis »

So it's not my PC (it should be more than capable) that is the cause of stuttering while loading cells? That's a relief.. Does everyone on OpenMW have the same problem?

What about pre-loading cells? Modern PCs often have >=8GB ram, what about having 1 or 2 GB allocated as the intelligent-preload-cache that loads say half the data for more distant cells in the background so when the player approaches, only the remaining half needs to be loaded.

I imagine in reality, coding that probably quite intense.
Post Reply