1.5 Release: Physics engine, TypeScript support
This version 1.5 update focuses on the lack of features for action games large-scale project development, through the provision of physics engine, camera and TypeScript support.
Cocos Creator is now able to develop all kinds of action games and large projects for much better experience. In addition to the high expectations of the community requested new features, we once again optimized the engine load logic, a substantial increase in the scene loading and parse speed; In addition, we refactored the Windows desktop and Android platform Label and EditBox implementation, greatly enhanced the experience and compatibility.
Highlight features
- Integrated Box2D physics engine, add rigidbody and joint components
- Add Camera components to support high speed scrolls without loss of performance
- TypeScript and ES6 Class support, fully enhanced IDE code prompt
- Optimize the scene loading process, the scene load speed increased by 38%
- Cross-project assets export / import, assets dependencis will be automatically associated.
- Enhance the experience and compatibility of Label and EditBox in the Windows desktop platform and Android platform
- Improved hot update with continued download after connection broken.
Below we will list details of key new features.
Integrated Box2D physics engine
Cocos Creator in the 1.5 version has finally integrated the well-known physics engine Box2D, this easy-to-use powerful physics engine will bring a comprehensive physical detection and computing power to Cocos Creator to fully support your actions and physical games.
In addition to the common physics engine functionality, Cocos Creator’s integrated physical system incorporates Rigidbody and Joint components, plus Collider components tailored specifically for the physics engine. You can achieve interesting interactive effect just by placing a variety of different physics components in your scene. With the newly added Camera components, the editor can build scroller game levels with rich content very easily!
Camera component
In the development of action and adventure games, the change of viewport or screen scroll across scene is essential. In earlier versions developers can only move all nodes of scene to simulate the effect of perspective movement, but a large number of node displacement operations will affect performance, especially after integrate physics engine. Each time moving the collision body will lead to the regeneration and calculation of the physical world.
And in the 1.5 version Camera component can be added to solve the problem of moving perspective. Camera component can specify one or more nodes as the camera rendering target. You can drag the root node of the scene into the Camera target list, then just move the node with Camera component will give you the effect of viewport moving across the scene. Camera rendering is achieved through the matrix operation, so the scene will not bring in additional overhead
TypeScript and ES6 Class support
In order to better support coding in various IDEs (such as VS Code, WebStorm, etc.) with full code prompt and auto complete, we made a refactoring of the declaration of cc.Class in version 1.5 and can now use ES6 or TypeScript to declare components and write game logic in Cocos Creator.
Many users who have experience with strong typed language before using Creator give feedback about poor code prompts and automatic completion. This is mainly due to the editor needs the special declaration format for data serialization. But major IDEs cannot recognize the format for properly code parse and code prompt. In this version’s refactoring we introduced the decorator syntax to help the editor to identify the data, and then we can use ES6 and TypeScript standard syntax to declare cc.Class and cc.Component. Use the standard syntax will make sure all mainstream IDE can parse the code correctly and can correctly prompt almost all the relevant interface code!
TypeScript supports strong typing declarations that provide more accurate interface communication specifications and error reporting for large projects that are collaboratively developed. Recommend the relevant strong type of language development experience and large-scale project technical team to try!
Scene loading speed increased by 38%
The biggest advantage of web game is instant play without installation, so web game scene loading speed, especially the initial scene loading speed is essential for user experience and retention. This update has included many optimization for scene asset loading, using the object pool to greatly reduce the frequency of object creation in the uuid-loader and deserialize modules, with a 38% increase in scene loading speed during local preview. But the actual project load speed bottleneck may come from the network connection speed, so the actual game speed increase depends on network settings, but basically there will be 200ms ~ 300ms improvement at least.
Cross-project asset import / export
In the previous release, we implemented the functionality of sharing a asset folder between projects by editor extension system, but there were more users who wanted us to provide a simpler, more direct, cross-project import and export mechanism, so that we can export assets from existing projects into new projects, or separate art and developer projects.
Through the main menu “File -> Import / Export Assets” to open the assets import and export tool. We can easily drag a scene or Prefab for export, the tool will automatically list the assets dependencies, then automatically generated zip package for all exported asset files. In another project you can easily import the zip package. If you encounter uuid conflict you can also choose to automatically update uuid to retain two versions of the assets.
Full changelog
Editor
- [Scripting] Add support for TypeScript script, add support for ES6 Class declaration for cc.Class and components. Enhanced code prompts in mainstream IDEs.
- [Editor] Add asset export/import tool with full dependencies.
- [Editor] Only one part of the large-size code file is previewed in the Properties panel to improve the editor performance when browsing large files
- [Editor] Add the option “Load in the editor” for the script assets when checked “Import as plugin”. To determine a plugin script whether should be loaded in the editor, to improve the efficiency of the scene open.
- [Editor] Exports all CCClasss for all project scripts by default.
- [Editor] When the custom engine path fails to load, an error is reported and an attempt is made to use the built-in engine
- [Editor] Fixed the issue when quit editor after modify the scene, and choose save in pop-up dialog cannot save the scene properly.
- [Editor] Add
update-db
API in preview server so that you can send request to the preview server to trigger asset import and script compilation. - [Editor] Fix the alpha value of cc.Color will be deserialized wrongly when set to 0.
- [Editor] Fix the problem when you cancel the save file dialog an error will be reported.
- [Assets] Fixed sub-meta import failure does not show the error message issue.
- [Assets] Add the “Open asset in library” option in the context menu of Asset panel.
- [Assets] Fixed error when creating Prefab by dragging a scene node to Assets panel:
typeError: s.canAddChild is not a function at assets-tree._onDropAreaMove
- [Build] Fix compilation failure errors that may occur when building and compiling window and android platforms with binary templates
- [Build] Combine SpriteFrame asset json file in an atlas into a single file.
- [Build] Fixed command line build failed when the preview page is not closed.
- [Build] Fix the issue of increased file count when building with
inline all SpriteFrame
option in some cases - [Build] supports the use of Android Studio 2.3+ and Build Tools 25 to build Android projects
- [Build] Fix AutoAtlas on windows does not generate spriteFrame information correctly into
settings.js
issue. - [Build] Add custom build and compile event callback for editor extensions.
- [Build] Fix the problem with wrong
ndk.dir
field name inlocal.properties
when building Android Studio project - [Build] supports the use of Visual Studio 2017 to build native projects
- [Prefab] Added dependency async loading option on Prefab asset
- [Prefab] Fixed when save automatic synchronization prefab refers to other prefab assets will report error issue.
- [AutoAtlas] Fixed AutoAtlas created in
resources
folder will not add spriteframe information to the settings in thesettings.js
issue. - [ProjectSettings] Fix the problem that the Properties panel not updated in time once group setting changed.
- [ProjectSettings] Fix the problem of setting the simulator orientation vertical and horizontal does not take effect.
- [Preferences] Fix preferences -> Native development environment, when the javascript or cocos2d-x engine path is not specified, the settings can still be saved.
- [Preview] Replaces the FPS display module for web platform preview, adding more debugging information
Engine
- [Render] set
cc.macro.FIX_ARTIFACTS_BY_STRECHING_TEXEL
macro back to 0 to fix the problem that the surrounding pixels of texture will be cut off. But this change will cause the issue that tiledmap may produce a black seam when zooming and paning. You can fix it by generate a tiledmap map with extruded pixel around each tile (If you use the shoebox to generate a map, you need to set extrude to 1, padding is set to 2) - [Engine] Optimized the deserialization and download of asset operations when the web platform loads scenes. In the local preview the speed of scene loading may increase by 38% (the bottleneck still depends on the speed of the connection when the resource is loaded, and the actual speed boost may be lower than that)
- [Engine] In CCClass declaration’s editor properties add the
executionOrder
field to control the script execution order - [Engine]
cc.loader.loadResAll
has been renamed toloadResDir
, addedloadResArray
interface, used to pass the same type of asset url array - [Engine] Enabled multi-touch events on the iOS device, now you can correctly use the two-finger zoom and other gestures
- [Engine] Fixes customEventData in the EventHandler component may change to an invalid value in the script
- [Engine] Fixed an issue where the
capInsets
setting was invalid when the Sprite component was not activated - [Engine] Fixed native platform using the relative path to load the tmx file will report error issue.
- [Engine] Optimize the use of DOM Image memory, delete dom image after handleLoadedTexture, and use the object pool reuse dom image to reduce the memory footprint
- [Engine] Add
pauseAllActions
andresumeAllActions
interfaces on cc.Node - [Engine] Add
pauseSystemEvents
andresumeSystemEvents
interfaces on cc.Node - [Engine] Upgrade the C ++ engine’s Audio and Network related code libraries
- [Engine] Fixes crash when loading scenes with async asset loading that use the LabelAtlas font asset.
- [Engine] Fixed calling
cc.loader.release
on prefab loaded by script will not release dependent asset issue. - [Engine] Fixed deactive node in
onLoad
may lead toonLoad
callback not triggered on sibling node. - [Engine] Fixed when the width or height of Scale9Sprite is set to 0, the sliced ​​mode will lead to data calculation error issue.
- [Engine] Fixed issue when some of the UI nodes call
removeFromParent()
after unload the scene, the UI object’s cleanup function will not be called correctly, resulting in the native platform ui control memory can not be cleared. - [Engine] Fixed an issue where a registered event on a node might be triggered when a non-active node was added to the node tree
- [AssetManager] adds more progress information to the progress callback, including: total bytes, downloaded bytes, total number of files, number of downloaded files, and recovery from recovery.
- [AssetManager] Fix
setVersionCompareHandle
in theinit
process can not take effect - [AssetManager] supports dynamic creation of manifest files and manual loading of local and remote manifests
- [AssetManager] Fixed restart download cannot be completed after connection fail.
Components
- [Physics] Supports Box2D physics engine
- [Camera] Add Camera component
- [Animation] Fixes the use of
cc.instantiate
clone when the animation node is animated playOnLoad does not take effect - [Animation] Fixed animation delay setting is invalid
- [Animation] Fixed an issue where the Animator object might leak when the node where the Animation node moved out of the node tree and then the node’s destroy operation
- [Animation] Fixed the issue that add new component in the animation edit mode and edit the problem that will cause the error
- [Animation] Fixed set asset with empty uuid will cause error issue.
- [Animation] Fixed in animation editing mode, change the delete clip will lead to crash issue
- [Particle] Fixed set auto release on particle component may cause error issue.
- [Particle] Fixes the issue of using the animation editor to edit the particle position may cause error.
- [BMFont] Fix the imported file in the file where the path is an absolute path when the import error will be reported
- [Label] Refactored Label implementation on windows desktop platform to achieve the following problems:
- Word wrap, Shrink and other text overflow effect is invalid
- Single line text box is displayed as multiple lines when inputting content
- The text box will only show the first few characters
- Text can not be aligned when multiple lines of text are entered
- [Label] Fixed iOS platform shrink mode will not show complete text content issue.
- [Label] You can use the
fontFamily
attribute to specify the font type when using system fonts - [Label] Fixed BMFont in the native platforms will cause memory leak problem
- [Label] Fixed bug where bmfont switched fonts will cause spaceX property fail to take effect.
- [Toggle] modifies the timing at which the Toggle component sends events and sends events after the other toggle state changes
- [Toggle] When
isChecked
now sets the target node’s active instead of setting the target node’ssprite.enabled
- [ToggleGroup] Now calls
addtoggle
when it needs to be enabled - [EditBox] Refactored EditBox in the windows desktop platform to achieve directly in game interface to enter the text, no longer need to pop up a dialog box.
- [EditBox] Improved EditBox compatibility on the Android platform: Fix the first time you click on the input box may not be able to pop up the keyboard problem; Fixed input before and after the font size is not uniform; Fixed switch EditBox single and multi line mode shows incorrect alignment problem.
- [EditBox] Fixed
textChanged
event callback count on the native platform is not correct - [EditBox] Fixed the problem that the native platform displays double text when the string attribute is modified in the
textChanged
event - [EditBox] Fixed modifies
EditBox.string
in event callback will cause incorrect cursor position issue; Fixed switch single and multi-line mode, EditBox window adaptation is not correct issue. - [ScrollView] Fixed scrolling to the border events that can be fired multiple times after setting elastic rebound.
- [ScrollView] Fixed the problem of inertia scrolling cannot bounce back to initial position, Fixed the issue using script to execute
removeFromParent
and then add it to the node tree will be unable to scroll. - [VideoPlayer] Add embedded video playback (inline play) mode for iOS platform.
- [VideoPlayer] Fixed video cannot be played in iOS 10 browser issue.
- [VideoPlayer] in toggle visibility, no longer remove dom, but only modify visibility
- [WebView] Fixed webview size in iOS browser is not correct
- [WebView] Fixed webview in chrome 58 may not work issue,
toggleVisibility
will no longer remove the dom node.
If you have any questions or problem regarding the new features of v1.5, please discuss here!