Re: 回复: Re: [cocos2d-js-devel] New version of Tile Map

22 views
Skip to first unread message

huabing.xu

unread,
Jul 15, 2014, 3:18:24 AM7/15/14
to Ricardo Quesada, xiaoming.zhang, NiTe Luo, Dawid Drozd, cocos2d-js-devel

Hi


I did some tests for tile map and fast tile map, given the results, it seems the FastTMX can not fully replace TMXTileMap.

Here are the testing results.


Results:
1. Max tile size support: 
TileMap: 120X120 due to the limitation of unsigned short indices usage in TextureAtlas
FastTMX: 500X500 can also work correctly, int is used for indices

2. Performance comparison (based on Ortho TileMap):

The results shows: 
FastTMX is a little faster than TileMap when we do not move the TMX map.
If the TMX map is moving, more CPU time is used for culling computation and updating rendering indices. 
If large area of tiles is shown on the screen (as shown for 0.25 scale and most tiles in screen), the performance is not good, especially when TMX map is moving.

3. I created a ISO Tile Map, but it can not be rendered both in old TileMap and new FastTMX. I will work out and did some more tests for ISO map.

4. The tests link is: https://github.com/dabingnn/cocos2d-x/tree/v3_tileMapPerformanceTest

Best Regards
Harrison Xu

 Original Message 
Sender: Ricardo Quesada<ricardo...@gmail.com>
Recipient: huabing.xu<huabi...@cocos2d-x.org>
Cc: xiaoming.zhang<xiaomin...@cocos2d-x.org>; NiTe Luo<dark...@gmail.com>; Dawid Drozd<drozdda...@gmail.com>; cocos2d-js-devel<cocos2d-...@googlegroups.com>
Date: Thursday, Jul 3, 2014 11:54
Subject: Re: 回复: Re: [cocos2d-js-devel] New version of Tile Map

thanks. great work!

I'm not worried about Hex support since it is no longer supported by Tiled. In fact, I think last version that supports Hex is from 3 years ago. So, Hex is not a big deal.

well done!



On 2 July 2014 20:47, huabing.xu <huabi...@cocos2d-x.org> wrote:

Hi, Riq

I have implemented the hex tile map. 

The problems are

1. both the original one and the new version support rendering, the new version supports culling. Other features are not supported.


2. the original one shows hex tile map with segmented function to compute tiles position by tile coordinate.

However, in order to support culling, the new version using a unified function to compute tile position, which is not backward compatible.


3. Tiled editor does not support hex tile map.


Here is the pr link

https://github.com/cocos2d/cocos2d-x/pull/7299


So given the current status, Minggo and I discussed about this, and it seems the backward incompatibility is not a serious problem. What is your opinion about this?


Thanks


Best Regards
Harrison Xu

 Original Message 
Sender: Ricardo Quesada<ricardo...@gmail.com>
Recipient: huabing.xu<huabi...@cocos2d-x.org>
Cc: xiaoming.zhang<xiaomin...@cocos2d-x.org>; NiTe Luo<dark...@gmail.com>; Dawid Drozd<drozdda...@gmail.com>; cocos2d-js-devel<cocos2d-...@googlegroups.com>
Date: Thursday, Jul 3, 2014 00:52
Subject: Re: 回复: Re: [cocos2d-js-devel] New version of Tile Map

Great news. well done!


On 29 June 2014 20:19, huabing.xu <huabi...@cocos2d-x.org> wrote:

Hi, Riq

In fact now all the test works except Hex tilemap.

I will try to fix it this week.


Best Regards
Harrison Xu

 Original Message 
Sender: xiaoming.zhang<xiaomin...@cocos2d-x.org>
Recipient: Ricardo Quesada<ricardo...@gmail.com>
Cc: huabing.xu<huabi...@cocos2d-x.org>; NiTe Luo<dark...@gmail.com>; Dawid Drozd<drozdda...@gmail.com>; cocos2d-js-devel<cocos2d-...@googlegroups.com>
Date: Saturday, Jun 28, 2014 07:12
Subject: 回复: Re: [cocos2d-js-devel] New version of Tile Map

We have not tested it. We will try it. Another thing is that, i told Harrison to remove deprecsted finctions in new class. I think new class do not need to have deprecated functions. Another good news is that, the performance was improved.

-------- 原始邮件 --------
发件人: Ricardo Quesada
日期:28-06-2014 AM12:27 (GMT+08:00)
收件人: Xiaoming Zhang
抄送: "huabing.xu" ,NiTe Luo ,Dawid Drozd ,cocos2d-js-devel
主题: Re: [cocos2d-js-devel] New version of Tile Map

Sounds.
So, if we have exactly the same features as in the old TMX, then the old Test Case should work with any change, correct ? Could you verify that ?
Thanks.


On 26 June 2014 19:23, Xiaoming Zhang <xiaomin...@cocos2d-x.org> wrote:
I have talked with Harrison, the current status is
1. all features are supported, including animation, vertex z
2. static tile map performance is better than old one, we will add performance later
3. using vertex z and all tile map in screen, performance is not as good as old one

So i think we can merge all the features and improving performance in next week.


Best Regards
Minggo




On Jun 27, 2014, at 10:10 AM, Ricardo Quesada <ricardo...@gmail.com> wrote:

In the future it must replace ALL the functionality provided by the current TMX.
Can we do that for v3.2 ? Can we support animations ?

If not, we should focus on the most important feature: Fast.




On 26 June 2014 19:01, huabing.xu <huabi...@cocos2d-x.org> wrote:
I used to thought our fastTMX should be an improvement and a replacement of the old version. 
Standing on the developer's point of view, if we support static tileMap only, users need to deal with two types of TileMap.

What is the final goal of fast_tmx?
Is it replacing the old tmx or only implementing some features of the tilemap?

Best Regards
Harrison Xu

 Original Message 
Sender: Ricardo Quesada<ricardo...@gmail.com>
Recipient: huabing.xu<huabi...@cocos2d-x.org>
Cc: NiTe Luo<dark...@gmail.com>; Dawid Drozd<drozdda...@gmail.com>; cocos2d-js-devel<cocos2d-...@googlegroups.com>
Date: Friday, Jun 27, 2014 09:48
Subject: Re: [cocos2d-js-devel] New version of Tile Map

Do we need to support "vertex z" ?

We are going to keep supporting the old TMX code for a while since it has more functionality that the current one.
So, users who want to add new tiles, or animate them, they should use the old one.

The new one is for users who just want to render an static tile map. For those users, the new code will be much faster.
And if the performance is not much faster than the previous code, then we shouldn't add it.



On 25 June 2014 19:58, huabing.xu <huabi...@cocos2d-x.org> wrote:
BTW,for every test case of the old tilemap, there is a new corresponding test case in this PR.
ENTRY:’test cpp’->’Node: FastTileMap'

Best Regards
Harrison Xu

 Original Message 
Sender: huabing.xu<huabi...@cocos2d-x.org>
Recipient: NiTe Luo<dark...@gmail.com>; Dawid Drozd<drozdda...@gmail.com>
Cc: Ricardo Quesada<ricardo...@gmail.com>; cocos2d-js-devel<cocos2d-...@googlegroups.com>
Date: Thursday, Jun 26, 2014 10:35
Subject: Re: [cocos2d-js-devel] New version of Tile Map

Hi

1. The work is based on the old PR by Bo Yu, except using a new rendering work flow to support both ‘Local Z order’ and Vertex Z in tile map

2. The performance is not very good now. I have been working on improvement and testing of the fast tile map.

Best Regards
Harrison Xu

 Original Message 
Sender: Dawid Drozd<drozdda...@gmail.com>
Recipient: NiTe Luo<dark...@gmail.com>
Cc: Ricardo Quesada<ricardo...@gmail.com>; huabing.xu<huabi...@cocos2d-x.org>; cocos2d-js-devel<cocos2d-...@googlegroups.com>
Date: Thursday, Jun 26, 2014 08:06
Subject: Re: [cocos2d-js-devel] New version of Tile Map

yeah it would be nice to see performance test :)


2014-06-26 0:16 GMT+02:00 NiTe Luo <dark...@gmail.com>:
Hi Harrison:

Can you do some performance test against the old tilemap, especially the one with static VBO (cache map data on VBO instead of send it every frame)

I want to see at what point(map size) the culling can out perform static VBO

-Nite

On Jun 25, 2014, at 7:48 AM, Ricardo Quesada <ricardo...@gmail.com> wrote:

Thanks. How different is this feature from the one the Bo Yu implemented a few weeks ago?



On 25 June 2014 03:08, huabing.xu <huabi...@cocos2d-x.org> wrote:

Hi, 

I am now working on new version of Tile Map. An new feature named culling is added compared to old version of tileMap. Which means tiles is not rendered if it is at the out of the screen.

My link is: https://github.com/cocos2d/cocos2d-x/pull/7211

Now the main feature is completed.

if you have any suggestions and comments, please let me know.

Thanks.


Best Regards
Harrison Xu

--
You received this message because you are subscribed to the Google Groups "cocos2d JS development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos2d-js-dev...@googlegroups.com.
To post to this group, send email to cocos2d-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "cocos2d JS development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos2d-js-dev...@googlegroups.com.
To post to this group, send email to cocos2d-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "cocos2d JS development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos2d-js-dev...@googlegroups.com.
To post to this group, send email to cocos2d-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Pozdrawiam
Dawid Drozd.

--
You received this message because you are subscribed to the Google Groups "cocos2d JS development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos2d-js-dev...@googlegroups.com.
To post to this group, send email to cocos2d-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "cocos2d JS development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos2d-js-dev...@googlegroups.com.
To post to this group, send email to cocos2d-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "cocos2d JS development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos2d-js-dev...@googlegroups.com.
To post to this group, send email to cocos2d-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "cocos2d JS development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos2d-js-dev...@googlegroups.com.
To post to this group, send email to cocos2d-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "cocos2d JS development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos2d-js-dev...@googlegroups.com.
To post to this group, send email to cocos2d-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "cocos2d JS development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos2d-js-dev...@googlegroups.com.
To post to this group, send email to cocos2d-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Screen Shot 2014-07-15 at 3.07.30 PM.png
Screen Shot 2014-07-15 at 3.07.30 PM.png

Ricardo Quesada

unread,
Jul 15, 2014, 1:13:20 PM7/15/14
to huabing.xu, xiaoming.zhang, NiTe Luo, Dawid Drozd, cocos2d-js-devel
Thanks for the report.


What is your suggestion ? what should we do ?


I expect FastTMX to be slightly slower when moving the map because of the culling. That is acceptable.
But I also expect that FastTMX must be like 5 times (or more faster) when rendering huge maps. Is this the case ?

As I originally proposed, FastTMX is NOT forced to replace TMX.
Instead, it should be able to render static tile maps like 5x (or more) faster.
Supporting adding / moving / removing tiles is a nice feature, but if this new feature decreases the performance considerably, then probably we shouldn't add it.

I expect that 90% of our users will use static tile maps. And they should use FastTMX.
The rest of our users can use the original TMX.

Thoughts ?

Please, give priority to this feature. Thanks!



Screen Shot 2014-07-15 at 3.07.30 PM.png

NiTe Luo

unread,
Jul 15, 2014, 1:30:21 PM7/15/14
to Ricardo Quesada, huabing.xu, xiaoming.zhang, Dawid Drozd, cocos2d-js-devel
Usually a game with map(RPG, Platformer, infinite runner, city builder), requires move the map quite constantly, sometimes needs to move the map all the time. So have a good performance when map is moving is critical.

In this case I think the culling drop the performance significantly, about 50-80% drop. I think that’s too much, unless we can improve the performance when map is moving, I suggest we don’t release FastTMX.


-Nite

On Jul 15, 2014, at 10:13 AM, Ricardo Quesada <ricardo...@gmail.com> wrote:

Thanks for the report.


What is your suggestion ? what should we do ?


I expect FastTMX to be slightly slower when moving the map because of the culling. That is acceptable.
But I also expect that FastTMX must be like 5 times (or more faster) when rendering huge maps. Is this the case ?

As I originally proposed, FastTMX is NOT forced to replace TMX.
Instead, it should be able to render static tile maps like 5x (or more) faster.
Supporting adding / moving / removing tiles is a nice feature, but if this new feature decreases the performance considerably, then probably we shouldn't add it.

I expect that 90% of our users will use static tile maps. And they should use FastTMX.
The rest of our users can use the original TMX.

Thoughts ?

Please, give priority to this feature. Thanks!



On 15 July 2014 00:18, huabing.xu <huabi...@cocos2d-x.org> wrote:
Hi

I did some tests for tile map and fast tile map, given the results, it seems the FastTMX can not fully replace TMXTileMap.
Here are the testing results.

Results:
1. Max tile size support: 
TileMap: 120X120 due to the limitation of unsigned short indices usage in TextureAtlas
FastTMX: 500X500 can also work correctly, int is used for indices

2. Performance comparison (based on Ortho TileMap):
<Screen Shot 2014-07-15 at 3.07.30 PM.png>

huabing.xu

unread,
Jul 15, 2014, 10:17:59 PM7/15/14
to Ricardo Quesada, NiTe Luo, xiaoming.zhang, Dawid Drozd, cocos2d-js-devel

Thanks for all of your feedbacks.

Given the current status, I thinks our new FastTMX is not good enough to be released for our developer could not gain much from the FastTMX.


Status:

In our discussion, there are three factors that we need to take care of.

1. static tilemap

2. static tilemap with camera moving

3. tilemap with tiles could be updated


For comparison of factor 1: our fasttmx is slightly faster. 

The reason is that we could only test for 120*120 tiles, in which cases the vertices processed by GPU is not a bottleneck in application. It is 60fps in old tiledMap. In order to test performance improvement, we need to using huge tilemap(500*500 or larger), which is not supported in old TiledMap.


For comparison of factor 2: It is slower, CPU is a bottleneck when camera is moving because our culling and rendering primitive reconstruction are done tile by tile. We need a new way for tile culling and updating.


For factor3: In normal game, the tiles could not be updated frequently. So it is not a big problem.


Proposal:
We need a new solution for our new version of tileMap, and these features needs to be supported:
1. Support huge map (Maybe 1000*1000 tiles or even bigger)
2. Efficient culling and rendering: 
3. Memory saving
4. Occlusion behaves correctly if external sprites goes into the tileMap.
5. more…

I think if our new version of tilemap can support this, it would be great. 
What is your suggestions about this?

Thanks.

Best Regards
Harrison Xu

 Original Message 
Sender: NiTe Luo<dark...@gmail.com>
Recipient: Ricardo Quesada<ricardo...@gmail.com>
Cc: huabing.xu<huabi...@cocos2d-x.org>; xiaoming.zhang<xiaomin...@cocos2d-x.org>; Dawid Drozd<drozdda...@gmail.com>; cocos2d-js-devel<cocos2d-...@googlegroups.com>
Date: Wednesday, Jul 16, 2014 01:29

Hao Wu

unread,
Jul 20, 2014, 11:54:52 PM7/20/14
to huabing.xu, Ricardo Quesada, NiTe Luo, xiaoming.zhang, Dawid Drozd, cocos2d-js-devel
We need streaming, but im not sure if the current file format can be supported
Reply all
Reply to author
Forward
0 new messages