Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

23. 九月 2016


Welcome back to our ongoing Godot tutorial series.  You may notice a pretty major change in the way Godot looks from previous tutorials.  This is because this tutorial jumps forward to Godot 2.1 which has an updated look and feel.  Don’t worry, the process is virtually identical regardless to which version of Godot you were running.  Today we are going to look at implementing 2D lights in your Godot game.  This will involve creating Godot light nodes, as well as occluders to prevent light.  We will also look at light masking, which is useful for implementing fog of war type effects. 


As always there is a video version of this tutorial available here.


First let’s set up a simple scene we can test our lighting on.  I simple create the following hierarchy using the default Godot icon sprite.



Then scale it up like so:



Now let’s add a Light2D as a Child to our Root node:



Notice the exclamation mark?



This is because we need to specify a texture to use as the light source.  I created the following image in (process is shown in the video if you want to see how it was made):



Notice that this image is a grayscale PNG file with an alpha channel.  Where there are no pixels at all, there will be no light shown.  Where it is whitest, the light will be most intense, while the darker it gets the less intense the light.  Save this image or create your own and add it to your project.  Now we set it as the texture source for our light.



Now if you move your Light2D node around the scene, you will see how it interacts with other objects in the scene:



There are a number of properties you can set for the light, such as the Energy (intensity) Color (tint) and Scale (size):



Notice also Mode.  We will come back to that in a minute.  Now sometimes you aren’t going to want all lights affecting all objects in the scene.  Thankfully there is a setting for that.  Notice in the range category there is a setting called Item Mask:



This controls what layer of items this light will interact with (there is also a setting for shadows as well).  Now if you switch over to your Sprite, under canvas item you will notice a Light Mask setting:



So long as the light and CanvasItem use the same masking channel, the light will apply to that node.  If they don’t use the same channel, the light will have no effect.  This can lower processing costs and enables you to exempt parts of your seen from being lit if so desired.


Now sometimes you want to have light actively blocked in your scene.  For example you might have a wall that should cast a shadow.  This is easy to implement in Godot using Occuluders.  This is simply a polygon area where the proverbial light don’t shine.  Let’s set one up around the nose of our Godot sprite.  Add a LightOccluder2D to your Sprite.



Your scene hierarchy should now look like:



With the LightOcculder2D node selected in the Scene the following icon should be available in the 2D view:



Click the pencil.  Now we want to draw our occlusion polygon, like so:



Now notice the way the light interacts with the scene...



Now remember earlier on the Mode value of our Light2D node?



Now we are going to switch it over to “Mask” and show a powerful capability.  This can be used to create localized lights or to implement fog of war effects.  Just like before we need a texture to represent our light source, but this time we want the pixel values reversed, so I created the following image:



In this case the black area will receive no light, while the whitest area will contain the most light.  Here is the end result:



By scaling the light out to the full size of the screen, you can easily attach such a light to the character sprite to easily implement a fog of war type approach.


The Video

Programming ,

21. 九月 2016


Well, this move is interesting...inxileTS  inXile Entertainment, formed from the ashes of Black Isle Studios, are the developers responsible for Bards Tale, Wastelands 2 and Torment which is currently in early access.  They also might be the developers responsible for a very new trend in game development...  selling game assets to other game developers.  They have teamed up with the popular 3D model store TurboSquid to sell the assets from previous titles.

From the TurboSquid press release:

New Orleans, Louisiana, Sept. 20, 2016 — inXile Entertainment announced a deal today to distribute 3D models from their game catalog exclusively on TurboSquid’s world-leading 3D marketplace. inXile, founded by game industry legend Brian Fargo, is the creator of PC video games including Wasteland 2, Torment, and the Bard’s Tale series.

inXile 3D models from previously released and upcoming titles will be available for purchase on TurboSquid’s marketplace. The move will make production-tested, AAA models available to professional, indie, and hobbyist game developers. inXile CEO Brian Fargo said, “We’re huge believers in stock 3D, and making our own studio’s labor intensive creations available will benefit the indie game dev community as they evolve and drive our industry forward.”

TurboSquid will begin by processing and publishing content from inXile’s recent release Wasteland 2. The models will be made available in common 3D and game engine formats. Fargo added, “3D models for AAA titles are often built and used for only a single title. It made sense to create additional value out of our existing content by opening it up to other developers.”

Matt Wisdom, TurboSquid CEO, envisions this becoming common practice for many game studios. “Studios are often sitting on thousands of 3D models that were incredibly expensive to produce. Selling the content helps offset the rising costs of development for the studio, and it allows developers around the world to access amazing, consistent, game-ready models.”

TurboSquid and inXile expect content to start going online this year, and all models will be available with a standard royalty-free license.


It will be interesting to see what price point these assets are released at.  In some ways it could be a massive boon for game developers if reasonably priced.  Having game tested ready to go 3D models would certainly be a time and money saver.  This is especially true for more generic models such as fences, buildings and the like.  However once you start getting into less generic models, such as characters or enemies, games made using these assets will quickly start feeling quite similar.  It will also be interesting to see what they will do with more unique models such as key NPCs or highly game specific set pieces.  They will have a struggle to balance IP rights with the royalty free release.

It makes a lot of sense from a developer perspective.  There is a massive cost sink in creating these assets and very little chance of reuse outside of a sequel.  It will be interesting to see if any other game developers follow suite.

GameDev News

21. 九月 2016


Gideros just released version 2016.8.2.  Gideros is a cross platform Lua powered game engine that is now open source and free to use.  The 2016.8.2 release brings a number of new features and fixes.  From the release notes:banner


Export features

  • Android Studio upgraded Gradle version
  • Gideros Studio non blocking export dialog with progress
  • Added lots of plugin installer scripts for Android (Android Studio, Eclipse, APK exports)
  • Allow providing default app and tv icons that are replaced on export for all supported platforms
  • Allow providing default horizontal and vertical splash images that are replaced on export for all supported platforms
  • Add additional win32 plugins on export to nearly match those available for Windows Desktop export (bitop, clipper, controller, json, lfs, lpeg, SQLite, luasocket, microphone, struct)

Gideros Features

  • Upgrade to latest OpenAL sound library for better sound latency
  • Shaders code can be supplied in-line from Lua
  • Textures can be created from raw pixel data
  • Global frame counter in Core.frameStatistics
  • Core.frameStatistics now returns table method to get shader language
  • TextField parameter for alignment: sample
  • RenderTarget can be saved to file
  • Tab switching by ctrl+tab (or cmd+tab) in gideros studio IDE.
  • Android returns device type (tv, appliance, car or mobile) on getDeviceInfo
  • Negative indexes support (-1, -2, …) for Sprite:getChildAt(index), SpriteBinder:removeChildAt(index) and Sprite:swapChildrenAt(index1, index2) to get sprites from top

Lua features


  • Player connectivity
  • Correct requesting Open GL on desktop (due to upgrade to Qt 5.6: caused Gideros Player to crash on startup for some users)
  • lua and luac binaries compilation with mingw
  • Particles alpha
  • Particles are now visible after removed
  • Android player check file for null pointer when loading existing projects
  • Timer’s behavior to run as set
  • Path2d texture positioning


  • [Controller] fixed Moga lib for Android 21
  • [Gaming Google Play] show all leaderboards support
  • [Gaming Google Play] step by step achievements handling on GMS
  • [Gaming Google Play] improved API for achievements
  • [Camera] initial alpha version for drawing camera texture in Gideros

GameDev News

20. 九月 2016


The following is a recap of major events in the world of game development for the week ending September 20th, 2016.  I do a weekly video recapping the news available here with this week’s video embedded below.  This post is a collection of links mentioned in the recap.


The Video

GameDev News

19. 九月 2016


Today there was a new release of the cross platform Lua powered Corona game engine.  The upgrade brings iOS 10 SDK support and the ability to use Xcode 8.  The primary reason behind this release was to remain compatible with Apple’s revised iOS/TvOS requirements.

Details from the release notes:


Release notes (2016.2949)
  • macOS: improve reliability of “Copy to device” option on build dialogs; add “Retry” button for when you forget to plug in a device.
  • Simulators: add missing “Borderless” skin in iPad Pro size.
  • Fixed issue with splash screen code which caused stacktraces to appear for some people when the splash screen was disabled.
  • macOS: Removed beta tag from iOS and tvOS building with Xcode 8.0.
  • iOS, tvOS: fix issue which prevented apps being submitted to the App Store.
  • macOS: Added Back key support for Android skins in Simulator (Hardware→Back).
  • Core: Fixed crash when custom shader contains empty table. Casenum 5894470.
  • Core: Added ability to read/write custom “app” preferences to storage. See APIssystem.getPreference(), system.setPreferences(), and system.deletePreferences().
  • Android: Fixed a potential crash that can occur when an app with notification permissions is updated to remove said permissions. Casenum 40070.
  • Windows: Fixed bug where “mouse” event would not provide a double right click or double middle click’s 2nd down phase.
  • macOS, Windows: fix issue with app sometimes exiting when a build is requested. No casenum.
  • Core: Fixes crash caused by an out-of-range frame index for Image Sheets when used with display.newImage(). Now it will display a warning message and default to the last frame in the Image Sheet (same behavior as with display.newImageRect()). Casenum: 47013.
  • Physics: Fixed debug draw mode to show the real position of physics bodies in groups that have been scaled or translated. This doesn’t fix the issue with using physics objects in groups but will display the true location of the physics body in relation to the display object. Casenum: 46663.
  • Windows, macOS: display a message in the console if an app closes becausenative.requestExit() was called. No casenum.
  • Android: Fixed an issue where setting the minSdkVersion in build.settings could only go as high as API Level 21 (Android 5.0). Now this can be set as high as API Level 23 (Android 6.0).
  • Android – Enterprise: Added new APIs for interacting with packages on Android devices (PackageServices). These can be used to quickly tell if a package is installed and enabled on a device.
  • Core: fixing new display objects not triggering scene update after
  • macOS: Handle hung iOS device installs correctly. No casenum.
  • Updated viewer subrepo to latest version.
  • Core: fixing culling offscreen objects with Casenum 43011.
  • Enterprise: fix issue with signing apps. No casenum.
  • iOS: tweaks for iOS 10 beta.
  • OS X: Support builds against iOS/tvOS 10.0 beta.
  • Core: fixing crash when using TextureResourceCanvas as mask. Hit testing doesn’t work for these masks.
  • Core: fixing TextureResourceCanvas not invalidating if released in same frame.
  • Core: tweaking warning messages when fill images contain invalid data.
  • Core: fixing containers sometimes affecting masked objects (casenum 46668).
  • Core: fixing crash when changing masks within frame (casenum 46685).
  • Windows: Improved clarity of text in top-right corner of the Welcome window (was blurry).
  • Add total elapsed time to the “build succeeded” line for all build types.
  • OS X, Windows: change build process to download built app directly from S3 to improve build latencies. No casenum.
  • tvOS Enterprise: fixing various issues with bitcode.
  • OS X: improve dafaults for Build dialog. Casenum 44272.
  • Make the location of the output archive more deterministic.
  • OS X: improve logging performance under some circumstances. No casenum.
  • Fix issue with some iOS plugin builds.
  • OS X, Windows: improve unconfigured plugins warning message. No casenum.
  • Android: Fixed an issue introduced in build 2016.2825 where media.selectPhoto() andmedia.selectVideo() would fail on devices older than Android 4.1. Casenum 46579.
  • OS X: don’t warn incorrectly about plugins in Desktop apps. Casenum 46336.
  • OS X: fix issue with downloading very large apps during builds. No casenum.
  • OS X: fix performance issues with native controls and mouse cursor on some computers. Casenum 46495.
  • OS X: fix issue with running Simulator on OS X 10.9. No casenum.
  • Remove references to [NSString constainsString:] and replace with[NSString+Extensions contains:].
  • OS X: stop mouse and location events firing when Simulator is suspended. Casenums 46574, 44126.
  • OS X: don’t include build.settings in built app. No casenum.
  • Android – Enterprise: Maintenance.
  • Android – Enterprise: Fixed an issue wherePermissionsServices.findAllPermissionsInManifestForGroup() would return null if a permission was requested that doesn’t exist on the device, e.g."" on a non-Samsung device. Casenum 46616.
  • Android: system.hasEventSource(“heading”) no longer assumes all Android devices have compass hardware.
  • tvOS: adding native.showPopup(“appStore”); fixing error message for iOS.
  • iOS Enterprise: added CoronaEventDataKey().

GameDev News

Month List

Popular Comments

Add-On Brings Easy PBR TO Blender
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

1. February 2016


PBR, Physically-Based Rendering, is the new hotness in the CG world, especially with the increasing popular of Substance Painter.  The end result of that process is a number of textures specifically for channels such as Roughness, Metallic, etc.  Taking the results from Substance to Blender however hasn’t always been the easiest.  Now there exists a plugin for easily consuming PBR textures in Blender using the Cycles renderer.

From the product page:

Easy PBR right inside Cycles!

With the rise of PBR in the AAA game industry and Allegorithmic’s wildly popular Substance toolset, it’s about time someone created a simple solution for implementing PBR textures inside of Blender. Finally, no more fiddling for hours with material nodes trying to vaguely make something that looks good. Now there’s one solution that gets it right every time and in every lighting condition! Liberate yourself as an artist to focus on your art!

Plug and Done!

Based on a PBR Metal/Rough workflow, all you have to do is import your textures, plug them in, and you’re ready to go! This node group supports maps for:

  • Base Colour (Albedo, Diffuse…)
  • Ambient Occlusion
  • Roughness
  • Metallic
  • Normal
  • Emission

It adds a new shader node to Blender that makes it easy to wire up the appropriate maps:


While not free, it does cost less than 5$.

Art, GameDev News

blog comments powered by Disqus

Month List

Popular Comments