Re: Getting a seeded value from a list

2012-11-19 Thread frednotbob
> 
>   Are you generating the entire level on entry, or as each room is
> 
> "opened" (if, "as opened", you have the complication that going down a
> 
> level and back up will result in different random numbers vs going
> 
> straight to the room).
> 
> 
> 
>   Generating on entry only needs the seed for the initial generation
> 
> point (as mentioned, first time you could use the system clock and save
> 
> the value).

I'm generating the room on entry -- the 'stairs' object calls 'make_map()' 
which creates the floor and lays out monsters and treasure.

What I'm trying to do is set a persistent state for the levels generated by 
make_map(), so the player can move between floors without generating a totally 
new randomized floor each time.
 
> 
>   But for a dungeon -- you may be best served by generating the entire
> 
> level (all rooms, doors, static encounters [traps, treasure]) when
> 
> entering the level, and saving the entire dungeon (after all, after a
> 
> treasure is collected, it shouldn't re-appear the next time you start
> 
> that same level -- if you only save the starting seed, then all
> 
> encounters will also be regenerated). In this scenario, where you save
> 
> the entire dungeon, you don't even need to worry about the seed --
> 
> you'll never really want to recreate the same dungeon for another party
> 
> [unless running a competition in which case you seed every computer the
> 
> same so every participant is running the identical dungeon].


That actually sounds close to what I'd like to ?do.  How would I go about 
saving the dungeon?  I'm guessing I'd need to define how many levels to 
generate, first of all
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Getting a seeded value from a list

2012-11-20 Thread frednotbob
>
>The former can be generated from the seed each 
>time you enter the level; the latter must be generated the first time then 
>stored. 
>

Random.random() is already populating the levelSeed list; I've set it as part 
of new_game() so that any time the player begins a new game, the levelSeed list 
is replenished with a new set of data.

The problem, in a nutshell, is this:

When the player starts a new game, make_map() randomly generates level 'Foo' as 
the player's starting floor.  Floor 'Bar' is similarly generated as the player 
descends from 'Foo' to 'Bar.  

Each time the player goes from 'Foo' to 'Bar' (or vice versa), make_map 
randomly generates a new layout for either level.

What I'd like to do is select values from 'levelSeed' and assign them to the 
levels that make_map generates so that the player goes back to the same 'Foo' 
and 'Bar' each time (at least until the player repopulates levelSeed with new 
values by whatever method I eventually decide to use).

I simply can't find any relevant examples online; everything I've found so far 
is either intended for a different purpose or assumes that the reader is 
already an experienced programmer.
-- 
http://mail.python.org/mailman/listinfo/python-list