Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

LargeVolume on VS2012
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=540
Page 2 of 2

Author:  David Williams [ Wed Sep 25, 2013 9:11 am ]
Post subject:  Re: LargeVolume on VS2012

I'm afraid I don't have much insight here - the exception in question is thrown from here:

Code:
FILE* pFile = fopen(filename.c_str(), "wb");
if(!pFile)
{
   POLYVOX_THROW(std::runtime_error, "Unable to open file to write out block data.");
}


so basically fopen() is apparently failing. A few points to try:

1) Try changing fopen_s() back to fopen(). You can ignore the warnings which Visual Studio gives. Perhaps the '_s' version has some different behaviour?

2) Can you step into the code and verify that 'filename' is valid?

3) Are you running from a folder where you have write access? Not in 'Program Files' or something?

4) Any chance it fails to open because it's already open? This could somehow be a big in PolyVox. Does it fail the first time it hits that line?

Author:  tacospice [ Tue Dec 31, 2013 12:06 pm ]
Post subject:  Re: LargeVolume on VS2012

Since I created the thread, maybe I should chime in again (I've been occupied with a bunch of other projects).

I got the develop branch to compile and run now. I have some questions though.
I never used the LargeVolume before, just SimpleVolume. Should the FilePager store blocks permanently or is it just temporary? Right now I just tried doing this:

Code:
MaterialDensityPair88 voxel;
voxel.setDensity(MaterialDensityPair88::getMaxDensity());
voxel.setMaterial(1);

largeVolume->setVoxelAt(Vector3DInt32(0, 0, 0), voxel);

largeVolume->flushAll();


I get a temporary file that represents the valid region, but it's deleted after I close the program. Should I take care of storing the entire world data myself? (I think probably, but I'm not sure)
Should I just consider the FilePager a sample implementation?

Another minor thing, the FilePager destructor says
Quote:
Failed to delete 'data/blocks/5170-0_0_0_31_31_31' when destroying FilePager
even though the file is deleted.

Author:  David Williams [ Wed Jan 01, 2014 7:22 pm ]
Post subject:  Re: LargeVolume on VS2012

tacospice wrote:
Should the FilePager store blocks permanently or is it just temporary? ... Should I just consider the FilePager a sample implementation?

Yes, the FilePager is just a sample. In practice you might want to save the data to a network, server, database, or whatever. Or you might not save it at all - if your world is procedurally generated then maybe you can just generate it again of demand.

The Pager mechanism just provides a way for the LargeVolume to cope with running out of memory. It hands the data off to you on the understanding that you will be able to provide that data again later. How you actually do this is up to you.

It's not intended as a serialization mechanism though you can abuse it for this purpose (and we do so in Cubiquity by storing the paged blocks into an SQLite database).

tacospice wrote:
Another minor thing, the FilePager destructor says
Quote:
Failed to delete 'data/blocks/5170-0_0_0_31_31_31' when destroying FilePager
even though the file is deleted.


I'm not sure... perhaps the file never got created? Or the deletion is delayed until the file is freed? Unfortunately standard C++ provides only very limited file access (e.g. you can't create directories, which is why we prepend the random number so that multiple runs don't confuse each others data). Boost.Filesystem is a better solution but we didn't want the dependency for something which users will override anyway.

Page 2 of 2 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/