An efficient surface based 2d lighting and shadow system packed with features and optimizations. Marketplace link. Download the example executable. Download the example project. I tried to show off nearly all the features so you can see how to use them. Should work on all platforms. Successfully tested on Windows, Android, and HTML5. Shadow casters can be defined by a sprite, an arbitrary set of points, or a path. Lights can be any gradient sprite, I made mine in GIMP by drawing a shape, adding a white to black gradient and then blurring it with a gaussian blur. Works well with physics objects and is designed with views in mind. The light map surface only takes up the visible part of the screen and lights are not drawn on the outside of it. There is a quality setting that allows the light map to take up less texture memory by reducing the size of the surface and scaling it up when drawing, greatly improving the performance, particularly on mobile devices. The surface can be blurred to improve the look of the shadows. The system is object oriented, heavily relying on instance variables so there can only be one light per object and only one caster per object. Free to use in your project, even for commercial games. Docs: light_init(width, height, light_size, ambient_color, quality, iterations) Sets up lighting variables. width: Width of the shadow map. height: Height of the shadow map. light_size: The size of the lightmaps, should be set to the largest light. color: The shadow color, this also controls the darkness of the shadows. quality: The lightmap quality, 0 to 1. iterations: How many times a second to draw the lightmap. The default is the room speed but you might want to reduce this for increased performance. If it is too small, however, you will notice considerable stuttering. light_draw(x, y, additive, shadows, blur_amount) Draws the lights and shadows. It makse sense to only draw the surface at 0, 0 if you are not using view or view_xview, view_yview if you are. x: The x location to draw the shadow map. y: The y location to draw the shadow map. additive: Whether to use additive blending or not. shadows: Whether or not to draw shadows. blur_amount: How blurry to make the shadows, numbers from 0 to 1 are good but you can go higher for more blurriness. Blurry shadows generally makes a lower quality lightmap look nicer without the extra memory required for a full quality lightmap. Important note: The object calling this function should have a lower depth than the casters. light_create(light_sprite, light_scale, light_color, light_alpha, light_angle, shadows) Creates a light and the local variables for it. sprite: Gradient sprite to use. scale: Scale of the sprite. color: The light color. alpha: Brightness of the light, from 0 to 1. shadows: If this light should draw shadows. Notice: An instance can only have one light attached to it. light_destroy() Must be called when a light is destroyed. light_create_caster() Creates a caster from the size of the object's sprite. Notice: An instance can only have one caster attached to it. light_create_caster_from_points(points_x, points_y) Creates a caster from two lists of points. points_x: ds_list of relative x positions. points_y: ds_list of relative y positions. Notice: An instance can only have one caster attached to it. light_create_caster_from_path(path, xorigin, yorigin, xoffset, yoffset) Creates a caster using a path, if -1 is passed the bounding box of the sprite will be used. path: The path to use. xorigin: The relative x point on the sprite where the first point on the path goes. yorigin: The relative y point on the sprite where the first point on the path goes. xoffset: The sprite's xoffset, allows you to use a different sprite offset. yoffset: The sprite's yoffset. Notice: An instance can only have one caster attached to it. light_destroy_caster() Destroys a caster light_set_size(size) Sets the maximum size of all lights and resizes the lighting surface after it has already been initalized. size: Size of the square surface in pixels. light_set_quality(quality) Sets the light quality after the lights have been initialized. quality: The quality of the lighting surfaces, from 0 to 1. light_set_color(ambient_color) Sets the ambient color, this also controls the brightness. ambient_color: Color to make the shadows. light_set_alpha(alpha) Sets the brightness of a light. alpha: From 0 to 1. light_set_color(color) Sets the color of a light. color: The color of the light. light_set_rotation(angle) Sets the rotation of a light. angle: Rotation in degrees. light_set_sprite(sprite) Sets the light to a new sprite. If this sprite is larger than the sprite that the light was created with then it will be cut off. If you need to change the size of a light you should destroy it and create a new one. sprite: The sprite index to assign to this light. light_set_size(size) This will scale the light sprite. Notice that this will not change the size of the surface the light is drawn on, only the sprite itself. size: Scale of the light sprite. light_draw_sprite_dark() Draws the sprite in darkness. Useful for objects that should be in shadow. Use global._light_dark_color to do this manually. draw_surface_blurred(surface, x, y, xscale, yscale, blur_amount) Draw a surface with a blur. x: The x location to draw the surface. y: The y location to draw the surface. xscale: The x scale of the surface. yscale: The y scale of the surface. blur_amount: How blurry the surface should be, numbers from 0 to 1 work well but even higher number can be used for increased blur. Edit: Turns out it does work in HTML5, my demo just doesn't because of physics reasons.