A world design

 
Post new topic   Reply to topic    mudlab.org Forum Index -> Design
View previous topic :: View next topic  
Author Message
Stormy



Joined: 09 May 2007
Posts: 6
Location: Northern Virginia

PostPosted: Tue Aug 28, 2007 4:08 am    Post subject: A world design Reply with quote

I'm designing a world based on tiles of arbitary size (size is relational instead of fixed - like the console game Gladius). I'm grouping the tiles into 20x20 locations for convenience. My main question is, what would be the best way to handle the data implementation? I've researched R-trees a bit, but they seem to me to be better suited to non-arbitrary space, where my design is essentially an array or grid, so finding data would (I think) be searching fixed, accessible tiles around a specified tile. My current idea is to use a sparse array.

I have other questions, but they really depend on the general implementation, so I'll hold off.

Thank you in advance for any help -- please let me know if I need to clarify anything or include additional information.

-Stormy
Back to top
View user's profile Send private message
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Tue Aug 28, 2007 2:03 pm    Post subject: Reply with quote

I went for an array, and it works out pretty well. However if your world has small areas of high detail and larger areas of repetitive terrain (such as vast oceans) you might want to consider using a quadtree.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Stormy



Joined: 09 May 2007
Posts: 6
Location: Northern Virginia

PostPosted: Tue Aug 28, 2007 2:36 pm    Post subject: Reply with quote

Thanks KaVir -- I have a question about the quadtree implementation. If I'm using an array, and I know where the target (player) is, would a quadtree be of much use? I imagine I'd just spiral outward (or cone, depending), analyzing the land around the target as I went. I do plan on having vast oceans and other, large chunks of terrain, but I think I'm overlooking what the advantage of a quadtree would be in this instance.

Thanks again for the reply.

-Stormy
Back to top
View user's profile Send private message
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Tue Aug 28, 2007 8:56 pm    Post subject: Reply with quote

I was assuming you were talking about storing terrain data. I guess quadtrees might work for storing player positions as well though, as high-detailed areas of a mud world are also typically going to be the more densely populated.

The quadtree has an advantage (over an array) when it comes to storing a lot of detail in important locations (such as towns) while storing very little elsewhere (such as oceans, wide mountains, etc). If the top-right quarter of your world map is pure ocean for example, then that node doesn't need and child nodes; you can simply leave it as it is without having to go into any more detail. With the array approach, however, each tile of ocean is going to have to be stored.

As I mentioned before, I used an array. However I only store the main continent, and that requires a more or less uniform amount of detail throughout - the world outside of the main continent is either pure ocean or psuedo-randomly generated islands, and that doesn't really take up any memory.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Stormy



Joined: 09 May 2007
Posts: 6
Location: Northern Virginia

PostPosted: Wed Aug 29, 2007 9:20 am    Post subject: Reply with quote

I probably need to include some more info. Tiles will have both terrain and health values (health being a value between 0-100, meaning dependent on the terrain type and affected by things like weather and fire). Tiles will contain objects, including creatures, vegetation, typical items, and structures (mostly player-built).

Tyche suggested quadtrees for the terrain as well, but then also R-trees for objects. I'll split up my questions:

Are quadtrees the answer if terrain can change during gameplay (won't be very common)?

Would there be a big benefit to using R-trees over a sparse array (where a tile is nil unless it contains an object)?

Does anyone know how well R-trees lend themselves to line of sight and pathfinding?

Thanks again for any help.
-Stormy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    mudlab.org Forum Index -> Design All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group
BBTech Template by © 2003-04 MDesign