I need to distort my environments in large city areas, to make scenes like this possible:

It's like in TWEWY, the buildings will bend left and right as you move, but my engine uses tile maps for it's own simplicity, it consists of Isometrics and Orthos where it's necessary.

Anyway, the distortion needs to paint my tile map onto a polygon so it can bend it accordingly, but the main problem is how to translate the tile map to the polygon. I've considering finding a way to distort the whole screen, but this would lead to problems as the environment will have unstatic npcs walking left and right across the side walk.

Another idea was to take a screenshot and render it in front of the tile map, but that'd would be even harder to keep from lagging the game so immensely. My final idea was to just draw the image separate from the tile map, but this led to a lot of collision syncing problems, as the tile map I've built can't slide the collision maps left and right, and are static (Set Polygons) because of the need for platform physics in other parts of the game. Now, I was thinking I could slide the image left and right instead, and I haven't explored this yet.

Anyway, give me your opinions on the subject, the question really is, "How do I distort the image above to slide the buildings left and right accordingly as seen in games such as TWEWY, without using 3d?"

Looks like simple trapezoid distortion. A little googling around should turn up an affine transform matrix that will do the trick.

Well, the point of the question was how to do this with my Tile map if possible with modifying anything else in the process? I mean, if it really is impossible I can make a static background not connected to the tile map.

If you apply the affine transform to the vertices of your tiles, it should distort the whole tile grid, which should render with the same distortion. You can always stop applying the transform when you get to ground level, if you don't want those tiles distorted, though I'd probably just do it as a separate layer in front of the (distorted) background. Hard to say more without knowing how your tile engine is implemented.

If you apply the affine transform to the vertices of your tiles, it should distort the whole tile grid, which should render with the same distortion. You can always stop applying the transform when you get to ground level, if you don't want those tiles distorted, though I'd probably just do it as a separate layer in front of the (distorted) background. Hard to say more without knowing how your tile engine is implemented.

Well, it uses Slicks in engine ortho implementation, and my own for isometrics. But, I don't use isometrics much, and the in-engine tiled implementation has worked fine up until here, so I'd rather not go back and rebuild it.

Okay, the simplest solution to this is to simply draw the shape you want with quads or triangles. For example you could calculate how much each vertex deviates from the screen center and distort the x coordinate based on the y-value (assuming y=0 is the screen bottom):

Doing that for every vertex (corner of each sprite) would produce something similar to what you want, but there's a huge catch:

That's what happens when you texture a trapezoid. It completely destroys the continuity of the texture and looks like crap.

I think what you really want to do is to render things in 3D. If the GPU has access to depth values it can do perspective correct texture mapping, which solves the above problem. You'd obviously get the perspective "distortions" for free since it's 3D.

Also the game you posted just looks like it has static background images. I didn't see any realtime perspective in the video you posted, or did I miss something? It was just heavily styled...

Texture a quad with the trapezoid distortion and it might not look so bad. The line-art style of TWEWY also lends itself to being distorted more freely. But it also looks like some of the buildings are being simply rotated, while the big building that covers the whole screen is more trapezoid-distorted. I suspect there's more than one effect going on, and that they just hand-crafted a lot of it to fit.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org