diff --git a/app/lib/Angel.coffee b/app/lib/Angel.coffee index 39059ea7b..c2286bd0b 100644 --- a/app/lib/Angel.coffee +++ b/app/lib/Angel.coffee @@ -119,13 +119,12 @@ module.exports = class Angel extends CocoClass return if @aborting # Toggle BOX2D_ENABLED during deserialization so that if we have box2d in the namespace, the Collides Components still don't try to create bodies for deserialized Thangs upon attachment. window.BOX2D_ENABLED = false - World.deserialize serialized, @shared.worldClassMap, @shared.lastSerializedWorldFrames, @finishBeholdingWorld(goalStates), startFrame, endFrame, streamingWorld + @streamingWorld = World.deserialize serialized, @shared.worldClassMap, @shared.lastSerializedWorldFrames, @finishBeholdingWorld(goalStates), startFrame, endFrame, streamingWorld window.BOX2D_ENABLED = true @shared.lastSerializedWorldFrames = serialized.frames finishBeholdingWorld: (goalStates) -> (world) => return if @aborting - @streamingWorld = world finished = world.frames.length is world.totalFrames firstChangedFrame = world.findFirstChangedFrame @shared.world eventType = if finished then 'god:new-world-created' else 'god:streaming-world-updated' @@ -208,6 +207,8 @@ module.exports = class Angel extends CocoClass @say 'Fired worker.' @initialized = false @work = null + @streamingWorld = null + @deserializationQueue = null @hireWorker() if rehire hireWorker: -> diff --git a/app/lib/world/world.coffee b/app/lib/world/world.coffee index d95abc472..f0cad15a0 100644 --- a/app/lib/world/world.coffee +++ b/app/lib/world/world.coffee @@ -364,7 +364,6 @@ module.exports = class World o.trackedPropertiesPerThangValuesOffsets = [] # Needed to reconstruct ArrayBufferViews on other end, since Firefox has bugs transfering those: https://bugzilla.mozilla.org/show_bug.cgi?id=841904 and https://bugzilla.mozilla.org/show_bug.cgi?id=861925 # Actually, as of January 2014, it should be fixed. So we could try to undo the workaround. transferableStorageBytesNeeded = 0 nFrames = endFrame - startFrame - streaming = nFrames < @totalFrames for thang in @thangs # Don't serialize empty trackedProperties for stateless Thangs which haven't changed (like obstacles). # Check both, since sometimes people mark stateless Thangs but then change them, and those should still be tracked, and the inverse doesn't work on the other end (we'll just think it doesn't exist then). @@ -477,6 +476,7 @@ module.exports = class World w.frames = [] unless streamingWorld clearTimeout @deserializationTimeout if @deserializationTimeout @deserializationTimeout = _.delay @deserializeSomeFrames, 1, o, w, finishedWorldCallback, perf, startFrame, endFrame + w # Return in-progress deserializing world # Spread deserialization out across multiple calls so the interface stays responsive @deserializeSomeFrames: (o, w, finishedWorldCallback, perf, startFrame, endFrame) =>