File Handling
Displaying 1-8 of 8 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Sargana

While after some research I suspect what I want to do is essentially not possible, I'm looking for some workarounds so any community advice would help.

The project I'm working needs to be able to handle a rather large amount of data, and practically it's a bit much to load into RAM (not impossible, but I'd prefer a more lightweight solution).

I need to be able to save array based information into a hard table file and then use that as the primary information reference. That is, instead of keeping the entire database of information in RAM, I want to be able to selectively load and save the information into a hard file.

But it seems verge is not able to do this without rewriting the file from scratch every single time. So the question is, thusly, does anyone have a way that I can modify only part of a hardfile at one time?

So for example, if my file is:

A B C
D E F
G H I

I want to be able to open the file, overwrite one of the letters in the array, and save it again without having to spool all the data and write a new file.

I could work around this by having the program save hundreds to thousands of individual files, but this isn't a very elegant solution.

Any advice?

Posted on 2009-10-11 06:42:16

Overkill

Sadly, after looking at the source, there is no way to open a file in "update" write mode (w+) so you can't seek over data. I could add it to Verge, if it is mandatory.

So how much RAM are we talking? The RAM wasting would probably be less costly than the file system waste, especially since you can't remove files.

For instance, a game that takes 150MB of RAM still doesn't bother me, considering that I have 1.5GB of RAM. And most people have much more than that.

Anyways, shout back and I can add in update mode if you're not willing to live with a tradeoff.

Posted on 2009-10-18 09:14:17

Sargana

Well I'm working on the base core for a Master of Orion style 4X game. In theory I am stretching verge beyond it's intended purpose, but I find the interface very lightweight and easy to manuever through.

I need to generate system data for a potentially large number of stars. This data is brief and uncomplex -- at the moment. But the system files will also contain colony information and this could balloon to pretty large proportions over time. Each star *could* contain up to 204 planet/moon entities, and I can easily see each of these containing hundreds of relevant variables.

If I requisition an integer array of 180x204x250 it consumes 35 megs. I'm just concerned with bloat as other data heavy arrays are added in later on, or if the data needed grows as well. An alternate technique I've used before is using an array of strings and then pulling data tokens from those strings when needed.

I'd prefer to insulate myself against that problem by loading only the colony data being used currently by the system. I'd like to be able to index all the systems into a single table file, but that requires me to load all of the data and rewrite the entire file from scratch each time and I believe a select and replace system would be more efficient because then I can localize all the data into a few files, instead of hundreds. (this makes overwriting save games a much easier task as well).

This doesn't seem to be a terribly efficient approach to the situation. Admittedly, I am learning all this trial by fire, so I might be missing something logic wise. Because I'm using a lot more hard images (not just low resolution tilesets) the images are a bit memory intense too and I want to keep things slim and sexy from the beginning, rather than trying to go back and fix all this at a later date.

Posted on 2009-10-19 07:42:04 (last edited on 2009-10-19 07:53:00)

Overkill

Oooh this project sounds pretty ambitious, you've explained your case well enough. :D

I'll see what I can do about adding a FILE_UPDATE mode or similar soon!

Posted on 2009-10-19 09:17:34

Sargana

Early screenshot looks like this:

http://i141.photobucket.com/albums/r44/Sargana/ss.png

Posted on 2009-10-20 05:22:05

Overkill

Your screenshot looks awesome, Sargana. Man, I still haven't had time to modify Verge. And it's an easy patch too :(

I wish the livelihood of Verge wasn't reliant on people who are always busy nowadays. Since this engine and community once had a lot to give.

Hopefully you're making progress despite current community deadness!

Posted on 2009-11-06 01:20:44

Sargana

Gradual progress is taking place, but I haven't had much time to work on it lately. Blame Torchlight.

Posted on 2009-11-08 01:20:07

zonker6666

Just wanted to say that I impressed with your ambitious undertake. I would like to have a look at what you have if yoiu have a working version (maybe give you some insights) if you're interestred. Good luck.

Posted on 2010-03-23 15:43:45


Displaying 1-8 of 8 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.