Forum Overview :: Wasteland 2
 
Re: Wherein I make a load of assumptions by Ice Cream Jonsey 07/25/2012, 10:01pm PDT
Entropy Stew wrote:

Could you maybe use that Possesions array as the pickled hero state, and use the normal object system for active characters?


... Holy shit, that's genius.


You could have a CurrentPossessions property routine in the hero class which walks the object tree of a hero and returns an encoded array representing it, which gets saved into Possessions on pickling, and restored on rotation back into the active party. I don't know if that solves the static object issue, but I assume some kind of object pool for the objects to get allocated from and released to (I'm assuming we don't care about object IDs, just that we have any instance) would work.


I really, really like this idea. I'm going to try this. Unfortunately, I can't have locally declared arrays for objects -- if I could, I would just save that character's possessions array in the pickled state, and then supply him as best I can when the player character becomes active again. ("Oh, this guy had 2 rifles, on a restore of him, check the armory for rifles: there are six, great! Add two to him/doesn't matter which two.")

(Five minutes elapsed while I wrote this post, as I thought about it.....)

... OK, I can't have and save a local array, but I *can* just iterate through his Possessions[] array and dump the elements of it to disk. And then populate his PossessionsArray[] when he re-joins the party. Hm.

Thanks, Stew. I think that would work. I would have never thought to do it this way!


ICJ
PREVIOUS NEXT REPLY QUOTE
 
Saving characters and character items by Ice Cream Jonsey 07/24/2012, 10:56am PDT NEW
    damn that seems backwards by jeep 07/24/2012, 9:46pm PDT NEW
        Re: damn that seems backwards by N 07/25/2012, 9:50pm PDT NEW
        Re: damn that seems backwards by Ice Cream Jonsey 07/25/2012, 9:54pm PDT NEW
    Wherein I make a load of assumptions by Entropy Stew 07/25/2012, 4:36pm PDT NEW
        Re: Wherein I make a load of assumptions by Ice Cream Jonsey 07/25/2012, 10:01pm PDT NEW
            yw! by Entropy Stew 07/25/2012, 10:39pm PDT NEW
                Also by Entropy Stew 07/25/2012, 10:52pm PDT NEW
                    Re: Also by Ice Cream Jonsey 07/27/2012, 6:17am PDT NEW
    Multi-dimensional array? by Flack 07/25/2012, 5:30pm PDT NEW
        Re: Multi-dimensional array? by Ice Cream Jonsey 07/25/2012, 9:48pm PDT NEW
 
powered by pointy