It will almost be a database. I'm creating an RPG mod. So I need to
store the inventory with Item IDs to reference from the Master Item
List, keep track of Active, Complete, and Abandoned Quests, etc, keep
track of the user's stats and stuff like that.

So far the first method I use works very well. It's only called when the
user wants to view his quest journal, so it isn't called every frame. I
use a HUD message to send a request to UpdateQuestInfo passing the
requested ID to update...

It only writes a temporary file when I need to save the game (I haven't
implemented this yet, but the temporary file works along with encrypting
it to keep the user from modifying it).

Jeff Fearn wrote:

Probably, but why use KeyValues to store game data?

Jeff

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


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





_______________________________________________
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