same code different result

Create fast, sprite powered games with Animation Engine, co-developed with DerBrill Software!

Moderators: heatherlaine, kevinmiller, robinmiller, malte

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: same code different result

Post by richmond62 » Mon Feb 07, 2022 1:24 pm

OK: have you checked your stack with both those versions?

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: same code different result

Post by Samuele » Mon Feb 07, 2022 3:35 pm

yes, did you have a chance to see the video?
Samuele.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: same code different result

Post by richmond62 » Mon Feb 07, 2022 3:42 pm

did you have a chance to see the video?
Yes, I did, and apart from the fact that you need to send 'Click me' back to a lower layer
I could not see anything wrong at all.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: same code different result

Post by jacque » Mon Feb 07, 2022 7:39 pm

stam wrote:
Mon Feb 07, 2022 1:57 am
I must say, i never really understood why LC will 'close' files but keep them open in memory. There must be a use-case for this, but none that affects me, so i have set my preferences to always close file (even if destroyStack is false) and to assign destroyStack to true for all new stacks, so closing them removes the from memory as well.
I set my prefs the same way, all my stacks are removed from memory when closed. The default behavior dates back to ancient times when computers were older and slower, and increasing computer RAM was prohibitively expensive. Recreating the window structure was time-consuming and so was recreating the content, so to speed up screen rendering we were given the choice to leave it in memory, or remove the content and leave the window structure, or to remove both. It isn't very relevant today because everything is much faster and any difference isn't usually noticeable.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: same code different result

Post by jacque » Mon Feb 07, 2022 7:48 pm

I just looked at the sample Menu stack, and since don't have AE both buttons were very jerky. I wonder why the stack doesn't just use the built-in "move" command, it should behave very well. I vaguely recall that didn't work for some reason but I don't remember why.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: same code different result

Post by Samuele » Mon Feb 07, 2022 8:24 pm

richmond62 wrote:
Mon Feb 07, 2022 3:42 pm
did you have a chance to see the video?
Yes, I did, and apart from the fact that you need to send 'Click me' back to a lower layer
I could not see anything wrong at all.
the problem is that the menu at the bottom of the stack moves in jerks, unlike the top menu that moves smoothly
Samuele.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: same code different result

Post by dunbarx » Mon Feb 07, 2022 10:28 pm

So I tried the same handler in the group script but applied to a single button. It moves smoothly. I have moved groups of objects before and, though never lots and lots of children in them, they have always moved nicely. I just tried it again.

Is there something in the group here that is so "heavy" it cannot get up and go?

Craig
Last edited by dunbarx on Mon Feb 07, 2022 11:35 pm, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: same code different result

Post by dunbarx » Mon Feb 07, 2022 10:43 pm

A group of images does not move smoothly with the move command. A handful of random imported images, grouped together and run with the handler from Samuele is very jerky.
Even one image is not particularly smooth.
A bunch of buttons is very smooth.

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: same code different result

Post by FourthWorld » Mon Feb 07, 2022 10:52 pm

Oddly enough, I've found smoother redraw by displaying a reference to the image as a button icon than displaying the image itself directly.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: same code different result

Post by Samuele » Tue Feb 08, 2022 1:02 am

it gives the same result if it's a single image (not grouped) or a group that contains buttons with icons :?
Samuele.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: same code different result

Post by richmond62 » Tue Feb 08, 2022 9:07 am

Have you tried the stack on an Android device or an Android emulator?

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: same code different result

Post by Samuele » Tue Feb 08, 2022 9:32 am

yes and oddly enough also there is jerky...
Samuele.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: same code different result

Post by richmond62 » Tue Feb 08, 2022 11:13 am

Have you tried my version on Android?

The whole thing is very odd.

Certainly the ONLY jerkiness I see over here on MacOS 12 is because:

Yours:

Code: Select all

global _gopenAndClose2

on mouseUp
   if _gopenAndClose2 = 0 
   then
      aeMoveTo the long id of image "menu2", -62, 312, 1000, "overshoot"
      put 1 into _gopenAndClose2
      #disable image "Menu"
   else 
      aeMoveTo the long id of image "menu2", 100, 300, 1000, "overshoot"
      put 0 into _gopenAndClose2
   end if
   //put _gopenAndClose into fld "MenuOpenAndClose"
   //save this stack
   //poi quando entra nel card aloora metti il field nel variable
end mouseUp
You move the vertical position of your image 'menu2' by 12 pixels, and that does NOT
happen smoothly, but as a jerk at one point.

My version does NOT move the vertical position, and I can see no jerkiness.

I also wonder of the "overshoot' doesn't cause problems.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3990
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: same code different result

Post by bn » Tue Feb 08, 2022 7:17 pm

Hi Samuele,

I think that the reason why the composed image moves worst than the one image is the fact that apparently Livecode has trouble moving those 6 images in sync.

I scaled your images to their original size and then took a snapshot from the group they were in. Then I scaled down the one resulting image to approximately the size of your multi image group.
For "button" function I overlayed the image with buttons. The right most is the one with the script.

Animating the newly created "one-image" group is a lot smoother then the multi-image group.

Kind regards
Bernd
Attachments
animateImage.livecode.zip
(56.9 KiB) Downloaded 101 times

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: same code different result

Post by jacque » Tue Feb 08, 2022 8:55 pm

dunbarx wrote:
Mon Feb 07, 2022 10:43 pm
A group of images does not move smoothly with the move command. A handful of random imported images, grouped together and run with the handler from Samuele is very jerky.
This is what layerMode is for. The group's layerMode should be set to "dynamic" which will cache the contents and allow it to travel smoothly.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Animation Engine”