How to build several world in a single game n' make....

i’m sorry I really blank in panda
n’ i’m really sorry for my grammar

  1. how to build a several world in a single game, I doesn’t have idea how to eksplained it but if you play a rpg game like oblivion. when our actor is outside he/she is at the world that contains only outside environment meshes rendered.
    and when our actor is go inside a house the game load a world that contains only interior of the house and place our character in there.

  2. what is the method ( or sample code will be appreciate ) to make our game can make it save game

Thank you so much
I really appreciate for the help ( sampel code in python really help me )

when in side the house

worldNodePath().hide()
houseNodePath().show()
#maybe reposition the user at the door
player.setPos(houseNodePath.find('door1').getPos())

this is an example of what i did, look up pickle.

    def load(self,file):
        """ very tiny fuctnions to load the entire game state """
        data = cPickle.load(open(file,"rb"))
        self.users,self.zones = data
        
    def save(self,file):
        """ very tiny fuctnions to save the entire game state """    
        data = [self.users, self.zones]
        data = cPickle.dumps(data)
        open(file,'w').write(data)

wow thanks :smiley:

I’ll try your solution
but I need to reassembles my nodepath first

many…many thanks

hi treeform are u there? or somebody else

bout question number 2

how did this code work actually?
or the right question is how and where to use it
is there any params that need to call?

cause i’ve tried it but it wont write any file at all, or its not work at all with my code

thanks for u

I believe you need to set up collision events near the entrance to the house, so that when your character gets to a door and presses a button (or you could make it work automatically) the worldNodePath becomes hidden and the houseNodePath is shown and visa-versa, at least that is what would make sense to me.

About question 2:

the code works because in treeform example, all the world is defined in two python object that are users and zones. (according to the name, they maybe list of other python objects created by treeform)

So saving this two objects and restoring them later is enough to recreate the world.

Now, in your game you may have to save a very different list of objects (
ex players,buildings,props,scores etc…)
It’s up to you to define the list of object that need to be stored /restored between saves.

Note that by default, nearly every python object can be saved by treeform method (cpickles) but Panda3D objects nodepath/ actors and so on are no picklable with defaut pickle (i dont know for cpickles).

Note finally that you should include some safety check in your load procedure if you use stnd pickle because std pickle allow to load “code” instead of simple object, which is a big risk

the first question is solved so long ago

now my character can go from Yogyakarta( indonesia ) to Bali just by opening the door 8)
rather unrealistik, I know

the second is still my problem
I have do that manakel, I think I do right, just problem with my eye irritating code I gezz

my bad I can show it right now, coz Im in the public internet ( my computer not connected to Internet :wink: and dont ask the reason why!)
so I have no access to my py file

may be sometime