GP2X Need Some Input/advice


Dimacus

Member
Joined
Jan 25, 2006
Messages
349
Age
38
Location
Land of the 'åäö'
Website
luminare.no-ip.org
I need some input on this;
Im currently trying to make some sort of conversation system for a RPGish game.
But I just cant decide if I should preload all the conversations or if I just should load them when needed.
If I only load them when needed there would be an excess of file I/O operations, and alot of searching trough files.
However, caching all conversations would take quiet a lot of ram and I dont really have a great way of indexing them.

I thougt about creating a FILE (I use C style file I/O) for EVERY diffrent conversation and keeping them in an array, until I realized that it is a somewhat stupid idea since you can only have that many files opened at the same time and the FILE struct might takeup even more space than ceartin conversations.

So, what do you guys think?
 
It might be worth just loading them into memory from a file, I doubt you'd have more than 1MB (1024 conversations of 1024 character).

If you want separate files, don't bother with an array (you'd probably run out of file descriptors), give each conversation a number and name the files using it (e.g. conversation1, conversation2 ...) then you can construct the filename dynamically. Open the file read it and close it (this might be slow).
 
<subliminalmessages>PNG and ZLIB</subliminal messages>

Yeah, i agree. I think that its OK if you just load the files into memory 1 by 1.
 
Load an index of the conversations into memory (with offset/length into a conversation file), and load them from that file on demand. One conversation per file would be wasteful on most filesystems. You could include identification info inside the file and make a small utility to generate the index (and optionally strip the identification info if you want to save more space or make it more resistant to modification).
 
Thanks for the input!
Im going to try and load them all into memory

Just to clear up my last post, I dont have all the conversastions in separate files, I keep all the conversations for npc A in one file and so on.

(and optionally strip the identification info if you want to save more space or make it more resistant to modification).
I want to make it as modification friendly as I can :)

[ramble]Hmm I suddenly feel the urge of implementing zlib and PNG files, but maybe it's because somebody ate my brain..[/ramble]
 
Back
Top