Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: Issue with seeded map generation (http://www.velocityreviews.com/forums/t955283-re-issue-with-seeded-map-generation.html)

Mitya Sirenef 12-08-2012 10:27 PM

Re: Issue with seeded map generation
 
On 12/08/2012 04:32 PM, Graham Fielding wrote:
> Hey, all!
>
> I've managed to get my project to a semi-playable state (everything

functions, if not precisely the way I'd like it to). One small issue is
that when the player movs from one level to the next, the items and
monsters in the previous level all 'reset' and return to the positions
they had when the level was seeded.
>
> I've puzzled over (and attempted) quite a few workarounds, and had no

success. I don't want to pickle the entire level (that would be overkill
for what I need), but I want to update the item/monster locations so the
player can drop an item and come back to it later.
>
> Should I add something to the 'drop_item' function, or call soemthing

in make_map?
>
>


How many levels do you have and how much does each take up in memory? It
might be ok to to simply save the level in memory under its number; if
the map takes up a lot of space you can make objects take up less memory
by using __slots__, and then change levels by doing something like this:

def change_level(num):
self.levels[self.current_lvl] = self.levelmap
if num in self.levels:
self.levelmap = self.levels[num]
else: [handle new level creation]
self.current_lvl = num

-m



All times are GMT. The time now is 09:08 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57