On the current version 3.0 Beta 2
Using TMXTiledMap fully populated with 20x20 map size added to an isometric tile 128x64, got this performance:
Testing Cocos2d-x v2.2.2:
3 FPS - iOS Simulator
35 FPS - Motorola RAZR D3
11 FPS - Motorola XOOM
Cocos2d-x 2 v3.0Beta
6 FPS - iOS Simulator
25 FPS - Motorola RAZR D3
8 FPS - Motorola XOOM
Coming from the old version to the new, I converted all Deprecations, the app compiles without a problem.
For this map, only has 2 layers, one with the floor, about 400 tiles, walls in another layer, about 40 tiles wall.
I did not activate the schedule repositioning tiles.
Could anyone tell if this is right? I expected an improvement in performance.
Blame the google translator for translation mistakes.
Hi,
Sorry if it is dumb question, but
I am started learning cocos2dx and have problem with tile map in beta2
Is it possible to get object from Objects Layer now?
TMXTiledMap *map = TMXTiledMap::create("level1.tmx");
this->addChild(map, 0);
TMXObjectGroup *objectGroup = map->getObjectGroup("ObjectLayer1");
ValueMap spawnPoint = objectGroup->getObject("SpawnPoint");
Actually objectGroup is ok, but spawnPoint is not created
Any thoughts ?
I’m doing this way and it works:
TMXTiledMap * _TiledMap = TMXTiledMap::create("TileMaps/Base_256x64.tmx");
TMXLayer * Layer_Objetos = _TiledMap->getLayer("Objetos");
TMXObjectGroup * Grupo_Aliases = _TiledMap->getObjectGroup("Aliases");
auto Objeto_Player = Grupo_Aliases->getObject("Player");
Point TilePos = Reis_Utilidades::Util()->Posicao_para_Tile(Objeto_Player["x"].asInt(), Objeto_Player["y"].asInt(), _TiledMap);
_Player = Layer_Objetos->getTileAt(TilePos);
Posicao_para_Tile() It is a function that transforms position in coordinate.
That definitely doesn’t sound like good news for 3.0 performance.
Are you running both builds with optimization?
I could not tell you if there optimization, but the source code used in the first was used in the second.
panor
May 15, 2014, 11:57pm
#7
Hi JonathanReis,
how about with the latest cocos2dx 3.0?
What you refer when you say “I did not activate the schedule repositioning tiles”… I want to do this on my project since 6 months ago
I am using isometric tiles, even in version 2.2.3, but in the sample, there is a basic example of repositioning.
In file TileMapTest.cpp, look at: TMXIsoVertexZ::TMXIsoVertexZ()
And the TMX file you need to set the cc_vertex in each layer.
Look at the example in the resources folder.
This is my game using so I told you, take a look:
https://play.google.com/store/apps/details?id=org.JonathanReis.PushTheCrate
panor
May 17, 2014, 7:23pm
#9
Thanks for your reply.
Wow! Your game looks pretty nice! I would like to know cocos as you know
I have now the example working in my own project. But tamara sprite don’t hide between the trees…
This is my code:
CCTMXTiledMap *TileMap = CCTMXTiledMap::create("TileMap.tmx");
addChild(TileMap, 0);
CCSize s = TileMap->getContentSize();
TileMap->setPosition( ccp(-s.width/2,0) );
CCTMXLayer* layer = TileMap->layerNamed("Trees");
_player = layer->tileAt( ccp(29,29) );
_player->retain();
CCActionInterval* move = CCMoveBy::create(10, ccpMult( ccp(300,250), 1/CC_CONTENT_SCALE_FACTOR() ) );
CCActionInterval* back = move->reverse(); CCSequence* seq = CCSequence::create(move, back,NULL);
_player->runAction( CCRepeatForever::create(seq) );
schedule( schedule_selector(HelloWorld::repositionSprite));
Do you know what I must do?
Obrigado for replying!