Imagebuttons causing lag when hovering

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
User avatar
MidnightREN
Newbie
Posts: 6
Joined: Mon Nov 09, 2020 9:24 pm
Contact:

Imagebuttons causing lag when hovering

#1 Post by MidnightREN » Tue Jul 26, 2022 10:00 am

So I'm trying to make a sort of overworld map in one of my games. I have the base layer of the map, and then the buildings on top as imagebuttons.

When my mouse drags over the buttons however, it takes them a long time to register and display the 'hover' version of the button, anywhere between 3/4ths of a second or up to 3 seconds in some extreme cases. I used imagebuttons for the game's main menu UI and those seem perfectly responsive, so I'm not sure what's causing this to lag.

I have a fairly good computer (RTX3080, 32gigs of ram), definitely nothing that would lag on something like this, so I doubt its hardware issues on my end.

The images were originally 1920x1080 to save time on fiddling with xpos and ypos and getting them to line up, but when I made the buttons much smaller to see if it helped, there was no difference in performance. Any ideas as to what i could be doing wrong?

Thank you.

User avatar
m_from_space
Veteran
Posts: 302
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Imagebuttons causing lag when hovering

#2 Post by m_from_space » Tue Jul 26, 2022 12:50 pm

Can you show us the code that defines those images and the code of the imagebuttons?

User avatar
MidnightREN
Newbie
Posts: 6
Joined: Mon Nov 09, 2020 9:24 pm
Contact:

Re: Imagebuttons causing lag when hovering

#3 Post by MidnightREN » Tue Jul 26, 2022 2:33 pm

imagebutton:
xpos 0
ypos 0
idle "images/mainpalacebuttonidle.png"
hover "images/mainpalacebuttonhover.png"
focus_mask True
action Jump("palacescene")

not sure why the indentation isnt working, but it's indented properly in the editor

User avatar
laure44
Regular
Posts: 60
Joined: Mon Mar 08, 2021 10:55 pm
Projects: Arkan'sTower, Gemshine Lorelei!
Location: France
Contact:

Re: Imagebuttons causing lag when hovering

#4 Post by laure44 » Tue Jul 26, 2022 3:18 pm

I used to have some problems with focus_mask True, and have seem a lot of people getting issues with it as well. I don't have it anymore though, maybe a Renpy update solved it. Try turning focus_mask off and see if the problem persists

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Imagebuttons causing lag when hovering

#5 Post by Ocelot » Tue Jul 26, 2022 4:51 pm

As laure44 said, focus_mask True wrecks perfomance if used with large images.
< < insert Rick Cook quote here > >

User avatar
MidnightREN
Newbie
Posts: 6
Joined: Mon Nov 09, 2020 9:24 pm
Contact:

Re: Imagebuttons causing lag when hovering

#6 Post by MidnightREN » Tue Jul 26, 2022 4:54 pm

It does complicated my process, but indeed turning off focus mask pretty much solves this issue. The issue being that the map is isometric so now selection is a bit weird. Oh well, I'll figure out a different solution to solve the extra area that's selectable, and make sure to not have isometric maps in any future games for sure.

Thank you all for your feedback

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Imagebuttons causing lag when hovering

#7 Post by Ocelot » Tue Jul 26, 2022 5:01 pm

You can pass a function, which will figure out, if button is focused or not. Some simple math later, and you get a pretty good approximation of your displayable shape.
< < insert Rick Cook quote here > >

Post Reply

Who is online

Users browsing this forum: No registered users