Construct 2 Release r170

New this build: real-time shadow casting effects, an experimental rendering mode for seamless tilemaps, and improvements for the editor display on high-DPI monitors.

Real-time shadow casting

The new Shadow Light plugin and Shadow Caster behavior work together to produce dynamic lighting effects. There is also support for penumbras (soft-edged shadows taking in to account the light radius) in WebGL mode. There are three new examples demonstrating these features: Shadows - colors, Shadows - light height and Shadows - soft penumbras.

This is an exciting new feature that can add interesting lighting effects to games! It even works on mobile, and appears to perform relatively well even with penumbras. However there are a few things to note when using it due to the particular lighting algorithm:

Soft shadows using a light radius only works in WebGL mode. In canvas2d mode it will fall back to hard-edged shadows as if it were a point source light (radius of 0).

The Shadow Light plugin works by drawing the shadows over the fully-lit scene. Make sure it's Z ordered to where you want shadows to appear - usually beneath the shadow casting objects, or if above, you may want to change the opacity.

The Shadow Caster behavior casts shadows from the object's collision polygon. However for it to work correctly the collision polygon must be a convex polygon. If you need a concave shape, use multiple separate shadow caster objects each with their own convex polygons.

Don't use shadow caster objects smaller than the light radius. The plugin does not render antumbras, so if the umbra converges to a point on-screen, part of the shadow will be missing which will look wrong.

Avoid placing radius-based lights very close to, or even over, shadow caster objects. The algorithm can fail to render a full shadow in this case.

In other words, try to stick to small lights which generally stay far away from the shadow casters. Otherwise it should work nicely!

Tilemap seamless mode

There's a new experimental rendering mode to allow seamless tilemap rendering even when using floating point positioning or scaling with linear sampling. It works by turning off the tilemap optimisation where rectangles of the same tile are rendered in one go. This can reduce performance, since it must render each tile in the tilemap one by one, even if there are large areas of the same tile. However somehow this eliminates the seams. I still don't quite understand why this is, and hopefully it's possible to seamlessly render with the optimisation as well, so I will keep researching it.

Seamless tile rendering appears to always render nicely in WebGL mode. However in canvas2d mode it depends on the browser: on desktop Chrome and iOS Safari it removes the seams, but on desktop IE and Firefox it makes it worse (every tile seams instead of just the joins of rectangle areas). Desktop IE and Firefox both now support WebGL providing the driver isn't blacklisted, so can achieve seamless rendering, but users might still end up getting canvas2d rendering with serious seams. The only way to completely mitigate this is the old workarounds: either use letterbox integer scale, pixel rounding and point sampling, or switch to low-quality fullscreen mode and enable pixel rounding. So setting seamless mode still doesn't guarantee users will never see seams. For this reason, seamless mode defaults to off, since you'll still need the same workarounds for 100% of users to get seamless rendering and turning it on can reduce performance. Except, bizarrely, on iOS Safari seamless mode actually improves performance. So it's a pretty mixed bag all round.