Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.049 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'modify': 0.05; 'level,': 0.07; 'next,': 0.07; 'dec': 0.15; 'sat,': 0.15; '(everything': 0.16; 'left,': 0.16; 're-entering': 0.16; 'reload': 0.16; 'subject:generation': 0.16; 'wrote:': 0.17; 'subject:Issue': 0.17; "i'd": 0.22; 'player': 0.23; "i've": 0.23; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'pickle': 0.29; 'received:209.85.215.46': 0.30; '(and': 0.32; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'project': 0.34; 'along': 0.35; 'locations': 0.35; 'process,': 0.35; 'saved': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'generation': 0.36; 'success.': 0.36; 'subject:with': 0.36; 'level': 0.37; 'drop': 0.37; 'item': 0.37; 'previous': 0.37; 'quite': 0.37; 'received:209': 0.37; 'well.': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'step': 0.39; 'build': 0.39; 'header:Received:5': 0.40; 'save': 0.61; "you'll": 0.62; 'back': 0.62; '(that': 0.62; 'ever': 0.63; 'positions': 0.68; 'hey,': 0.72; 'introduce': 0.80; 'all!': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=y8FSvFmRMig/P5zBNt84/qDH7rD28HMSPYZuR5HE1u4=; b=dhskpX2W8GtMvgGJN6toOA+y0Q4XfNXL9iWVbl26Yjc+ZrC/rB0hPHxiEQM8/zSVrw PbAxX3u/Y9akH7ZJOM0/HlDSgHzZbUkiZ+Pb81OI+HdEh+o1rFlyUQBTZYohboZ8Ectx cgYrPTC1I3hC7ue1MDzJ5+rE+1YnxQUtp260wCw3uQuTu9new5JIG7nAEHAZHJoy52pS h6V3COprRN1Ovk3rK1thzhozm5qEzSv9OVz0ii3LiFHY+QFBpHllWBqVRN58qfkn18dX JfHctpk0wSt1qxt38wOD5XaKWHrxrX4kLErTFiAeTmXsh2dho8CB8ytEE2wDcXLMBtZQ af5Q== MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Sat, 8 Dec 2012 18:03:23 -0700 Subject: Re: Issue with seeded map generation To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355015036 news.xs4all.nl 6863 [2001:888:2000:d::a6]:49031 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34514 On Sat, Dec 8, 2012 at 2: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. Make the level generation process two-step. Step 1, build the map. Step 2, populate it with items and monsters. When the level is left, save the state and positions of the items and monsters in it along with the seed. When re-entering a level, do only step 1 of the process, and then repopulate it with the saved items and monsters. Of course, if you ever want to introduce features that can actually modify the map, then you'll need to save and reload the modifications as well.