Anybody remember why we have the subzone system?

Discussions on various DOL development features

Moderator: Support Team

Anybody remember why we have the subzone system?

Postby tobz » Tue Jan 24, 2012 2:24 am

I'm taking it upon myself to basically scrap the subzone stuff in Zone.cs for a far-more-readable quadtree solution. I'm curious, though, if anyone remembers precisely why WitchKing / Konik wrote the subzone stuff.

From what I can see... there isn't anything particularly noteworthy and the code comments are dry. It seems to be very basic handling of subdivisions of a zone's space to hold objects, and the associated code to go along with searching through those subdivisions to perform radius searches. There's some stuff on player relocation but I haven't really taken a good look at it. Presumably it deals with moving objects from old subdivisions to new subdivisions based on updated positions.

Anybody see a reason not to clean this up with a much simpler version? I tried to do some basic searching but didn't come up with much. The upside is far less brittle and more readable code... the potential downside is possibly a slight speed decrease but I don't see it being all that much slower if at all. Another upside, as well, is being able to finally strongly-type radius searches. :)
tobz
DOL Devotee
 
Posts: 363
Joined: Mon Jul 27, 2009 6:24 pm

Re: Anybody remember why we have the subzone system?

Postby Tolakram » Tue Jan 24, 2012 1:03 pm

I can't read that code, no clue. Areas maybe, since the Area system is backwards reverse polish notation? I do remember some of the getinradius... used to be quite slow, so perhaps sub-zones improves on this by reducing the number of objects that need to be searched?
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Re: Anybody remember why we have the subzone system?

Postby tobz » Tue Jan 24, 2012 3:07 pm

Hehehe. :P Yeah, it's slightly unreadable.

I mean, I'll have to test my stuff to make sure it's up to snuff... but it shouldn't be slow by any means. Quadtrees and octrees are used for view frustrum culling so they are optimized, or can be optimized anyways, for efficient culling of objects given a target section of the tree. You can quickly traverse the tree to get smaller and smaller object sets for searching through which makes it more efficient. Since the trees are evenly subdivided and you'll have a power of 2 to search through at any given layer in the subdivision, you can, potentially, parallelize it easily and cleanly as well.

This should really make the code far less brittle since there is no special magic to worry about. A quadtree is easily understood and you can find tons of reference implementations on the internet.
tobz
DOL Devotee
 
Posts: 363
Joined: Mon Jul 27, 2009 6:24 pm

Re: Anybody remember why we have the subzone system?

Postby Graveen » Tue Jan 24, 2012 9:53 pm

dunno, really :)
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12661
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: Anybody remember why we have the subzone system?

Postby Dinberg » Fri Apr 13, 2012 6:06 pm

A bit late, but here goes!

I think it could be to do with code mirroring the clients way of doing things. I remember the client splits up areas into zones, perhaps its some quirky thing to do with this. However, I'm sure it would be better to have a quadtree system for sorting objects and if need be mockup zone information if a client needs it (like 'what zone id am i in' etc). By all means go ahead with it :D
The Marvelous Contraption begins to stir...
User avatar
Dinberg
Inactive Staff Member
 
Posts: 4695
Joined: Sat Mar 10, 2007 9:47 am
Yahoo Messenger: dinberg_darktouch
Location: Jordheim

Re: Anybody remember why we have the subzone system?

Postby Ephemeral » Fri Apr 13, 2012 9:45 pm

A wild dinberg appeared!
"The swarm is always smarter, faster and more adept than any actor which seeks to thwart it."
C++, Java, C#, VB.NET, ASM.
Current Project:
Engine Developer for The Red Solstice
User avatar
Ephemeral
DOL Freak
 
Posts: 554
Joined: Wed Mar 30, 2011 12:23 am

Re: Anybody remember why we have the subzone system?

Postby Dinberg » Sat Apr 14, 2012 6:35 pm

I'm around often, just only have time to check staff forums these days :(
The Marvelous Contraption begins to stir...
User avatar
Dinberg
Inactive Staff Member
 
Posts: 4695
Joined: Sat Mar 10, 2007 9:47 am
Yahoo Messenger: dinberg_darktouch
Location: Jordheim


Return to “%s” DOL Development Discussion

Who is online

Users browsing this forum: No registered users and 1 guest