Imagebuttons causing lag when hovering
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.
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.
- MidnightREN
- Newbie
- Posts: 6
- Joined: Mon Nov 09, 2020 9:24 pm
- Contact:
Imagebuttons causing lag when hovering
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.
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.
- m_from_space
- Veteran
- Posts: 302
- Joined: Sun Feb 21, 2021 3:36 am
- Contact:
Re: Imagebuttons causing lag when hovering
Can you show us the code that defines those images and the code of the imagebuttons?
- MidnightREN
- Newbie
- Posts: 6
- Joined: Mon Nov 09, 2020 9:24 pm
- Contact:
Re: Imagebuttons causing lag when hovering
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
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
- 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
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
- 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
As laure44 said, focus_mask True wrecks perfomance if used with large images.
< < insert Rick Cook quote here > >
- MidnightREN
- Newbie
- Posts: 6
- Joined: Mon Nov 09, 2020 9:24 pm
- Contact:
Re: Imagebuttons causing lag when hovering
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
Thank you all for your feedback
- 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
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 > >
Who is online
Users browsing this forum: No registered users