Re: Issue with seeded map generation

Discussion in 'Python' started by Mitya Sirenef, Dec 8, 2012.

  1. 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
     
    Mitya Sirenef, Dec 8, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roedy Green
    Replies:
    8
    Views:
    1,207
    Daniel Dyer
    Mar 9, 2006
  2. John W. Long

    HTML Generation (Next Generation CGI)

    John W. Long, Nov 22, 2003, in forum: Ruby
    Replies:
    4
    Views:
    395
    John W. Long
    Nov 24, 2003
  3. Dennis Lee Bieber

    Re: Getting a seeded value from a list

    Dennis Lee Bieber, Nov 19, 2012, in forum: Python
    Replies:
    14
    Views:
    326
    Hans Mulder
    Nov 27, 2012
  4. Graham Fielding

    Issue with seeded map generation

    Graham Fielding, Dec 8, 2012, in forum: Python
    Replies:
    1
    Views:
    203
    Hans Mulder
    Dec 8, 2012
  5. Ian Kelly

    Re: Issue with seeded map generation

    Ian Kelly, Dec 9, 2012, in forum: Python
    Replies:
    0
    Views:
    177
    Ian Kelly
    Dec 9, 2012
Loading...

Share This Page