Jump to content

spatial subdivision query too large


idanwin
 Share

Recommended Posts

I guess you mean this: "SpatialSubdivision Query too large. Results truncated."? If you don't provide any logs, please try to keep the capitalisation and spacing of the original message. It makes it so much easier for us to search.

This is something RedFox introduced some time ago. The old spacial subdivision used variable-length vectors (so there was only a hardware limit on the number of entities per tile you can place), while after that change, there's a limit of 1024 units per subdivision (I don't know exactly how large a subdivision is). Later on, it was doubled to 2048.

It probably means you have placed your trees or other entities too dense for RedFox' limits.

I also remeber there was a quite heated discussion on the fixed limits those days.

Link to comment
Share on other sites

Was it done to improve performance?

Yes, it was done to improve memory allocation IIRC. With growing lists, you need to allocate an increasing amount of memory, and each time you allocate memory, it costs some time.

If so, did it in fact perform notably better?

Hard to tell. Once enough memory is allocated (after a maximum number of units passed on those tiles), it won't improve performance. And on the other hand, with the limit in place, it will always allocate the same amount of memory. So in the most cases, you'll have wasted a multiple of the needed memory.

It's quite hard to find decent profiling of it too, because of all the discussion around it.

Link to comment
Share on other sites

Does units walking into the subdivision count as well (so the error may not always occur but only if units are tightly packed there by a player)?

(This would be horrifying since the map will load but if a player commands his army through a subdivisions already containing entities close to the limit the error will be risen)

On the other hand I don't think map designers shouldn't pack non-moving entities tighter than 1 per terrain tile (though actors might be).

(However, the engine should not break because of this.)

Performance is a valid reason to limit flexibility though sad IMO.

(I think this should have been considered in the very basic design of the engine IMO but I think it's to late for that (?))

I don't like unneeded hard limits in general though (I like flexibility) but I have not enough information to really get involved into this.

Edited by FeXoR
Link to comment
Share on other sites

Yeah units would count.

I'm not really sure there's a real performance downgrade memory-wise if we do this conservatively. Vectors are guaranteed to be continuous, and we could use a sensible limit on init (counting the number of entity in that subdivision) that would probably be enough once and for all, yet retain adaptativeness.

Though we probably could use a cleverer data structure anyhow if we could figure one out.

Link to comment
Share on other sites

When was this introduced? I only get the error with the svn, not with Alpha 15. (I had a look at the link you gave, but couldn't find any timestamp.

EDIT: I updated to the latest svn today (something I hadn't done in about a week) and I don't get the error there anymore either ...

Edited by idanwin
Link to comment
Share on other sites

Was it done to improve performance? If so, did it in fact perform notably better?

Allegedly, yes, but it is difficult to get accurate performance measurements. I think it’s reasonably safe to say it results in a small performance boost; however, that may not even be noticeable.

I frankly was opposed to this change (and still am), but IIRC it was done to pave the way for some other changes that would have a larger effect. Since those never really got done I’m in favor of reverting it.

That’s quite weird that you’re no longer getting it idanwin; I can’t think of a change in the last week that would have fixed that (plus it should also be happening in A15).

Link to comment
Share on other sites

I do remember having another issue with which it might have something to do:

A few days ago buildings seemed to multiply. I destroyed a building and it sank into the ground, but the building was still standing. So I opened debug mode and clicked 'control all units' and deleted that tower over and over, but it seemed like infinitely many towers had been placed on the same spot. The same happened with civ centres. This only happened in the svn build. I thought it was probably because of a change that had not been completed and that the issue would be resolved soon after. I updated about 3 times that day, but the issue wasn't fixed.

It has been fixed now. This might have been the issue... I only got the error in the map editor after running a simulation test.

Link to comment
Share on other sites

Was it done to improve performance? If so, did it in fact perform notably better?

No. If you looked closely in a profiler, you would notice a difference when range queries are at their worst (but we need like a 10x improvement there to matter, which you won't get by hardcoding all kinds of limits in the data structure).

I would actually love to kick that change to the curb, it's been in the back of my mind for a while now.

  • Like 1
Link to comment
Share on other sites

Is the error constantly repeating? In the last month or so I changed the selection system to use SpatialSubdivison and I think there were some issues at one point where the query would be larger then the map size when using the dev overlay which got the SpatialSubdivison angry.

Link to comment
Share on other sites

Is the error constantly repeating? In the last month or so I changed the selection system to use SpatialSubdivison and I think there were some issues at one point where the query would be larger then the map size when using the dev overlay which got the SpatialSubdivison angry.

I believe Idanwin is using A15, so that wouldn't matter. Though maybe you've found a new problem indeed.

Link to comment
Share on other sites

  • 2 weeks later...

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.

 Share

×
×
  • Create New...