Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CF: Wasted Space & D.Door



On Jan 11,  3:19pm, Preston F. Crow wrote:
> Subject: Re: CF: Wasted Space & D.Door
> >I think also CPU use:  in a big map with a player in it, all the
> >monsters/other active objects must be moved every tick.
> >
> >I don't think memory is such a big deal any more.
>
> That makes sense.  It would probably be best for unused space to be
> filled with solid walls or such to solve the dimension door problem.
> Someone mentioned 300 bytes per object, so even a 20x20 map of solid walls
> is only 120K.

 Empty space on the map isn't as big a deal as it once was.  The reason some of
the brest maps were split up:

 1) spaces that actually have objects start using up more memory.  So a 40x40
map compared to 20x20 uses a lot more memory.
 2) Currently, all living objects are done at map level resolution.  So if you
have a 100x100 map, all monsters get animated.

>
> Also, if someone ever gets around to it, I think the goal is to have the
> server only deal with the part of the map "near" the player anyway, making
> it less important to have separate maps.  The example for this project
> has been to have a single map for the Scorn continent.

 Actually, my goal was to have multiple maps like now, but have the server
automatically tile the maps together.

 The problem with having 1 map for an entire continent is it would be huge
(200x200 or something.)  But there is also the desire to increase this size by
3 or 4 times to make the distances between the various cities actually sizable.
 So this now makes the map 600x600 or something.  360,000 objects (assuming
1/space), at 300 bytes/object = 100 megabytes or so.  Even with memory now
days, that is probably a bit much.  a 100x100 map is 3 megabytes or so - a bit
of memory, but not much by todays standards.

 But even aside from memory, there is cpu speed.  Even if we only activate
living objects within some distance of the player, there is still some speed
cost of traversing the entire list of living objects (the actual addition of a
active object list in addition to the standard list was a speed enhancement for
this reason).  So if you have a big map, you now have the potential for a lot
more objects that need to be traversed, and now checked against various
criteria (on the same map and distance to player.)

 Probably having objects live if within some distance may make sense - sure, if
you run away for enough on the map, the monster stops doing anything, but the
same affect can currently be done just by leaving the map.

 But back to the original question -

 Having lots of empty spaces on maps have little impact on memory or
performance.  There are some arrays for the maplook stuff that are allocated
the size of the map, but I believe those arrays are all pointers so don't use
much space.  Likewise, there is an array for all the objects on each square the
map, but once again that has minimal memory impact.

 The bigger problem is you need to make sure players can't get to these unused
areas - otherwise, the player can might be able to bypass a lot fo the map
(ddoor into unused porrtion, walk past a bunch of stuff, and ddoor back into
the real area.)  Also, things like magic mapping may be a little strange seeing
all that area.  Filling all unused spaces with 'blocked' things, while taking
more memory, fixes both of those problems.





-- 

-- Mark Wedel
mark@pyramid.com
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to crossfire-request@ifi.uio.no]