Polygon Shapes in Tilemap Based Multi-Layer Levels
Posted: Tue Jul 19, 2011 4:02 pm
Hi there!
I just recently started using Chipmunk Physics since I didn't feel like coding the Physics and Collision Detection for my game myself. I'm using the FreePascal binding, which means the version I'm using is 5.3.2 (so several new functions aren't available to me yet).
Anyways, in my game I have support for an unlimited amount of layers, which can also use tilemaps. The main purpose of this is to have moving level segments, like in Super Mario World. I thought about a way of utilizing this system using Chipmunk. My idea was to let each layer have it's own Body (or Static Body, if a newer version of the binding gets released) with each tile being a Polygon Shape. That way I could easily edit a tile while a level is being progressed and I could easily assign certain properties to each tile.
However: In the documentation it is said that Polygon Shapes use the most performance. Since I'm planning to have somewhat big levels in my game and don't feel like always removing all Polygon Shapes that are offscreen (especially since I want a very few sprites to continue progressing, even when offscreen) I wonder if using this kind of system would reqiures too much performance. After all having two ore more big layers in a level would mean lots of Polygon Shapes. I don't want to start coding a system that won't work out, anyways.
I also wonder if when using multiple Static Bodies like that in a level the Static Bodies would influence each other (like pushing each other aside or something like that). Right now it probably doesn't matter, since this version of the binding doesn't support custom Static Bodies yet and I have to add the Shapes seperately, anyways. I'd still like to know, in case a new version is released.
Also I'd like to know if anyone has a good method for moving layers like that around. Directly setting the position vector does work, but the sprites that are currently on the layer don't move with it correctly. If moving a layer down, for example, the sprites start falling and landing on it over and over. Since I don't add the layers' Bodies to the Space, but only their Polygon Shapes, I guess I can't use most of the special Body functions, either, or can I?
I'd really appreciate any suggestion.
I just recently started using Chipmunk Physics since I didn't feel like coding the Physics and Collision Detection for my game myself. I'm using the FreePascal binding, which means the version I'm using is 5.3.2 (so several new functions aren't available to me yet).
Anyways, in my game I have support for an unlimited amount of layers, which can also use tilemaps. The main purpose of this is to have moving level segments, like in Super Mario World. I thought about a way of utilizing this system using Chipmunk. My idea was to let each layer have it's own Body (or Static Body, if a newer version of the binding gets released) with each tile being a Polygon Shape. That way I could easily edit a tile while a level is being progressed and I could easily assign certain properties to each tile.
However: In the documentation it is said that Polygon Shapes use the most performance. Since I'm planning to have somewhat big levels in my game and don't feel like always removing all Polygon Shapes that are offscreen (especially since I want a very few sprites to continue progressing, even when offscreen) I wonder if using this kind of system would reqiures too much performance. After all having two ore more big layers in a level would mean lots of Polygon Shapes. I don't want to start coding a system that won't work out, anyways.
I also wonder if when using multiple Static Bodies like that in a level the Static Bodies would influence each other (like pushing each other aside or something like that). Right now it probably doesn't matter, since this version of the binding doesn't support custom Static Bodies yet and I have to add the Shapes seperately, anyways. I'd still like to know, in case a new version is released.
Also I'd like to know if anyone has a good method for moving layers like that around. Directly setting the position vector does work, but the sprites that are currently on the layer don't move with it correctly. If moving a layer down, for example, the sprites start falling and landing on it over and over. Since I don't add the layers' Bodies to the Space, but only their Polygon Shapes, I guess I can't use most of the special Body functions, either, or can I?
I'd really appreciate any suggestion.