[FIXED] Saving/Loading terrain bug
#1
Terrain is not always saved, and my changes to the terrain are not permanent.

I build some stuff, disconnect and reconnect and all my stuff is gone!
Also, terrain keeps generating even though it has been generated before.

Something's off, and I don't know where to look
Reply
Thanks given by:
#2
I'm working on this right now.
Generally the problem is that chunks are queued for saving and then immediately unloaded, before they are saved; then the save thread asks for the chunk data and finds out there's no chunk, so it silently bails out Wink
Reply
Thanks given by:
#3
I'm still looking at what's going on and changing stuff (not committing).

I noticed in cChunkMap::cChunkLayer::UnloadUnusedChunks() that it unloads chunks without saving, would queuing them for saving result in what you're saying?


EDIT: I just added World->GetStorage().QueueSaveChunk(m_Chunks[i]); before m_Chunks[i].reset() and it saves it just fine after some tests.

However maybe it would once in a while unload a chunk before saving it, and losing the changes?
Reply
Thanks given by:
#4
Your edit is correct, but since I'm trying to remove cChunkPtr's from everywhere, it's not the path I've taken.

Instead I'm marking chunks as dirty, and unloading skips dirty chunks.

This way the world storage need not store cChunkPtrs but rather cChunkCoords, asking the world for the actual chunks when they are to be really saved.
Reply
Thanks given by:
#5
Why do all the time is generated map?? decide to have this problem
Reply
Thanks given by:
#6
I'll just commit this small change if you don't mind, then it'll be working at least.
Reply
Thanks given by:
#7
(02-16-2012, 11:05 PM)Bookkc Wrote: Why do all the time is generated map?? decide to have this problem

Update to r272 and it should work Smile
Reply
Thanks given by:
#8
Saving and loading should now (r273) work.

The only problem I've run into so far is that changes to chests, furnaces and signs don't get saved unless the terrain in the same chunk is changed in some way, too. I haven't yet found a way to mark the chunk as dirty when the player is using any block-entity window.
Reply
Thanks given by:
#9
(02-16-2012, 11:24 PM)FakeTruth Wrote:
(02-16-2012, 11:05 PM)Bookkc Wrote: Why do all the time is generated map?? decide to have this problem

Update to r272 and it should work Smile

Compiling please for windows Smile
[16:12:57] Generating chunk [19, 30]
[16:12:58] Generating chunk [6, 24]
[16:12:59] Generating chunk [17, 20]
[16:13:00] Generating chunk [6, 30]
[16:13:01] Generating chunk [6, 22]
[16:13:02] Generating chunk [17, 21]
[16:13:03] Generating chunk [25, 39]
[16:13:04] Generating chunk [16, 36]
[16:13:04] Generating chunk [6, 38]
[16:13:06] Generating chunk [18, 21]
[16:13:07] Generating chunk [25, 32]
[16:13:07] Generating chunk [16, 37]
[16:13:08] Generating chunk [7, 26]
[16:13:09] Generating chunk [18, 39]
[16:13:10] Generating chunk [13, 36]
[16:13:11] Generating chunk [25, 24]
[16:13:11] Generating chunk [17, 35]
[16:13:12] Generating chunk [11, 38]
[16:13:13] Generating chunk [7, 31]
[16:13:14] Generating chunk [20, 26]
[16:13:15] Generating chunk [11, 37]
[16:13:15] Generating chunk [23, 23]
[16:13:16] Generating chunk [13, 22]


no. dont workSad Fix it ! my cpu is load in 100%
Reply
Thanks given by:
#10
I don't quite see what your problem is. Of course the chunks need to be generated when you start the server and the world doesn't contain them. There's no duplicates in your list, so I really don't know what you're complaining about.

CPU at 100 % is quite right when generating chunks, supposing you have a single-core machine. The chunk generating thread is running at full speed. Once it stops generating chunks, your CPU usage should drop.
oh, I see now. When the chunk is generated, it is not marked dirty, therefore not saved until you actually make a change to it. I'll fix that.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)