The tile dimensions are 32x32, the map size is 5056 pixels (not tiles), this works great. So I have 158 rows and columns of tiles. When I try to generate a tile map of, 50,560 pixels, the IDE that I use (PyCharm) gives a memory error. I also tried running with IDLE and receive a memory error again. The error occurs in cocos tiles.py, line 989, self.i = self.j = i, j
I do have zooming implemented, but in this case the error occurs right after the game window opens and it just locks up. The window is white, it does not get to the point of rendering the map itself. Because of this, I was thinking of using multiple tile maps, that are themselves tiled, and are loaded offscreen dynamically as the player approaches that layer. Since my tile map is generated procedurally, I can easily change its size and make them very big. So in order to avoid the memory error, I am looking for a way to have multiple tile maps in the same scene, side by side, but only load the maps that are close to my player object. I should also mention that I am using Pymunk physics, and my code generates pymunk segments around "solid" tiles of my map. The only other physics object is my player, which is a simple cube for now. But the memory error comes from cocos not from pymunk. On Mon, Aug 5, 2013 at 5:34 PM, claudio canepa <[email protected]> wrote: > > > > On Mon, Aug 5, 2013 at 5:35 PM, Art Aquino <[email protected]> wrote: > >> I have a procedurally generated tilemap, like in Terraria. Is there a way >> to load my map in chunks? My current map size is 5056x5056. > > > Pixels or Tiles ? Which tile dimensions ? How many different tiles ? > > >> I would like the size of my world to be much much bigger. Unfortunately >> it seems Python chokes when the tile map size goes beyond a certain size. >> >> > Are you talking about load time or frame rate ? Or 'choke' means some > other defect ? > > Are there other entities besides the tilemap ? If you have a lot of actors > in the map you will need some way to only update actors near the player. > > The tilemap itself is drawing only visible tiles, so it shouldn't pose a > fps problem ... Wait, are you zooming out to make visible all the world ? > > I would try to identify the real bottlenecks in the app before changing > the code. > > I tried adding a second tilemap and offset its position so that it is >> directly to the right of my main tile map. I added both maps to the >> scrolling manager. The main map works fine, but I cannot see the second >> tile map. So my next question is, is it possible to load multiple scrolling >> layers (or tile maps) in one scene and have them offset so they seamlessly >> connect at the edges and my player object can scroll from one layer to the >> next? The idea is to have layers load when the player object approaches >> them, and then they become visible. If the player is far enough from a >> layer then that layer gets hidden or some other method is used to free up >> system resources. >> >> > See above. > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "cocos2d discuss" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/cocos-discuss/mPP7DS-JapY/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/cocos-discuss. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- "There is a peace that is not worthy to have, frankly, if it is at the cost of truth." -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cocos-discuss. For more options, visit https://groups.google.com/groups/opt_out.
