Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon
2. April 2018

 

LÖVE 11.0 was released yesterday… yes, on April Fools day.  You may notice that GameFromScratch.com goes silent every April 1st I take a holiday from the internet to avoid the “humour”.  Turns out this was actually a real release and yes, they did in fact rebrand their versioning, by going from 0.11.x style numbering to 11.0 to represent that maturity of the product.  I personally agree with this change (although not the date of the announcement) as the low version numbers really hid just how mature a library love was. 

As to this release, there is actually quite a bit going on here.  Quite a few upgrades in the audio department, a move to normalized numbers for colour data as well as >8bit colour support.  The actual full list of changes is pretty massive, here however are the highlights from the forum:

  • Loads of audio additions:
    • Queueable audio sources
    • Recording support
    • Support for audio effects and filters
    • A simplified Source API
  • Added a love.data module, containing functions for encoding, hashing and compression
  • Added Transform objects to love.math
  • Added more ImageData formats, Image formats, and new texture types
  • Added support for depth buffers
  • Added a deprecation mechanism
  • Added automatic batching
  • Deprecated love.filesystem.exists / isFile / isDirectory / isSymlink / getLastModified / getSize in favour of getInfo
  • Changed colour values to be in the range 0-1, rather than 0-255
  • Changed love.run, to support co-operative multitasking environments

 

If you are interested in learning more about Love, be sure to check out our complete tutorial series available here.

GameDev News


1. November 2016

 

LÖVE is a popular Lua powered cross platform 2D game engine.   Its an accessible framework that I highly recommend to beginners, in fact it’s the framework I used for my GameDev For Complete Beginners tutorial series.  They just released a new version, 0.10.2, which is a relatively minor update.  One of the changes is the release of lovec.exe on Windows, which includes a command line console if one isn’t already present, a handy feature for debugging.

 

Other changes and fixes from the change log:

Additions
Deprecations
  • Deprecated undocumented Shader:sendTexture, Shader:sendMatrix, Shader:sendInt, Shader:sendFloat, and Shader:sendBoolean methods.
Fixes
  • Fixed love on iOS 6.
  • Fixed os.execute always returning -1 on Linux.
  • Fixed the love.lowmemory callback to call collectgarbage() after the callback has fired, instead of before.
  • Fixed love.math.noise(nil) to error instead of returning nil.
  • Fixed an occasional crash when a Thread ends.
  • Fixed a hang at the end of video playback with some video files.
  • Fixed the video decoding thread to not do any work when there are no videos to decode.
  • Fixed love.graphics.newVideo(file) to no longer error if love.audio is disabled.
  • Fixed a rare bug in Source:play for streaming Sources if the associated OpenAL source object was previously used for a static Source.
  • Fixed corrupted Font glyphs in rare cases.
  • Fixed stencils inside Canvases on some OpenGL ES 2 devices.
  • Fixed an OpenGL error in OpenGL ES 3 when multiple render targets are used.
  • Fixed love.window.setMode crashing when called with a Canvas active.
  • Fixed love.window.maximize to update the reported window dimensions immediately.
  • Fixed gamma correction of ImageFonts and BMFonts with colored images.
  • Fixed the default shader improperly applying gamma correction to per-vertex colors when gamma correction is requested but not supported on OpenGL ES.
  • Fixed text coloring breaking because of an empty string.
  • Fixed large burst of particles when dramatically increasing the emission rate of a ParticleSystem.
  • Fixed SpriteBatch:setBufferSize to keep old sprite data if it can fit.
  • Fixed MouseJoint:getBodies unconditionally erroring.
  • Fixed memory leak in Text:set.
  • Fixed incorrect kerning caused by using kerning information for the wrong character in some fonts.
  • Fixed ImageData:setPixel, ImageData:getPixel, ImageData:mapPixel, SoundData:setSample, and SoundData:getSample to properly handle non-integer coordinates.
Other changes
  • Improved performance of Channel methods by roughly 2x in many cases.
  • Improved performance of Shader:send when small numbers of arguments are given.
  • Updated love.filesystem.mount to accept a DroppedFile as the first parameter.
  • Updated Shader:send to do type and argument checking based on the specified uniform variable's information instead of the arguments to the function.
  • Updated Shader:send to accept a flat table for matrix uniforms.

 

Love is free and open source, available for download here.

GameDev News


22. March 2016

 

This page is in support for the video tutorial on using Sprites/Images in Love as part of the GameDev For Complete Beginners tutorial series.  It contains the code and images used in the tutorial.  There is also a copy of the tutorial embedded below.

 

Images

The graphics are from this pack of images, made transparent using this process.

ALC-17AttackChoppers

 

Simply right click and save to your project directory.

 

Source Code

Drawing an Image

local imageFile

function love.load()
    imageFile = love.graphics.newImage("ALC-17.PNG")
end

function love.draw()
    love.graphics.draw(imageFile)
end

 

Using a Spritesheet

local imageFile
local frames = {}

local activeFrame
local currentFrame = 1
function love.load()
    imageFile = love.graphics.newImage("AttackChoppers.PNG")
    frames[1] = love.graphics.newQuad(0,0,128,64,imageFile:getDimensions())
    frames[2] = love.graphics.newQuad(128,0,128,64,imageFile:getDimensions())
    frames[3] = love.graphics.newQuad(0,64,128,64,imageFile:getDimensions())
    frames[4] = love.graphics.newQuad(128,64,128,64,imageFile:getDimensions())
    activeFrame = frames[currentFrame]
    print(select(4,activeFrame:getViewport())/2)
end

function love.draw()
    --love.graphics.draw(imageFile,activeFrame)
--[[    love.graphics.draw(imageFile,activeFrame,
        love.graphics.getWidth()/2 - (select(3,activeFrame:getViewport())/2) * 2,
        love.graphics.getHeight()/2 - (select(4,activeFrame:getViewport())/2) * 2,

            0,
            2,
            2)
]]--
    -- draw image 4x size centered
    love.graphics.draw(imageFile,activeFrame,
        love.graphics.getWidth()/2 - ({activeFrame:getViewport()})[3]/2 * 4,
        love.graphics.getHeight()/2 - ({activeFrame:getViewport()})[4]/2 * 4,
        0,
        4,
        4)
end

local elapsedTime = 0
function love.update(dt)
    elapsedTime = elapsedTime + dt

    if(elapsedTime > 1) then
        if(currentFrame < 4) then
            currentFrame = currentFrame + 1
        else
        currentFrame = 1
        end
        activeFrame = frames[currentFrame]
        elapsedTime = 0
        end
end

 

 

The Video

Programming


14. February 2016

 

A new version of Love, the popular Lua based 2D game engine, was released today.  Release 0.10.1 brings:

Additions
Bugfixes
  • Fixed a Lua error in the no-game screen if the window's height is too small.
  • Fixed the default error handler to reset the mouse Cursor.
  • Fixed love.filesystem functions crashing when called if liblove is used directly without calling love.filesystem.init.
  • Fixed audio on Android to pause when the app is inactive, and resume when the app becomes active again.
  • Fixed Source:setRelative to set the relative state of playing Sources to the passed value rather than an old cached one.
  • Fixed the Video decoding thread hanging after Video:seek or when a Video finishes.
  • Fixed Video:isPlaying to always return false after it finishes playing.
  • Fixed RandomGenerator:random crashing if a nil 'self' is used.
  • Fixed loading BMFont files which have characters with 0 width or height (a space character, for example).
  • Fixed love.graphics.newFont causing crashes if FileData is passed in.
  • Fixed love.graphics.clear(colortable) causing crashes on OpenGL ES 2 systems when a Canvas is active.
  • Fixed love.graphics object creation functions (e.g. love.graphics.newImage) to error instead of crash, if called before a window has been created.
  • Fixed a driver bug on some Android devices which caused all objects to show up as black.
  • Fixed a driver bug on Windows with AMD graphics cards where love.graphics.clear would not always work.
  • Fixed Shader:sendColor incorrectly converting alpha values from sRGB to linear RGB when gamma-correct rendering is enabled.
  • Fixed love.graphics.newMesh(vertices) double-converting colors from sRGB to linear RGB when gamma-correct rendering is enabled.
Other changes
  • Updated the Windows executable to prefer the high-powered AMD graphics card on systems which have switchable Intel+AMD GPUs.
  • Updated love.touch.getTouches to return the list of IDs in the relative order that the touches initially happened (i.e. the first ID in the list is the least recently pressed touch that is currently active), instead of being in a random order.
  • Updated the error messages caused by invalid or bad arguments to ImageData and SoundData methods to be more descriptive.

If you are interested in learning more about Love and Lua I featured it in this multi-part video tutorial series for beginning gamedev.

GameDev News


25. January 2016

 

I am currently embarking on a rather massive “from scratch” beginners game programming series over on YouTube.  One thing that can make the process a hell of a lot smoother for a beginner or veteran alike is a good development environment.  As a result I’ve created this page, a summary of the best editors and IDEs for development in Lua using Love specifically.  This list contains both full blown IDEs as well as text editors that can be configured to work better with Lua or Love2D.  Of course the line between text editor and IDE can be extremely blurry at times, so the distinction doesn’t really matter.  Unless otherwise stated, all options on this list are cross platform and have a free version available.

 

ZeroBrane Studio

If in doubt, select this one.  It’s probably the easiest to configure and perhaps the most Lua and Love focused option out there.  With the least amount of effort you will get the most amount of functionality including code highlighting, autocompletion and most impressively, debugging support.

 

IntelliJ IDEA with Lua and Love2D plugins

Probably not the ideal choice for beginners, as the IDE itself is rather complicated and you have to configure two different plugins to get things up and running.  That said, this is the IDE I will be using for the tutorial series simply because it has an excellent presentation mode, making it good for video demonstrations.  With the plugins you get full autocompletion, syntax highlighting and can run your app directly from the IDE.  You can’t unfortunately debug.  I have done a video on configuring IntelliJ for Love development available here.

 

Sublime Text with the Love2D Package

Sublime Text is well named, it’s a great text editor, that through package support can get awfully close to full IDE capabilities.  It was my go to general purpose text editor for years and is still a very solid option.  With the Love2D package you get syntax highlighting, autocompletion and the ability to run your app directly in the editor.

 

Atom Editor with the Love-IDE collection of packages

Atom is another editor, very similar in scope to Sublime Text with probably even greater extensibility.  The Love-IDE extension brings together a collection of Lua and Love2d plugins to give Atom the ability to run from within the editor, autocompletion and syntax highlighting.  I personally find atom kind of slow though, especially to start up.  As I find myself loading and closing editors constantly, this becomes a more pronounced negative over time, at least to me.

 

Notepad++ with Autocompletion Plugin

Another free text editor that can be extended to support Lua and Love development.  Using the linked extension it is possible to get autocompletion, however the file is out of date and has only been updated up to Love 0.8.0.  There may be a more modern implementation somewhere.  As it stands, unless you are invested in Notepad++, I have trouble recommending it over the other great options in this list.

 

Eclipse and the LDT Plugin

The Eclipse IDE can also be extended to support Lua development using the LDT plugin.  I would rather swallow razor blades while juggling live hand grenades than use the Eclipse IDE, but hey... I’m trying not to let my bias show, so I added it to this list.  Some people love working in Eclipse, so this may be an option for you.  Warning though, Eclipse is extremely unfriendly to beginners, requiring a PHD in Obtuse UI design before mastering... oops, bias showing again. 

 

Decoda Lua IDE

This is the only option on this list I have no prior experience with.  It started life as an editor for Lua scripts for the game Natural Selection, then was released as a commercial Lua IDE, then finally was made free and open source.  Following these instructions it can be made to debug Love code.  Decoda is available on Windows only.

 

Visual Studio with BabeLua Plugin

Visual Studio is perhaps *the* IDE for Windows based developers and thanks to the somewhat recently released Community Editions, it is now available for free.  With the BabeLua plugin you get the full package, autocompletion, syntax highlighting and best of all, debugging.  For a beginner however, Visual Studio can be a bit daunting, not as bad as Eclipse, but probably comparable to IntelliJ in complexity.  Thanks to SiENcE for the heads up.

 

 

There are of course a few hundred other options including the ages old VIM and EMACS editor, or for those that like pain, you can use the text editor including with your OS such as Notepad or TextEdit, but you will certainly be leaving a lot of functionality on the table!  Did I miss a popular option?  If so, let me know!

Programming


GFS On YouTube

See More Tutorials on DevGa.me!

Month List