Tilemap scroll laggy (but not always)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Tabaqui
Prole
Posts: 5
Joined: Tue Mar 24, 2020 2:47 pm
Location: Italy

Tilemap scroll laggy (but not always)

Post by Tabaqui » Tue Mar 24, 2020 2:59 pm

Hi all! In the last week i've been trying to develop a 2d jrpg with love.
After completing the tilemap scrolling system, i've noticed that sometimes it is laggy (without framerate drop) and i can't understand why. I've tried "flooring" tile and characters coordinates without results, so i've decided to post here my project to see if it's just an impression or if it's a real problem.

The first tilemap is as big as the screen, so you won't see problems there, but if you speak with the female npc with brown hair (with z, enter or spacebar) you will be teleported, after a couple of italian dialogues, to a bigger area where the scrolling problems occurs.

If you want to take a look at the code (quite a lot of files) i think you should look "game/Area.lua", "game/Player.lua", "game/Character.lua" and "game/Tilemap.lua" first and then main.lua.

Thank you in advance

PS.
i don't own the graphics used in this game
Attachments
RPG.love
(262.35 KiB) Downloaded 33 times

User avatar
pgimeno
Party member
Posts: 2029
Joined: Sun Oct 18, 2015 2:58 pm

Re: Tilemap scroll laggy (but not always)

Post by pgimeno » Wed Mar 25, 2020 2:29 am

Hi Tabaqui, welcome to the forums!

I don't see lag, I see tearing problems inherent to having vsync off. Enabling vsync solved them for me. Have you tried that already?

Tabaqui
Prole
Posts: 5
Joined: Tue Mar 24, 2020 2:47 pm
Location: Italy

Re: Tilemap scroll laggy (but not always)

Post by Tabaqui » Wed Mar 25, 2020 3:16 pm

Thank you, vsync seems to do the trick. Is vsync always capping fps at 60 on every system or should i start using dt to have the game running at constant speed everywhere? Thanks in advance

User avatar
Varkas
Prole
Posts: 32
Joined: Mon Mar 09, 2020 2:26 pm

Re: Tilemap scroll laggy (but not always)

Post by Varkas » Wed Mar 25, 2020 3:21 pm

VSync depends on the refresh rate of the screen. 60Hz is a frequent number, but 50 and 70 are too, and I think modern screens offer up 200. So, no, vsync doesn't cap at 60 FPS, it depends on the screen and the screen settings.
In soviet russia, code debugs you.

User avatar
pgimeno
Party member
Posts: 2029
Joined: Sun Oct 18, 2015 2:58 pm

Re: Tilemap scroll laggy (but not always)

Post by pgimeno » Wed Mar 25, 2020 5:38 pm

See e.g. https://www.maketecheasier.com/what-is-vsync/

Vsync or not vsync? Well, with vsync, you can't quantify how well is your program able to keep up with a normal monitor's refresh rate. Without vsync, you don't see the game as it is designed to work, and the tearing appears.

So, you probably want to use a key to toggle it, to let you monitor your FPS.

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests