Don't Miss Out

Follow us now so you don't miss new releases!

Construct 2 Release r124

There is a more up to date Stable Release! Download the latest Stable release instead here.

110.7 mb, Windows 8/Windows 7/Vista/XP

Tuesday, April 2, 2013

New in this release: full state save and load, persistent layouts and continuous preview!

Previously WebStorage allowed you to save and load simple values, such as the current level or checkpoint reached. However it was difficult to use WebStorage to save an entire game in the middle of the action - so you can save at any time, and resume with the game exactly where you left off. This is what the full-state save and load actions in the System object now allow. The other features are explained further below.

Full-state saving and loading

The new Save and Load system actions can be used to save the complete state of the game easily. Everything from object positions, sizes, angles, opacities, each of their behaviors, all their instance variables, effect parameters, global variables, and so on - are all saved in to a big block of data. You can save to different "slots" - e.g. "save1", "save2", "save3" and "quicksave" - to allow keeping multiple separate savegames on the same computer.

The full-state save-games can be quite large, since they store every last detail of the game state. They can easily be over a hundred kilobytes. WebStorage is limited to 5mb on most browsers. This is probably enough for even a large game to store several savegames. However for peace of mind there's a new IndexedDB storage system for save games. IndexedDB is a new database-like HTML5 feature supported by most modern browsers (check if your browser supports it with ScirraMark, and note node-webkit does support IndexedDB). It has much larger storage limits, usually at least 50mb or so. When supported, savegames get stored in IndexedDB. This means the savegame data doesn't contribute to the 5mb WebStorage quota, allowing you to safely use WebStorage for other things. If IndexedDB is not supported then it still uses WebStorage, which should be fine for all but the very largest games using many save slots, and IndexedDB is getting more support from browsers over time anyway.

You can even access the JSON data of the save state directly, and load from JSON strings. This means if you have a server-side, you can AJAX post save games to your server. Then your players could share their savegames across browsers and devices!

Some considerations

Full-state save and load is a very complicated feature. It touches almost every aspect of the runtime, and support has to be written for each individual plugin and behavior. This means existing third party plugins and behaviors won't support it until the developers update them. Also for some plugins and behaviors the state is quite complex. A few examples are: the Audio plugin restores the currently playing audio at the correct playback time, with any positioning and effects; the Pathfinding behavior tries to restore pathfinding operations that were still calculating when the game was saved; and the Physics behavior does its best to restore the forces and velocities at the moment of save. This means bugs may be relatively likely and affect only certain plugins and behaviors. Please be vigilant and report bugs with loading savegames using the full form in the Bugs forum if you encounter any issues.

There are also several things that Construct 2 makes no effort to save. These are generally network related things that are impossible, difficult or unreliable to try to save and load. For example, in-progress AJAX requests are not saved or loaded; WebSocket connections are not reconnected; the XML object won't save its currently loaded document; the User Media object won't try to re-start a video feed if it was live when saving; the Facebook object won't log you in again if you were logged in when saving; and of course the WebStorage state is not saved or loaded. I don't anticipate this to be a problem, but it's worth bearing in mind.

Savegames should be relatively robust to changes in your project. You should be able to do things like rename objects, add and reorder instance variables, adjust behaviors and so on - all without stopping old savegames from still loading correctly. However note if you make major changes, such as deleting layers, entire object types, or even removing entire layouts, Construct 2 won't be able to associate a lot of the data with anything, and old savegames may load strangely. Also note if you add something new, existing savegames won't have any data for it, so the object will act as if it has the 'No Save' behavior when loading (see below). So if you have already published a game and want to make sure savegames keep working as intended, be careful what you add and remove.

New related behaviors

There are also two new behaviors which are useful and are related to the full-state saving and loading.

First, the new No Save behavior simply omits the object from save game data. This also means when loading, the object isn't touched and all the old objects from before the load are still there with the same properties. This can be useful if you have trouble with savegames being too large or slow to load. You can easily omit static scenery objects which aren't necessary to save, for example. You also might want to make savegames smaller to post to a server quicker, or you simply want to keep some data after loading (e.g. only allowing the player to load a limited number of times). A good example of using the behavior is in the Rain Demo: the majority of the objects are raindrops and splashes, but they run automatically and don't really need saving. By adding the No Save behavior the savegame size reduces from about 100kb to 20kb (5 times smaller!) and the visual difference is virtually imperceptible.

Second, the new Persist behavior allows you to make persistent layouts. Normally if you leave a layout then return to it, all its objects have reverted to the initial state as you designed in the editor. Sometimes this is annoying if you want, say, the player to return to a previous level but with all the enemies they killed and powerups they collected still gone. Now you can simply add the Persist behavior to objects you'd like to remember - in this case, the enemies and powerups. Then on returning to the layout, all those objects are exactly as you left them. This is great for non-linear games where you want the player to come through a previous section, but without having to re-do everything they did before.

Continuous preview

This is the most experimental of the new features, but also potentially very powerful. While testing save/load, it became obvious the save/preview/load cycle was useful. It allowed you to make changes to a level and preview them without resetting the level back to the start. So this has been automated with continuous preview: simply hold shift and click Preview (or Shift+F5) and the game will execute a save, reload project, and load cycle. The URL will also end with "?continuous" to indicate a continuous preview. This means you can alter events as you play the game, and also makes it possible to design levels as you play them. Note your scenery objects must have the 'No save' behavior for design-as-you-play to work, otherwise loading will faithfully load the previous state of the scenery. However it allows for intriguing possibilities; imagine play-testing a level for 5 minutes, finding some misplaced scenery, correcting it in the editor, then continuing from where you left off with the corrected level. No need to reset back to the beginning and play through for another 5 minutes!

The new Pause on unfocus project property is designed to be useful with continuous preview. If enabled, when you switch focus back to Construct 2 the game pauses. This prevents your player being killed, running out of time, or whatever, while you're back in the editor making changes. Then you can continuously preview from the point it got paused.

As mentioned, this is somewhat experimental; we're still working out the best way to fit it conveniently in to the workflow, so suggestions are welcome. It's also currently difficult to use for objects which are saved, like the enemies in levels. If saved, continuous preview will faithfully load them as they were saved, ignoring any changes you made in the layout view. We're thinking about ways we can improve this so you can still continuously preview changes to saved objects.

Happy testing!

There's a lot new this build! Have fun trying it out and don't forget to report any issues you find. Hopefully we will have a stable release coming up soon, but since there were a lot of changes in this release we may leave it a while to ensure these features are reliable. Happy testing!



Full-state save/load


Continuous preview


'No Save' behavior


'Persist' behavior


'Pause on unfocus' project property


List object: new ItemTextAt expression


Objects placed in layouts are now assigned UIDs in the editor. The selected object's UID is also now shown in the Properties Bar. This allows you to safely refer to individual instances placed in the editor by using 'Pick by UID'. However note that objects created at runtime are still dynamically assigned UIDs.


The engine now automatically focuses the game on click or touch events. Hopefully this will help resolve focus issues with iframed games.


Attempted workaround for some graphics driver crashes when first opening a layout. This is based on a tip we received; we don't know if it will really fix anything, so please let us know if you had crash issues that are fixed (or if anything's been broken!)

Bug Fix

'Replace object' did not always enable the save button

Bug Fix

Image editor: could not always type negative numbers in to tool options

Bug Fix

AJAX: finally found a work-around for a long-standing CocoonJS bug. AJAX requests should now work in CocoonJS.

Bug Fix

Duplicating a layout now sets the duplicate to use the same event sheet as the original (previously it was set to none)


Text objects in the WebGL renderer now release their internal surface and texture if they go off-screen for about 5 seconds. This should help improve memory performance when using large numbers of text objects.


[SDK] Plugins and behaviors can now use saveToJSON() and loadFromJSON() to work with the new full-state save feature. A new SDK template should appear shortly


firebelly 7,294 rep

This looks awesome!

Tuesday, April 2, 2013 at 7:21:46 PM
BluePhaze 14.7k rep

Woot, Damn awesome guys! Can't wait to give the save state options a go, and the persistent layouts seems like a great addition as well!

Tuesday, April 2, 2013 at 7:24:37 PM
Przemek32767 25.4k rep

Very interesting release. I shall play around with it now. Also, it seems I should get a "Lightning Draw" badge but got "Quick Draw" instead.

Tuesday, April 2, 2013 at 7:26:13 PM
SuperMoi 2,795 rep

Woooooooooooooooooww great ... please an example of the new save/load :D

Tuesday, April 2, 2013 at 7:27:29 PM
theubie 6,088 rep

Woah. Now this reaches the level of epic. Great!

Tuesday, April 2, 2013 at 7:28:20 PM
siks 9,435 rep

Holy crap this is AMAZING!

Tuesday, April 2, 2013 at 7:29:00 PM
RisalLaw 3,225 rep

Cool! Downloading... :)

Tuesday, April 2, 2013 at 7:31:42 PM
EivindLervik 2,448 rep

Oh yeah! Looks fantastic!

Tuesday, April 2, 2013 at 7:32:28 PM
jardelbr 4,893 rep

OMG!!! This is Fantastic! all things im looking to resolve about save state in my Project in one update!!!!!!!

SCIRRA >>>>>>>> WORLD !

Tuesday, April 2, 2013 at 7:34:39 PM
BluePhaze 14.7k rep

Can't believe that this was not mentioned as one of the major features as I have seen so many threads and mentions of this issue:

AJAX: finally found a work-around for a long-standing CocoonJS bug. AJAX requests should now work in CocoonJS.

Tuesday, April 2, 2013 at 7:34:46 PM
NotionGames 14.4k rep

this will help me out big time for Super Ubi Land!

Tuesday, April 2, 2013 at 7:36:29 PM
Squid 5,575 rep

More good stuff.

Tuesday, April 2, 2013 at 7:39:02 PM
danny 6,018 rep

Great updates.

Tuesday, April 2, 2013 at 7:39:09 PM
rcorreiapt 1,682 rep

"Continuous preview" thank you scirra really i just wanna say i really big thank you.

Tuesday, April 2, 2013 at 7:39:12 PM
danuyos 12.5k rep


Tuesday, April 2, 2013 at 7:39:36 PM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.