[Tech] Tree Solution

Thoughts on the further development of Haven & Hearth? Feel free to opine!

[Tech] Tree Solution

Postby Peter » Tue Jun 16, 2009 12:36 am

I understand part of the reasoning for the scarceness of trees is that they are resource-intensive, as they are as complex as any other normal object. Giving them the ability to reproduce would lead to exponential server demand.

How can this be avoided?

One potential would be to not treat distant trees as individuals; trees that haven't been seen in the past 24 or 48 hours are erased and only re-drawn when visited, and planted randomly; potentially the number of trees in an area is stored, so that only that many plus a reasonable amount of growth appears (long-term deforestation remains possible). Thus only trees near players would be kept where they where and at full detail. While simple, it's inaccurate and may have less effect as the number of players increases.

Other potentials include storing a simplified tree map that treats each tile as either having a specific tree or not, and gradually stepping through this map adding new plants like a CA while players trim them out- in this case, only trees actually in vision range of a player are "real", and are only as complex as trees are now, all others, no matter how many there where, would have the same total server weight, as they are represented solely by a pixel or single database entry. This would trade computational complexity for a large map that is gradually scanned. Potentially only subsections could be parsed at once.

Other thoughts?
Surprise.
User avatar
Peter
 
Posts: 1491
Joined: Thu Jun 04, 2009 3:36 am

Re: [Tech] Tree Solution

Postby theTrav » Tue Jun 16, 2009 4:55 am

Depends a lot on what they want to do with trees in the future...

Currently for each tree I'd assume they need to store:
location
age
type

In the future I reckon they'll want to store stuff like:
number of apples/pine cones
HP?
Engravings / battle scars?

It might prove optimal to use some procedural techniques for working out where trees are to be planted, they might be able to get away with less storage then. So far we don't even know if the problem is processor time or storage time (or indeed if it exists).

If it's a problem with trees self propagating needing to consult all trees then that could be optimized back to doing 'areas' at a time, or even just random tree planting from birds dropping seeds.

If it's a problem with the server figuring out which sprite to send to the clients, then a distributed model could be used. Have the primary server just store data, treat different ages of trees as different types of trees and then have a dedicated thread/remote machine slowly iterate through all the trees in the world checking their age to grow them if necessary, that way the server the players use only has to do simple updates and all the iteration/checking can be offloaded onto a separate server.

That model could be replicated to just about any dynamic process that the server has to do periodically though, and it's largely dependent on the hardware budget
User avatar
theTrav
 
Posts: 3464
Joined: Fri May 29, 2009 11:25 pm


Return to Critique & Ideas

Who is online

Users browsing this forum: Claude [Bot], PetalBot [Bot] and 0 guests