But would it allow me to save a KeyValues object?

Jeff Fearn wrote:

There is save/restore functionality in the SDK, you could just add a
couple of extra fields for when and how the player got the item to the
base item entity, add a new item list for non-current items to the
player, add that list to the player data description and then use the
existing save/restore functionality. i.e. most of what you want is
already coded so its a lot less work to modify it to your purpose than
to recode it from scratch.

Jeff

On 7/18/05, Kamran <[EMAIL PROTECTED]> wrote:


This isn't really a support question because I'm not having trouble...
more of a concept question.

If I wanted to keep track of a player's information... like all the
objects they've picked up throughout their game and I'd also like to
save it when they save the game, is it better to store a KeyValues
object inside the code and save it to a file when they save the game? Or
is it better to create a temporary file and then delete it when they
exit or copy it when they save the game to their save directory?

Of course, I'll be tracking a bit more than that but KeyValues seem like
the best way. I'm only at a loss at what is more efficient... if HL2 can
save large KeyValue objects, then my problem is solved... but if it
can't save large KeyValues than I will have to either use memory
(in-code tracking) or hard drive space (but... the file will only be, at
max, like 2MB, probably smaller). Then when the game loads I can load
the needed KeyValues file into an object that can be accessed in the code.

My initial plan is this, if no one has a suggestion:

When the game loads
----------------------
1. Check to see if there is a save data file. If not, we create a new
KeyValues object in the code. If we do, load the KeyValues object.
2. During the game, update the KeyValues as necessary.
3. If the user saves the game, save the data. If not, clear it.

My only problem is figuring out how to build a KeyValues object that
looks like this:

"Data"
{
      "data1"
      {
          "value" "1"
       }
}

Using code. Ultimately no matter what I will have to figure out how to
append data or update data. I suppose I could code it like a database
with lookup functions, update functions, and delete functions.
--
Kamran A
Get Firefox! Safer, Faster, Better.
<http://www.spreadfirefox.com/?q=affiliates&id=0&t=85>
Down with Internet Explorer! Say "NO!" to Spyware! Use Firefox

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders





_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders






--
Kamran A
Get Firefox! Safer, Faster, Better.
<http://www.spreadfirefox.com/?q=affiliates&id=0&t=85>
Down with Internet Explorer! Say "NO!" to Spyware! Use Firefox

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to