Performance issue running simple love game

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.
chute
Prole
Posts: 18
Joined: Sat Sep 17, 2011 6:49 pm

Performance issue running simple love game

Post by chute »

Edit: it seems to be an issue with my system, even though it's plenty powerful enough. more info 7 posts down.






Hi all,

I'm new to love development and game development in general. I'm trying to create a tile-based scroller and I'm running into some problems.

I want to create a rather detailed map with several layers of tiles. Here's what I have so far:

-a tile library of ~4200 32x32 tiles loaded as individual images into a table (ie. tile[1] -> tile[4200])
-a 40x30 map with about 16 drawn layers, each layer being a table containing a table for each horizontal line (like the tile based scrolling tutorials)
-code that will draw the map tile by tile, layer by layer
-smooth scrolling of movement

The map draws, but when you move around the game seems to "freeze" when loading new lines, and the freezing seems to get worse as time passes.

I've trimmed down the tiles table so that it will only load tiles that are displayed on the current map (about 300, in the attached example), but that did not help. some of the tiles are still at high indexes though (ie "tile[4000]"). I don't know if that's a problem.

I've cut down the number of layers in the map to 5, but that only seems to stem the tide.

I've checked and rechecked that no newImage or other potentially draining functions are being called in love.draw or love.update.

When sitting still or moving about normally love seems to take about 10-15% CPU and 25 megs of memory. When it "freezes", CPU drops to 0-2% but memory stays constant.

I'm at a loss. I've attached what I have so far, if anyone cares to take a look.

Thanks in advance!
Last edited by chute on Tue Jul 17, 2012 8:58 pm, edited 2 times in total.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Performance issue with layered map & lots of tiles

Post by josefnpat »

chute wrote:Hi all,

I'm new to love development and game development in general. I'm trying to create a tile-based scroller and I'm running into some problems.

I want to create a rather detailed map with several layers of tiles. Here's what I have so far:

-a tile library of ~4200 32x32 tiles loaded as individual images into a table (ie. tile[1] -> tile[4200])
-a 40x30 map with about 16 drawn layers, each layer being a table containing a table for each horizontal line (like the tile based scrolling tutorials)
-code that will draw the map tile by tile, layer by layer
-smooth scrolling of movement

The map draws, but when you move around the game seems to "freeze" when loading new lines, and the freezing seems to get worse as time passes.

I've trimmed down the tiles table so that it will only load tiles that are displayed on the current map (about 300, in the attached example), but that did not help. some of the tiles are still at high indexes though (ie "tile[4000]"). I don't know if that's a problem.

I've cut down the number of layers in the map to 5, but that only seems to stem the tide.

I've checked and rechecked that no newImage or other potentially draining functions are being called in love.draw or love.update.

When sitting still or moving about normally love seems to take about 10-15% CPU and 25 megs of memory. When it "freezes", CPU drops to 0-2% but memory stays constant.

I'm at a loss. I've attached what I have so far, if anyone cares to take a look.

Thanks in advance!

I'm not having any problems at all :( Can you provide steps to reproduce your issue?
0mloc.png
0mloc.png (108.55 KiB) Viewed 553 times
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
chute
Prole
Posts: 18
Joined: Sat Sep 17, 2011 6:49 pm

Re: Performance issue with layered map & lots of tiles

Post by chute »

try doing a full run around the edge of the map (don't go off the edge ;) )
chute
Prole
Posts: 18
Joined: Sat Sep 17, 2011 6:49 pm

Re: Performance issue with layered map & lots of tiles

Post by chute »

ok, just tried it on my crappy Craptop(tm) and it works fine there.

I guess it's time for a reboot...
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Performance issue with layered map & lots of tiles

Post by josefnpat »

chute wrote:try doing a full run around the edge of the map (don't go off the edge ;) )
I walked all the way around the edge of the map, and added a fps graph, and still am not having any issue. Perhaps your hardware isn't as up to date as you would like?
p63Zp.png
p63Zp.png (13.26 KiB) Viewed 554 times
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
chute
Prole
Posts: 18
Joined: Sat Sep 17, 2011 6:49 pm

Re: Performance issue with layered map & lots of tiles

Post by chute »

I have an AMD Phenom 2 quad core and a Radeon 5870.

That shouldn't matter though, as I've tried the code on an old laptop running a P3 with intel graphics -- it works fine on that machine.

I've rebooted. I've closed all programs (even dropbox, teamviewer, etc.). I've updated video card drivers. I'm running the latest love.

I will try running some other .love games to see if there are performance issues with them.

any ideas?
chute
Prole
Posts: 18
Joined: Sat Sep 17, 2011 6:49 pm

Re: Performance issue running simple love game

Post by chute »

ahhh! I've tried several projects from the demo forum. Mario Kart racing, fruitless, motion blur demo, relentless, TAOTRTWGE, and an unnamed topscrolling shooter.

none of them have any performance problems. Is there anything else i can try?
chute
Prole
Posts: 18
Joined: Sat Sep 17, 2011 6:49 pm

Re: Performance issue running simple love game

Post by chute »

ok, I've tried just running love.exe to get the rubber piggy demo.

I watched it for a while and it freezes too. About once every 10-30 seconds.

I really don't want to reinstall windows :/
chute
Prole
Posts: 18
Joined: Sat Sep 17, 2011 6:49 pm

Re: Performance issue running simple love game

Post by chute »

I have also played several other retail games recently as well (penny arcade 3, quantum conundrum, arkham asylum, braid) with no problem. No freezes, high framerates.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Performance issue running simple love game

Post by josefnpat »

See if you can update your video card drivers.

After that, perhaps boot into a Linux liveCD, and see if it really is your hardware?
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 3 guests