Lag in ATL transform script ,please help me.[Solve]

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Sirin
Regular
Posts: 39
Joined: Mon Jul 13, 2009 10:16 am
Contact:

Lag in ATL transform script ,please help me.[Solve]

#1 Post by Sirin » Tue Mar 18, 2014 1:08 pm

Hi! everyone.

I want to use ATL to move displayable in the screen, but after use "Transform" statement my displayable move with lag(it seem like hiccups) while the transform is continue until the end of transform.

this my Transform code :

Code: Select all

transform unit_move(ox,oy,nx,ny,tm):
    xpos ox ypos oy
    linear tm xpos nx ypos ny

and this when i use it.

Code: Select all

# in game
    ox,oy = 100,50
    nx,ny = 300,100
    tm = 3
    ui.add('unit1',at=[unit_move(ox,oy,nx,ny,tm)])
    renpy.pause(tm)

i tried many way to fix it, use "config.image_cache_size = 30" ,"config.framerate = 50" , "renpy.free_memory()" , "renpy.predict()".

but...no anything change, I don't know what to do next to solve this problem.

Please tell me if it has another way to move a displayable(maybe use ATL or not).

p.s. my laptop that i coding this project is from 8 year ago.(and use software render)
Last edited by Sirin on Thu Mar 20, 2014 9:14 am, edited 2 times in total.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Lag in ATL script ,please help me.

#2 Post by xela » Tue Mar 18, 2014 2:21 pm

Like what we're doing? Support us at:
Image

User avatar
xavimat
Eileen-Class Veteran
Posts: 1458
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Lag in ATL script ,please help me.

#3 Post by xavimat » Tue Mar 18, 2014 4:51 pm

Try adding

Code: Select all

subpixel True
to the transform.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Sirin
Regular
Posts: 39
Joined: Mon Jul 13, 2009 10:16 am
Contact:

Re: Lag in ATL script ,please help me.

#4 Post by Sirin » Tue Mar 18, 2014 9:18 pm

thank for you help Xela,Xavimat. but both way can't solve my problem either.

but I found something that may cause this problem. while run my project I saw CPU usage up to 50%+, if CPU usage more than 30%+ before displayable with transform appear that cause a lag but if I wait until CPU usage drop near 0% transform run smoothly as I wish.but in real situation the player can't wait that long(about2-3sec).

I don't know this problem appear because of my laptop performance or not. or it doesn't cause any problem with current PC and laptop' performance.

p.s.in previous version of renpy(like 6.9.0) it can run this transform without any lag,that why I very curious new version has this problem.

User avatar
Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Lag in ATL script ,please help me.

#5 Post by Asceai » Tue Mar 18, 2014 9:33 pm

A performance regression would seem like a bug. I'm interested now - wonder if something happened to pygame.

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Lag in ATL script ,please help me.

#6 Post by nyaatrap » Tue Mar 18, 2014 11:24 pm

Could you put show screen _image_load_log then watch something is loading or not?

Sirin
Regular
Posts: 39
Joined: Mon Jul 13, 2009 10:16 am
Contact:

Re: Lag in ATL script ,please help me.

#7 Post by Sirin » Tue Mar 18, 2014 11:52 pm

nyaatrap wrote:Could you put show screen _image_load_log then watch something is loading or not?
um...Nyaatrap-san I don't know how to do that because I'm a newbie with renpy.can you teach me how to see _image_load_log,I still have many thing to learn about renpy. ^_^

User avatar
Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Lag in ATL script ,please help me.

#8 Post by Asceai » Wed Mar 19, 2014 12:29 am

Just that

Code: Select all

show screen _image_load_log
on a line in a ren'py script, e.g. after label start:

It will show you when images are loaded

Sirin
Regular
Posts: 39
Joined: Mon Jul 13, 2009 10:16 am
Contact:

Re: Lag in ATL script ,please help me.

#9 Post by Sirin » Wed Mar 19, 2014 12:36 am

Asceai wrote:Just that

Code: Select all

show screen _image_load_log
on a line in a ren'py script, e.g. after label start:

It will show you when images are loaded
Thank you Asceai!! I'll try and post the result in this night.

Sirin
Regular
Posts: 39
Joined: Mon Jul 13, 2009 10:16 am
Contact:

Re: Lag in ATL script ,please help me.

#10 Post by Sirin » Wed Mar 19, 2014 8:54 am

This's cap screen Image_load_log while I was testing Transform statement.


It has only one displayable and transparent_tile(default screen of renpy).
I'm worry about it if lag occur with merely few displayable(and if I add lot of displayable in full version I don't want to think what will happen :( )
image_load_log.JPG

this is script and config.(I tried both way that used ATL and old method that xela and xavimat told me)
code.JPG


P.S.If anyone try this way and transform's lag didn't occur please tell me,I'll conclude it that only because of my laptop's performance is not high enough to handle it.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Lag in ATL transform script ,please help me.

#11 Post by xela » Wed Mar 19, 2014 12:30 pm

There is no delay that I could see even with software rendering.
Like what we're doing? Support us at:
Image

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Lag in ATL transform script ,please help me.

#12 Post by Alex » Wed Mar 19, 2014 2:22 pm

Do you have anything else after these lines of code? Ren'Py preloading images, so if you gonna show rather big image in next few lines of code then this might be the issue.

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Lag in ATL transform script ,please help me.

#13 Post by nyaatrap » Wed Mar 19, 2014 7:58 pm

Firstly, better not to use ren'py.free_memory. It reinforces whole caching process. Secondly, put renpy.predict out side of python block one sentence before. One line $renpy.predict is better and should be placed before the line "test".

Sirin
Regular
Posts: 39
Joined: Mon Jul 13, 2009 10:16 am
Contact:

Re: Lag in ATL transform script ,please help me.

#14 Post by Sirin » Thu Mar 20, 2014 9:13 am

Sorry for my late.
xela wrote:There is no delay that I could see even with software rendering.
Oh!! Thank Xela. That mean I don't worry about player's pc ,smartphone or anything else they have. :D

nyaatrap wrote:Firstly, better not to use ren'py.free_memory. It reinforces whole caching process. Secondly, put renpy.predict out side of python block one sentence before. One line $renpy.predict is better and should be placed before the line "test".
Thank you for your advise Nyaatrap.I'll fix it instantly.

Alex wrote:Do you have anything else after these lines of code? Ren'Py preloading images, so if you gonna show rather big image in next few lines of code then this might be the issue.
I have some script and function that testing about battle screen after this line.




....after I move script and function out transform run smoothly as i want.(I think this is real problem)
Thank you so much Alex , Xela , Nyaatrap , Xavimat ,Asceai. You guy help me alot,Thank you :D



at least this's a gift for everyone(or may not be that worth,i'm not sure :wink: )
...she's one of main heroine from my current project....but it just still a doodle sketch.
gib19.jpg

User avatar
Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Lag in ATL transform script ,please help me.[Solve]

#15 Post by Asceai » Thu Mar 20, 2014 9:55 am

Aha, so preloading was getting you. Yeah, Ren'Py looks ahead to load images before you need them to keep things running smoothly, but occasionally that can screw you over.
You can try and fix this by using the _image_load_log and seeing what gets loaded during the transition, then renpy.predict()ing that image beforehand.

It's a great sketch. Love to see it when it's lined.

Post Reply

Who is online

Users browsing this forum: Hojoo