Re: Text RPG Design.. (General thread for various questions)
Posted: Thu Mar 24, 2011 10:00 pm
Some follow up questions...
I need to know of the most efficient and simple way to move an Element from one LinkedList to another LinkedList.. i.e I don't want to have to waste cycles manually re-creating the item in one list, and then deleting it from the other (unless it just doesn't matter to performance).. I haven't gone back and looked at the help Docs yet, but I think I saw a command in there but wasn't sure if it only worked within a List, or between unstructued global Lists..
Scenario:
Player enters a room and sees an uber cool sword laying on the ground. The sword resides in a LinkedList which is specific to that Room's Structure (so each room has its own List for contents to be fed into). Player picks up the sword, now ownership is transferred to the Player, and he puts it in his backpack, so now ownership is transfered to the Player's backpack. The sword needs to be physically moved (in memory) from the LinkedList attached to the Room, to the LinkedList attached to the backpack; so if you /look at the room the sword is gone, but if you looked in the backpack it would show up there.
Some other things worth pointing out:
I haven't decided if there will be a LinkedList for the Player's Hands - the above scenario suggests this would be necesarry, because the first ownership is from the Room to one of the Player's Hands (you cannot pick something up unless you have a free hand, and I am not using shortcuts like "Take sword" = bypassing the hands and going straight to a container)..
The Unique ID for Objects, while stored in a field in an Object's Structure, should only be accessed as a last resort. The way I intend to use UIDs with LinkedLists is that when an object is generated for the first time and placed into such a list, the List Element holding the object is named after its UID. I am hoping this design would allow easily handling Objects and copying them between Lists, etc.. The UID is only stored as a backup, for when the player saves and quits, and then comes back (the world has to be re-populated).
I need to know of the most efficient and simple way to move an Element from one LinkedList to another LinkedList.. i.e I don't want to have to waste cycles manually re-creating the item in one list, and then deleting it from the other (unless it just doesn't matter to performance).. I haven't gone back and looked at the help Docs yet, but I think I saw a command in there but wasn't sure if it only worked within a List, or between unstructued global Lists..
Scenario:
Player enters a room and sees an uber cool sword laying on the ground. The sword resides in a LinkedList which is specific to that Room's Structure (so each room has its own List for contents to be fed into). Player picks up the sword, now ownership is transferred to the Player, and he puts it in his backpack, so now ownership is transfered to the Player's backpack. The sword needs to be physically moved (in memory) from the LinkedList attached to the Room, to the LinkedList attached to the backpack; so if you /look at the room the sword is gone, but if you looked in the backpack it would show up there.
Some other things worth pointing out:
I haven't decided if there will be a LinkedList for the Player's Hands - the above scenario suggests this would be necesarry, because the first ownership is from the Room to one of the Player's Hands (you cannot pick something up unless you have a free hand, and I am not using shortcuts like "Take sword" = bypassing the hands and going straight to a container)..
The Unique ID for Objects, while stored in a field in an Object's Structure, should only be accessed as a last resort. The way I intend to use UIDs with LinkedLists is that when an object is generated for the first time and placed into such a list, the List Element holding the object is named after its UID. I am hoping this design would allow easily handling Objects and copying them between Lists, etc.. The UID is only stored as a backup, for when the player saves and quits, and then comes back (the world has to be re-populated).