The issue with using TCastleScene to load tiledmap(*.tmx) for creating pixel games

I have set RenderOptions.MagnificationFilter to magNearest and MinificationFilter to minNearest, but it is still unable to be pixelated.

Rendering is incorrect. The water and ground are on separate layers, with the water on the bottom layer.CGE rendering has misalignment.

In tiled:
1
In CGE:
2

I suggest to use the TMX map as a format, convert it to your own format, and then draw it yourself. Do not use the official set of things.

In another perspective, if you use the official TMX unit, it will eventually not be enough (or the flexibility is not enough), and there are also rendering performance problems

@saaf Thanks for the report!

I found and fixed an issue, it likely fixes both AD 1 and AD 2. When loading Tiled map to TCastleScene, the texture was needlessly scaled to be power-of-2, causing artifacts.

Related to Tiled map in TCastleScene: see the

If you still experience rendering artifacts with your map, please provide an example to reproduce. If it can be reproduced with examples/tiled/map_viewer_in_viewport/ , then just provide a sample map to reproduce the problem.

Note: I have just pushed some of the improvements mentioned here to GitHub. Please give Jenkins ~6 hours to test everything and build a new automatic snapshot that you can download on Download | Castle Game Engine . You can check when it’s done by looking at Comparing snapshot...master · castle-engine/castle-engine · GitHub – right now it has 31 commits, later today it should drop to zero, meaning all improvements are available to download :slight_smile:

Well I do not agree, esp. in light of recent optimizations and improvements :slight_smile: Try the solutions in CGE to load Tiled maps, esp. loading Tiled maps in TCastleScene. They will save you a lot of work, and if they miss something – we can extend them.

I have eliminated performance issues this week, in both 1. Tiled in TCastleTiledMapControl and 2. Tiled in TCastleScene. They are both now very fast and light on resources. Try out the samples, see news announcements linked above. And if you have anything that doesn’t perform well, of course submit a testcase so we can look into optimizing it.

As far as features go, I think examples/tiled/map_viewer_in_viewport/ is quite great. You can place sprite sheets, images, 3D stuff, stuff with physics etc. over the map. There will be additional API (for placing/moving units on map tiles, detecting clicks on tiles – stuff you can do already, just you need to calculate some stuff yourself now) and editor support (to snap to tiles) for this in the future.

Of course you can also roll your own solution (using e.g. our TDrawableImage under the hood) but I think that we offer quite capable solution now for Tiled out-of-the-box. And we can extend our Tiled support as we go, and everyone will benefit this way from one central Tiled-handling code in CGE.

1 Like

Great job! I’ve compiled and tested the latest version, it has high efficiency and low resource usage (CPU and memory), thank you! I will try to make a 2D pixel game using CGE.

1 Like