Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Re: Blazing Sprite and Tile Performance
Started by rbelluso Mar 14 2012 02:31 AM

- - - - -
55 replies to this topic
[TOPIC CONTROLS]
Page 2 of 3 1 2 3
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 365 posts
  • Corona SDK

Hi,

didn't get any follow up yet from your team on this subject.
I was thinking of another alternative, if you can provide one easily:
Allow a new method to compile a new image based on a display group or using some canvas-like solution and either allow to save it to disk or allow to use it as a regular image.

Using this, I can dynamically create a few large images from the non interactive layers, and load only them to the map instead of the thousands of tiles that were used to create them. This will reduce the tile count significantly on expanse of the texture memory used and load time. I've tested it manually and it shows better performance than current solution can provide on single core devices. Problem is, I can't do it on runtime.
uid: 118978 topic_id: 23302 reply_id: 111149


[TOPIC: post.html]
#27

Oaf

[GLOBAL: userInfoPane.html]
Oaf
  • Observer

  • 29 posts
  • Corona SDK

We're still waiting to hear back from Ansca. In the meantime, we've been evaluating all sorts of different engines. One in particular is looking very good, especially in terms of tilemap performance - I'll PM you details.

We also looked at the huge tile route - and you're right, it does definitely improve performance - but we found we couldn't implement the levels we wanted 'cos they just took up too many big tiles.

As for saving out to disk, I don't think you can do that under ios :(
uid: 276 topic_id: 23302 reply_id: 111154


[TOPIC: post.html]
#28

dingo

[GLOBAL: userInfoPane.html]
dingo
  • Contributor

  • 700 posts
  • Corona SDK

@Oaf: can u mail me your results too? info AT digidingo.com

thanks!
uid: 90610 topic_id: 23302 reply_id: 111156


[TOPIC: post.html]
#29

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 365 posts
  • Corona SDK

Hi, thanks. Please sent me your findings to info@tiltangames.com
uid: 118978 topic_id: 23302 reply_id: 111158


[TOPIC: post.html]
#30

nosheet

[GLOBAL: userInfoPane.html]
nosheet
  • Contributor

  • 149 posts
  • Corona SDK

Hi @Oaf, I would be very grateful if you could send your test results to me too: info AT no-sheet DOT com. Thanks a bunch! :)
uid: 80100 topic_id: 23302 reply_id: 111189


[TOPIC: post.html]
#31

walter

[GLOBAL: userInfoPane.html]
walter
  • Moderator

  • 726 posts
  • Alumni

Hi all, wanted to give a quick update.

As @oaf and @rune7 noticed, there are some culling issues when you move the scene.

The culling code itself has some unnecessary overhead (and the culling itself had bugs). Specifically, it's triggering extra calculations that shouldn't happen, so we're working on a fix. Right now, the changes look like they'll be fairly aggressive, so they won't make it into the next public release. Instead, we'll add them into a daily build soon after the public release.

As a side note, one thing we realized from a design perspective is that each tile in an ImageGroup is a display object, but that seems like overkill. You might want to manipulate properties (x,y,alpha,etc) of the entire map, but it does *not* seem like you would want to do that on specific *individual* tiles. Are there compelling use cases where you would?
uid: 26 topic_id: 23302 reply_id: 111208


[TOPIC: post.html]
#32

jeff472

[GLOBAL: userInfoPane.html]
jeff472
  • Contributor

  • 391 posts
  • Corona SDK

>>As a side note, one thing we realized from a design perspective is that each tile in an ImageGroup is a display object, but that seems like overkill. You might want to manipulate properties (x,y,alpha,etc) of the entire map, but it does *not* seem like you would want to do that on specific *individual* tiles. Are there compelling use cases where you would?<<

My entire app depends on that exact functionality.
The user interacts with the 'map' and where they touch, things change.
I don't use the objects as sprites except so far as to allow the image to change on touch.
Some change their alpha, some change their image.
uid: 108660 topic_id: 23302 reply_id: 111209


[TOPIC: post.html]
#33

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 365 posts
  • Corona SDK

Hi,

I think, we can distinguish between two cases:
1. If an image group is used for background/foreground layer, I do not need to have physics properties for it (I build dedicated physics layer for that using some logic), nor do I need to perform any operation on individual tiles there. only move the entire layer based on the camera point of view.
I can think one might want to perform tile replacement within this group (to indicate that some action has happened, such as hidden door, trap door etc), but this can probably be overcome using additional sparsly populated layers if needed.
2. The second option is when we can pack all interactive objects to single image group - in this case, individual objects will need to have their own characteristics to manipulate.

I think that for a quick solution, we can do pretty well with having a solution only for the first case.
Going forward, I would try to attack the second case by allowing collisions between groups (if possible by box2D framework), or by improving current culling of objects outside the screen.

For example, in my case, a typical scene can have between 1500 to 5000 tiles (I reduced it from 25k originally by pre-merging image tiles to larger image tiles where possible). However, only few hundred of those are viewable at any point in time. the rest should reside in an inactive state/group until brought to view.

Thanks.
uid: 118978 topic_id: 23302 reply_id: 111210


[TOPIC: post.html]
#34

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 365 posts
  • Corona SDK

Jeff,

Do you have a large map which the user scrolls or is it a fixed map the size of the screen or something similar?
How many Tiles does your map have and what is the average FPS you get?

uid: 118978 topic_id: 23302 reply_id: 111212


[TOPIC: post.html]
#35

jeff472

[GLOBAL: userInfoPane.html]
jeff472
  • Contributor

  • 391 posts
  • Corona SDK

What I'd love is a large map that the user could scroll.
But the tiled area is 200 x 200 , 40K tiles

In proto type it was WAY too slow to have these things with their own listeners, so right now I have something like 96 x 72 on screen.
When the user 'scrolls' its done by changing the currentFrame of all the tiles.
And I reckons thats too slow too.

FPS is not a concept that applies to my app: I have a 'time to redraw once'
uid: 108660 topic_id: 23302 reply_id: 111215


[TOPIC: post.html]
#36

bdjones

[GLOBAL: userInfoPane.html]
bdjones
  • Enthusiast

  • 61 posts
  • Corona SDK

@walter

My app also depends on being able to adjust properties of specific tiles -- not just the map at large. I'm allowing players to pick up and place tiles in the world....
uid: 82003 topic_id: 23302 reply_id: 111239


[TOPIC: post.html]
#37

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 365 posts
  • Corona SDK

OK, so how much time does it take to redraw a scene? how many times you do it in a second?

I'm trying to see if I can modify my implementation somehow to improve frame rate.
The smallest tiles I have are 40x40, so on htc-one for example (1280x720) I can at worst case have 627 viewable tiles for each layer (assuming they are not aligned to the screen borders). with 7 layers this results with less than 4400 tiles in view. But, my layers are not completely populated. And I've reconstructed the scene to use 3 steps of tile sizes 40x40, 120x120 and 240x240 where possible, resulting in significant drop in overall number of tiles and that brings the amount of viewed tiles to less than 500 most of the time.
The only other thing I can think of is to impement my own off screen culling, but doing it over the API is slow and will not work smoothly. It needs to be implemented natively.
uid: 118978 topic_id: 23302 reply_id: 111295


[TOPIC: post.html]
#38

walter

[GLOBAL: userInfoPane.html]
walter
  • Moderator

  • 726 posts
  • Alumni

Okay, so an update. The culling code was horribly inefficient, so I've reimplemented it.

In the test case that @oaf has supplied, there is significant improvement on the really bad level, smoothly running north of 55 fps on my old iPhone 3GS (previously it was stuttering really badly).

These changes won't make it into the public release as we've locked it down except for showstopper bugs. I'll get this into a daily build soon after post-release.
uid: 26 topic_id: 23302 reply_id: 111478


[TOPIC: post.html]
#39

Oaf

[GLOBAL: userInfoPane.html]
Oaf
  • Observer

  • 29 posts
  • Corona SDK

That's great news. Can't wait to get my paws on it!
uid: 276 topic_id: 23302 reply_id: 111482


[TOPIC: post.html]
#40

dingo

[GLOBAL: userInfoPane.html]
dingo
  • Contributor

  • 700 posts
  • Corona SDK

@Walter: thanks a lot for your news and listening to us!
Can't wait to see the results in the daily build.

it would be awesome if you could have a look at:

developer.anscamobile.com/forum/2011/12/12/performance-degradation-new-public-release

this is really a show stopper. we had Grooh running perfectly on the samsung galaxy, but out of nowhere, we had a fps drop from 60 to sth like 15. we are still waiting to release it.

thanks once again, and sorry for the thread hijack.
uid: 90610 topic_id: 23302 reply_id: 111485


[TOPIC: post.html]
#41

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 365 posts
  • Corona SDK

These are great news Walter!

Can you check the fix with my code as well? (using the new dungeon option)

Can you estimate when you expect to ship a daily build again? We won't hold you for specifics, just to get a feeling..
uid: 118978 topic_id: 23302 reply_id: 111520


[TOPIC: post.html]
#42

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 365 posts
  • Corona SDK

Hi,

I see that a new daily build has been posted. Have you managed to enter the re-implemented culling code to this build?

Thanks.
uid: 118978 topic_id: 23302 reply_id: 112449


[TOPIC: post.html]
#43

Oaf

[GLOBAL: userInfoPane.html]
Oaf
  • Observer

  • 29 posts
  • Corona SDK

Doesn't look like it - just tried level 19 with build 838, and it's reporting 35-45fps on an iPhone 4.

(Walter reported 55+ on a 3GS).
uid: 276 topic_id: 23302 reply_id: 112451


[TOPIC: post.html]
#44

walter

[GLOBAL: userInfoPane.html]
walter
  • Moderator

  • 726 posts
  • Alumni

Not yet. We found a showstopper android issue on 838. So the changes are stuck in the queue until the public release goes out, which if all goes well, will be 840.
uid: 26 topic_id: 23302 reply_id: 112454


[TOPIC: post.html]
#45

Oaf

[GLOBAL: userInfoPane.html]
Oaf
  • Observer

  • 29 posts
  • Corona SDK

Any idea when that'll be? Two days time? :)
uid: 276 topic_id: 23302 reply_id: 112458


[TOPIC: post.html]
#46

poon

[GLOBAL: userInfoPane.html]
poon
  • Contributor

  • 181 posts
  • Corona SDK

Can't wait to see how the new implementation improves performance. I have many screens in which more than 50% of my display objects are off-screen.
uid: 92621 topic_id: 23302 reply_id: 112465


[TOPIC: post.html]
#47

walter

[GLOBAL: userInfoPane.html]
walter
  • Moderator

  • 726 posts
  • Alumni

@poon, just a clarification that the offscreen culling is currently in.

The pending optimizations I'm talking about improve the overheard associated with offscreen culling, and also enable it for imagegroups (there was no culling previously in image groups).
uid: 26 topic_id: 23302 reply_id: 112545


[TOPIC: post.html]
#48

Oaf

[GLOBAL: userInfoPane.html]
Oaf
  • Observer

  • 29 posts
  • Corona SDK

Just grabbed 840, still the same so I guess it didn't make it in.
uid: 276 topic_id: 23302 reply_id: 112610


[TOPIC: post.html]
#49

alcyone

[GLOBAL: userInfoPane.html]
alcyone
  • Observer

  • 7 posts
  • Corona SDK

Same here!

I'm developing a game based in an infinitum mathematically generated world, and yes... I only displays a small matrix of the viewable area but I have a lot of problems, the tiles remains in the memory despite of removing the group and the framerate decreases lineally from 60fps to 0fps!

Waiting a solution or a good example of an huge tilemap with good perfomance.
uid: 79789 topic_id: 23302 reply_id: 113086


[TOPIC: post.html]
#50

alcyone

[GLOBAL: userInfoPane.html]
alcyone
  • Observer

  • 7 posts
  • Corona SDK

@Glitch Games
I have the Lime 3.4 purchased, where can I obtain the Lime 3.5 Beta like @oaf? :)
I will try to test my engine with it.
uid: 79789 topic_id: 23302 reply_id: 113087



[topic_controls]
Page 2 of 3 1 2 3
 
[/topic_controls]