reloadScene flickers

Hi guys!

Just updated to 2012.781 and love the new reloadScene method. I really have some use for it. However I’m experiencing som screen flicker while using this method. Also the gotoScene now loads the reload if the scene is the current loaded.

Is it possible to get this sorted out? [import]uid: 106083 topic_id: 24632 reply_id: 324632[/import]

Hey,

We’re aware of the flicker bug and we’re working to resolve it, it has already been logged in fogbugz.

Peach :slight_smile: [import]uid: 52491 topic_id: 24632 reply_id: 99801[/import]

Ah! Great news and thank you for updating me. [import]uid: 106083 topic_id: 24632 reply_id: 99831[/import]

@Peach

Do you know if there is any known case about the reloadScene to not purge the physics objects?

In my project I’m using the physics engine and using gotoScene to reload current scene with 2012.777 works like a charm

While using 2012.781 I get a very strange result while reloading the scene. The physics engine returns a numeric value for my joints instead of the resource object.

/J [import]uid: 106083 topic_id: 24632 reply_id: 100000[/import]

I haven’t seen this bug, no, although it may exist. (We’re working on making bugs easier to find/address quickly as you may have noted from the blog post today.)

If you have a sample project showing the issue you could zip and submit as a bug that would be useful :slight_smile: [import]uid: 52491 topic_id: 24632 reply_id: 100046[/import]

I’ll try to generate the bug again with an new empty project. I’ll get back to you with that :slight_smile:
[import]uid: 106083 topic_id: 24632 reply_id: 100142[/import]

I’ll try to generate the bug again with an new empty project. I’ll get back to you with that :slight_smile:
[import]uid: 106083 topic_id: 24632 reply_id: 100143[/import]

Hey Peach! I found the reason for my flickering and physics issue. When I did the GotoScene in previous version I had to run purgeScene(“scene1”) in exitScene.

Once i removed it works as expected! [import]uid: 106083 topic_id: 24632 reply_id: 100348[/import]

Hi again!

Sorry to say I still get some strange result. It seems to have something to do when I load the physics in the enterScene. Even if I destroy the objects it does not complete the structure.

Here is an example for you guys. Change out scene1.lua in you’r storyboard example and touch the background.

[code]


– scene1.lua


local storyboard = require( “storyboard” )
local scene = storyboard.newScene()

– Load physics
local physics = require(“physics”)
physics.start()
physics.setDrawMode( “hybrid” )


– BEGINNING OF YOUR IMPLEMENTATION

local image, text1, text2, text3, memTimer, test

– Touch event listener for background image
local function onSceneTouch( self, event )
if event.phase == “began” then

storyboard.reloadScene()

return true
end
end
– Called when the scene’s view does not exist:
function scene:createScene( event )
local screenGroup = self.view

image = display.newImage( “bg.jpg” )
screenGroup:insert( image )

image.touch = onSceneTouch

text1 = display.newText( “Scene 1”, 0, 0, native.systemFontBold, 24 )
text1:setTextColor( 255 )
text1:setReferencePoint( display.CenterReferencePoint )
text1.x, text1.y = display.contentWidth * 0.5, 50
screenGroup:insert( text1 )

text2 = display.newText( "MemUsage: ", 0, 0, native.systemFont, 16 )
text2:setTextColor( 255 )
text2:setReferencePoint( display.CenterReferencePoint )
text2.x, text2.y = display.contentWidth * 0.5, display.contentHeight * 0.5
screenGroup:insert( text2 )

text3 = display.newText( “Touch to continue.”, 0, 0, native.systemFontBold, 18 )
text3:setTextColor( 255 ); text3.isVisible = false
text3:setReferencePoint( display.CenterReferencePoint )
text3.x, text3.y = display.contentWidth * 0.5, display.contentHeight - 100
screenGroup:insert( text3 )

print( “\n1: createScene event”)

end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local screenGroup = self.view
print( “1: enterScene event” )

– Create physics
test = scene:createTest()
screenGroup:insert( test )

– remove previous scene’s view
storyboard.purgeScene( “scene4” )

– Update Lua memory text display
local showMem = function()
image:addEventListener( “touch”, image )
text3.isVisible = true
text2.text = text2.text … collectgarbage(“count”)/1000 … “MB”
text2.x = display.contentWidth * 0.5
end
memTimer = timer.performWithDelay( 1000, showMem, 1 )

end

function scene:createTest()

– Testing physics

local group = display.newGroup()

local ceiling = display.newRect (0, 0, display.contentWidth, 1)
ceiling:setFillColor(255,255,255,0)

– Add body
physics.addBody (ceiling, “static”, {bounce = 0.8, friction = 10})
group:insert(ceiling)

– Set some vars
local prevBody = ceiling
local x = 100
local y = 0
local w = 1
local h = 10
local currentY = y
local currentX = x

– Add rope
for i = 1, 6 do

local rope = display.newRect (x, y, w, h)
rope:setFillColor( 255, 255, 255)
physics.addBody( rope, { density=400, friction=0.8, bounce = 0 })

local joint = physics.newJoint( “pivot”, prevBody, rope, x, y )

group:insert(rope)

y = y + h
prevBody = rope
end

–Add head
local head = display.newCircle( x, y+12, 12 )
local r = head.height *0.4
group:insert(head)

physics.addBody( head, “dynamic”, { density=20, friction=1.0, bounce=.2, radius=r })
head.linearDamping = math.random(1,10)
head.angularDamping = .6

local headJoint = physics.newJoint( “pivot”, prevBody, head, x, y )
headJoint.dampingRatio = 1

y=y+24
prevBody=head

– Add body
local torso = display.newRect (x, y, 2, 50)

torso:rotate( headJoint.jointAngle )

physics.addBody( torso, { density=10, friction=0.8, bounce = 0 })
local joint = physics.newJoint( “weld”, head, torso, head.x, y )

group:insert(torso)

– Add clean up
group.remove = function()

if group.numChildren then
for i = group.numChildren, 1, -1 do
if group[i] then
group[i]:removeSelf()
group[i] = nil
end

end
end
end

return group

end

– Called when scene is about to move offscreen:
function scene:exitScene( event )

– Remove physics
test.remove()

print( “1: exitScene event” )

– remove touch listener for image
image:removeEventListener( “touch”, image )

– cancel timer
timer.cancel( memTimer ); memTimer = nil;

– reset label text
text2.text = "MemUsage: "
end
– Called prior to the removal of scene’s “view” (display group)
function scene:destroyScene( event )

print( “((destroying scene 1’s view))” )
end


– END OF YOUR IMPLEMENTATION

– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )

– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )

– “exitScene” event is dispatched before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )

– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )


return scene
[/code] [import]uid: 106083 topic_id: 24632 reply_id: 100388[/import]

That’s great news - did you ever file a bug report? If not, cool - if so, can you reply to the email you got when you filed it just to say what you wrote above? (This will automatically update the bug in fogbugz so whoever reviews it will have an easier time.)

Peach :slight_smile: [import]uid: 52491 topic_id: 24632 reply_id: 100397[/import]

Did’t file any bug report. Wasen’t 100% sure if it was my own fault or not. [import]uid: 106083 topic_id: 24632 reply_id: 100402[/import]

Hi Peach! Sorry to bother you here but do you know if there is any ETA on this issue? It’s a showstopper for me so I have to get it resolved soon :slight_smile:

/J [import]uid: 106083 topic_id: 24632 reply_id: 104358[/import]

We have some reports about flickering but I can’t see one related to reloadScene - did you end up filing? If not it wont be in the system and I can’t check the status of your particular bug. [import]uid: 52491 topic_id: 24632 reply_id: 104381[/import]

I solved the flickering issue but that i ment was the issue with reloading scenes that have a physicsobject. It seems that the phys engine stops working :frowning: [import]uid: 106083 topic_id: 24632 reply_id: 104385[/import]

Ah sorry I misunderstood; I haven’t seen any bug reports about the issue you refer to with physics. Did you file one with a test case we could run? I know I seem persistent in asking that but it’s important if there’s an issue so we can see and thus solve it.

Peach :slight_smile: [import]uid: 52491 topic_id: 24632 reply_id: 104587[/import]

I did an example for you guys :slight_smile:

Check it out here: http://developer.anscamobile.com/forum/2012/04/10/reloadscene-flickers#comment-100388

It’s based on the Storyboard example. [import]uid: 106083 topic_id: 24632 reply_id: 104589[/import]

What I mean is you need to actually file a bug if you haven’t already and attach a project we can run there - that way it gets assigned and can be tracked. The forum is more for discussing bugs, work arounds, confirming it is a bug, etc.

If you haven’t already please use the form; http://developer.anscamobile.com/content/bug-submission

Thanks,
Peach :slight_smile: [import]uid: 52491 topic_id: 24632 reply_id: 104807[/import]

I’m having the same flicker problem on the reload scene when I use purge scene with the Storyboard Reload scene method. I have to purge the scene or else it crashes. Has the flicker problem been fixed. I’m using v841. [import]uid: 8780 topic_id: 24632 reply_id: 113083[/import]

I’m seeing a flicker issue of a slightly different but annoying kind.
I’m not sure if this is a bug, similar to the flicker mentioned above or if I’m doing something wrong.
I have a scene up with a detailed single background image that I put up using display.newImageRect .

I’ve enabled different x / y coordinates for touch events. When a portion of the screen is touched I animate that touched image by playing a video in the exact same resolution as the newImageRect.
An example of what I’m doing is 90% of the video is exactly the same as the static background, but 10% of the video has cool aftereffects animations from the place where they touched.
The video shows an animation I created using Adobe aftereffects.
However, the media.playVideo causes an annoying and unprofessional screen flicker. The corona build I’m using is 2012.867 (2012.7.27)

Here is the code snip it .Perhaps what I want to do is just not possible…
The commented code in lines 5,6,8,9 show some things I tried to get the screen to not flicker. It also seems like the media.playVideo somehow changes the size of the video being played back…

1 local function onSceneTouch( self, event )
2 if event.phase == “began” and
3 ((event.xStart >= 1718 and event.xStart <= 2042 ) and
4 (event.yStart >= 438 and event.yStart <= 957 )) then
5 --storyboard.purgeScene( “scene-main-room” )
6 --image.isVisible = false
7 media.playVideo( “picture.mp4”, false )
8 --storyboard.gotoScene( “scene-main-room”)
9 --image.isVisible = true
10 return true
11 end
12 end
13
14
15 – Called when the scene’s view does not exist:
16 function scene:createScene( event )
17 local screenGroup = self.view
18
19 image = display.newImageRect( “insidehouse.png”, 2048, 1536)
20 image.x = display.contentWidth * 0.5
21 image.y = display.contentHeight * 0.5
22 screenGroup:insert( image )
23 image.touch = onSceneTouch
24 image:addEventListener( “touch”, image )

Many many thanks! [import]uid: 100134 topic_id: 24632 reply_id: 119821[/import]

I’m seeing a flicker issue of a slightly different but annoying kind.
I’m not sure if this is a bug, similar to the flicker mentioned above or if I’m doing something wrong.
I have a scene up with a detailed single background image that I put up using display.newImageRect .

I’ve enabled different x / y coordinates for touch events. When a portion of the screen is touched I animate that touched image by playing a video in the exact same resolution as the newImageRect.
An example of what I’m doing is 90% of the video is exactly the same as the static background, but 10% of the video has cool aftereffects animations from the place where they touched.
The video shows an animation I created using Adobe aftereffects.
However, the media.playVideo causes an annoying and unprofessional screen flicker. The corona build I’m using is 2012.867 (2012.7.27)

Here is the code snip it .Perhaps what I want to do is just not possible…
The commented code in lines 5,6,8,9 show some things I tried to get the screen to not flicker. It also seems like the media.playVideo somehow changes the size of the video being played back…

1 local function onSceneTouch( self, event )
2 if event.phase == “began” and
3 ((event.xStart >= 1718 and event.xStart <= 2042 ) and
4 (event.yStart >= 438 and event.yStart <= 957 )) then
5 --storyboard.purgeScene( “scene-main-room” )
6 --image.isVisible = false
7 media.playVideo( “picture.mp4”, false )
8 --storyboard.gotoScene( “scene-main-room”)
9 --image.isVisible = true
10 return true
11 end
12 end
13
14
15 – Called when the scene’s view does not exist:
16 function scene:createScene( event )
17 local screenGroup = self.view
18
19 image = display.newImageRect( “insidehouse.png”, 2048, 1536)
20 image.x = display.contentWidth * 0.5
21 image.y = display.contentHeight * 0.5
22 screenGroup:insert( image )
23 image.touch = onSceneTouch
24 image:addEventListener( “touch”, image )

Many many thanks! [import]uid: 100134 topic_id: 24632 reply_id: 119821[/import]