Just wondering about possible resource problems if I create a large tile map from a sprite sheet.
If I create a 100 * 100 tile map from images held in a sprite sheet does it mean I will have a single image in memory or 10,000? [import]uid: 9371 topic_id: 4027 reply_id: 304027[/import]
That’s not quite right. he’s talking about taking a sprite sheet and rendering a tile map of multiple sprites. I don’t know what corona does internally but even if it did render this group as a new texture there’d still be a dinension limit (1024x1024 or something like that?). The answer is we don’t really know how coronas rendering techniques work, you’ll have to wait for ansca to answer this [import]uid: 6645 topic_id: 4027 reply_id: 12318[/import]
Sorry, I misinterpreted what he wrote. Actually, Corona is pretty smart when it comes to reusing objects. For example, right now I’m building an diamond isometric tiler and there’s no difference in the texture memory usage between 10 or 100 tiles on screen. [import]uid: 11024 topic_id: 4027 reply_id: 12324[/import]
Of course there is no texture memory difference because the image just needs to be loaded once only -but much more interesting is how sprite sheet tiles behave performance-wise. Does it cost more performance than handling “single” images?
I wonder if there’s an ANSCA programmer around here which could give us some technical “under the hood” details on how Corona manages graphics and how efficient sprite sheets are from an internal sight.
I’d also be interested if we should care about draw calls (texture swaps) in Corona. If so, it wouldn’t be recommended to use many different single images. It would be better then to collect all images in texture atlases (sprite sheets). [import]uid: 9644 topic_id: 4027 reply_id: 12325[/import]
I’ve asked Ansca and will post the answer here. I’m porting a game I wrote for Windows Mobile (also written in a Lua framework) that uses this technique and it runs fine with large tile maps but how that implemented under the covers compared with Cotrona I have no idea.
Yes the performance is noticeably worse, especially on the device. Partially dependent on your implementation and working around the encapsulation of the fps forced timer and most functions in corona.
I’ve separated calculations and functions that force immediate draws with a time-based loop within my run time and it works alright at 30fps with moving 250 tile objects on screen.
They don’t recommend this approach (saying you should use transition.to instead of manually moving objects) but when using a joystick, there isn’t much choice. [import]uid: 11024 topic_id: 4027 reply_id: 12379[/import]
@finnk: did you move the objects individually or did you put them into a group and move that single group then? I wonder if performance could be improved by grouping objects and moving them as a group. [import]uid: 9644 topic_id: 4027 reply_id: 12420[/import]
They’re moved as a group. I’m actually pretty happy with that performance. Getting 500 onscreen tiles to move at 24fps is not bad, but I think I can do better.
I’m just not familiar with the event listeners all doing their own thing so I have to rethink my design approach. My problem is partially in using the runtime as a game loop. It’s forced to the config FPS so no matter what, you only get 60 or 30 updates/second. As you can guess, forcibly translating the objects by x and y at this rate of update is kind of odd. That’s fine for drawing, but for calculations, it gets weird. If I used a closed while loop, I can get 17000 updates, but then none of the listeners work and the Corona simulator can’t even quit via its own shortcuts.
I believe that if I use transition.to, I should have no problems though. Currently rebuilding this engine from the bottom up.
[import]uid: 11024 topic_id: 4027 reply_id: 12421[/import]
I still think it would be very useful if Ansca could give us an example of how to sue tile sheets [import]uid: 9371 topic_id: 4027 reply_id: 12427[/import]
Yeah I think I might have been better off controlling this manually.
The framerate seems consistent with the device performance, but it’s jittery animation. [import]uid: 11024 topic_id: 4027 reply_id: 12479[/import]
i’m rendering tiles in my setup and setting them to isVisible=false,
then in my update I check tiles are within the screen area and set isVisible=true… now here’s the odd thing, if i say “else tile.isVisible=false” then my fps slows down from 60 to 30