Showing posts with label Gamedev. Show all posts

Omega Warp SimpleGamer Interview




A great interview by Fabio (from SimpleGamer) about the development of Omega Warp and the challenges of creating indie games!

And for fellow indie developers, here's an excerpt from the interview: “The most important thing is to make games: make several small games, participate in GameJams, study the area you want to work in, whether through courses, books, tutorials, and more. Seek help in online communities and groups and in local communities in your region. There are always associations or people who can help, especially for those who are starting out.”

Check out the full interview below:

🎙️ SimpleGamer Interview 🎮

Godot Engine 3.6 Released


After 2 years of development, Godot 3.6 is finally out and it comes fully packed with features and quality of life improvements! Check the Godot Official Announcement and the Godot Changelog for more info:

- Add 2D physics interpolation.
- Add hierarchical culling for 2D items that are off-screen.
Tighter shadow culling.
- Add comprehensive system for mesh merging.
- Discrete level of detail (LOD).
- Vertex cache optimization.
Light probes and directional shadows performance improvements.
- In-editor documentation for Editor Settings.
Updated toolchains for official builds.
- Several bug fixes and usability improvements.





Projects comming from Godot 3.5.x are compatible with Godot 3.6, because this is not a major version (as Godot 3.x to Godot 4.0) and is a recommended upgrade for all 3.5.x users. Check out the Official Documentation for more info.

With the release of Godot 4, Godot 3 continue to be supported for a while, being considered an LTS (Long Term Support) version and with some features or bugfixes being backported from Godot 4.

The Godot Engine is a free, all-in-one, cross-platform game engine that makes it easy for you to create 2D and 3D games.

Godot Engine 4.3 Released


With over 3500 commits authored by over 500 contributors, the latest Godot Engine release comes packed full of new features and improvements. Check the Godot Official Announcement and the Godot Changelog for more info:

Huge improvement to pixel stability for pixel art games.
- Add Direct3D 12 support for Windows and Wayland support for Linux (experimental).
TileMap layers are now exposed as individual TileMapLayer nodes.
- Implemented 2D physics interpolation.
- Add interactive music support.
New Parallax2D node available.
- Several rendering and shaders improvements.
Fixes for invalid/corrupt scenes.
Automatic checking for engine updates.
Editor theme and UX improvements.
- Several bug fixes and usability improvements.





Projects comming from Godot 4.x are almost compatible with Godot 4.3, because this is not a major version (as Godot 3.x to Godot 4.0). For most games and apps made with 4.2 it should be relatively safe to migrate to 4.3, but check the Migration Guide from Godot 4.2 to Godot 4.3 and the Official Documentation for more info.

With the release of Godot 4, Godot 3 continue to be supported for a while, being considered an LTS (Long Term Support) version and with some features or bugfixes being backported from Godot 4.

The Godot Engine is a free, all-in-one, cross-platform game engine that makes it easy for you to create 2D and 3D games.

Godot Engine 4.2 Released


Following the pattern of a new version every 4 months, the Godot 4.2 is released with several improvements and with a focus on stability! Check the Godot Official Announcement and the Godot Changelog for more info:

- Add AMD FidelityFX Super Resolution 2.2 (FSR 2.2).
- Several rendering optimizations.
- Add 2D HDR rendering.
- Several improvements on TileMap Editor, including per-tile flipping and rotating.
- Add forced integer scaling.
- Improved gamepad support.
- Add a new lightmapper denoising approach.
- Better animations under the new AnimationMixer node.
- Add navigation mesh baking for 2D.
- Editor quality of life improvements and fixes.
- Several bug fixes and usability improvements.





Projects comming from Godot 4.x are compatible with Godot 4.2, because this is not a major version (as Godot 3.x to Godot 4.0), with minor adjustments to some function parameters. Check the Official Documentation for more info. 

With the release of Godot 4, Godot 3 continue to be supported for a while, being considered an LTS (Long Term Support) version and with some features or bugfixes being backported from Godot 4.

The Godot Engine is a free, all-in-one, cross-platform game engine that makes it easy for you to create 2D and 3D games.

Godot Engine 4.1 Released


After 4 months of Godot 4.0 release, the Godot 4.1 is released with several improvements and with a focus on stability, performance and polish! Check the Godot Official Announcement and the Godot Changelog for more info:

- Optimize Node children management.
- Implement Vulkan pipeline caching.
- Add shader cache to GLES3.
- Improve the Gradient2D editor.
- Increased feature parity between C# and GDScript.
- Editor quality of life improvements and fixes.
- Fixed a large amount of multi-threaded loading issues and limitations.
- Several bug fixes and usability improvements.





Projects comming from Godot 4.x are compatible with Godot 4.1, because this is not a major version (as Godot 3.x to Godot 4.0), with minor adjustments to some function parameters. Check the Official Documentation for more info. 

With the release of Godot 4, Godot 3 continue to be supported for a while, being considered an LTS (Long Term Support) version and with some features or bugfixes being backported from Godot 4.

The Godot Engine is a free, all-in-one, cross-platform game engine that makes it easy for you to create 2D and 3D games.

Godot Engine 4.0 Released


After 4 years of development and with 1,500 individual contributors, the the wait is over: Godot 4.0 released! This release is more of a great rebuild than a regular update, having changes and improvements in all areas of the engine! Check the Godot Official Announcement and the Godot Changelog for more info:

- New Vulkan renderer.
- Highly improved Lighting & Shadows.
- New rendering optimization techniques.
- Enhanced mid & post-processing.
- New and improved 2D tilemap editor.
- Better atmospheric effects and addition of Volumetric Fog.
- Addition of Decals and collision on GPU particles.
- Imporoved Shader editor and extended Shader language.
- Support of Compute Shaders for better performance.
- Improved GDScript and port to .NET 6 the C# version.
- Replaced Bullet engine to Godot Physics.
- Improved Physics API, with multithreading and performance optimizations.
- Extended language support and easier translation workflow.
- Better and improved Navigation System.
- Addition of OpenXR and XR tools.
- Simplified Multiplayer development workflow.
- Cleaner sound and built-in polyphony support.
- Enhanced Animation editor and new Tween system.
- Several editor features, widgets and improvements.
- Multiple window support and UI editor improvements.
- New theme editor and text rendering system.
- Improved Android and Web support.
- Several bug fixes and usability improvements.





Projects comming from Godot 3.x need to be migrated to Godot 4.x, which can be cumbersome and complex, depending on the size of the project. Check the Godot 4 Migration Guide and Official Documentation for more info.

With the release of Godot 4, Godot 3 continue to be supported for a while, being considered an LTS (Long Term Support) version and with some features or bugfixes being backported from Godot 4.

The Godot Engine is a free, all-in-one, cross-platform game engine that makes it easy for you to create 2D and 3D games.

Godot Engine 3.5 Released


In parallel with the development of Godot 4.0, the dev team released the Godot 3.5 version ater 9 months of development with some great news. Check the Godot Official Announcement and the Godot Changelog for more info:

- Asynchronous shader compilation with caching (ubershader).
- New NavigationServer with obstacle avoidance using RVO2 library.
- Add physics interpolation for 3D.
- Add OccluderShapePolygon for 3D.
- New tweening class with SceneTreeTween.
- Add Label3D and TextMesh to display text in 3D scenes.
- New Time singleton for a better reading of the current OS time.
- Add possibility of accessing nodes by unique names.
- Android port of the Godot editor.
- New features for Version Control Systems (VCS) integration.
- Add GradientTexture2D and OccluderShapePolygon (3D).
- Optimized line drawing in 2D.
- Improved ColorPicker presets.
- Several bug fixes and usability improvements.




Projects comming from Godot 3.4 are compatible with Godot 3.5, because this is not a major version (as Godot 2.1 to Godot 3.0 or for Godot 3.x to Godot 4.0 when it is released), with minor adjustments to some function parameters. Check the Official Documentation for more info. 

Godot is an advanced, feature packed, multi-platform 2D and 3D open source game engine (MIT). It provides a huge set of common tools, so you can just focus on making your game without reinventing the wheel.

Godot Engine 3.4 Released


After some months of development, Godot 3.4 is released. Check the Godot Official Announcement and the Godot Changelog for more info:

- Add frame delta smoothing option.
- Rooms and portals-based occlusion culling.
- Add soft shadows to the CPU lightmapper.
- Improved input handling.
- Make all file access 64-bit for handling files bigger than 2.1 GB.
- Overhaul the theme editor and improve user experience.
- Backport improved glTF module with scene export support.
- Add ring emitter for 3D particles.
- Improved 2D editor zoom logic.
- Fix audio cubic resampling algorithm.
- Add support for physical scancodes, fixes non-latin layout scancodes on Linux.
- Add support for Dynamic BVH as 2D physics broadphase.
- Fixes to 2D and 3D KinematicBody move_and_slide and move_and_collide.
- Export HTML5 game as Progressive Web App (PWA).
- Several bug fixes and usability improvements.




Projects comming from Godot 3.3 are compatible with Godot 3.4, because this is not a major version (as Godot 2.1 to Godot 3.0 or for Godot 3.x to Godot 4.0 when it is released), with minor adjustments to some function parameters. Check the Official Documentation for more info. 

Godot is an advanced, feature packed, multi-platform 2D and 3D open source game engine (MIT). It provides a huge set of common tools, so you can just focus on making your game without reinventing the wheel.

Godot Engine 3.3 Released


After more then 7 months of development and several releases candidates, Godot 3.3 is released. This version was initially planned as 3.2.4 but with the high number of new features, it was renamed to 3.3! Godot loosely follows Semantic Versioning with a major.minor.patch version system as detailed on Godot Releases Policy (the 3.x version is a long-term support - LTS). Check the Godot Official Announcement and the Godot Changelog for more info:

- Improvements to 2D GLES2 batching and add 2D batching for GLES3.
- New software skinning for MeshInstance.
- Add option for snapping 2D transforms to whole coordinates.
- Configurable amount of lights per object.
- New CPU lightmapper.
- Improvements to the HTML5 plataform, as threads, GDNative and AudioWorklet.
- Better Web editor.
- Modernized multi-threadings APIs
- ARM64 build and code signing for macOS.
- Dynamic BVH (Bounding Volume Hierarchy) for rendering and Godot Physics.
- Add support for the Android App Bundle format and new plugin API for iOS.
- Improvements to Godot Editor and scripting.
- Minimap support in GraphEdit.
- Improved FBX importer.
- New AspectRatioContainer Control node.
- Several bug fixes and usability improvements.




Projects comming from Godot 3.2 are compatible with Godot 3.3, because this is not a major version (as Godot 2.1 to Godot 3.0 or for Godot 3.x to Godot 4.0 when it is released), with minor adjustments to some function parameters. Check the Official Documentation for more info. 

Godot is an advanced, feature packed, multi-platform 2D and 3D open source game engine (MIT). It provides a huge set of common tools, so you can just focus on making your game without reinventing the wheel.

Godot Engine 3.2 Released


Godot 3.2 is a "long-term support" (LTS) release until transitioning to Godot 4 in the next months. This release brings a more polished and user-friendly interface with several new featuresCheck the Godot Official Announcement and the Godot Changelog for more info:

- Support for pseudo-3D depth in 2D.
- Support for generating audio procedurally and analyzing audio spectrums.
- WebRTC support.
- Mono/C# support on Android and WebAssembly.
- Support for texture atlases in 2D.
- Major improvements to the visual shader system.
- Improved visual scripting.
- Support for enabling/disabling parts of the editor or specific nodes.
- Improved GridMap editor.
- MSAA support in the GLES2 renderer.
- Improved convex polygon decomposition.
- Better GUI anchors and margins workflow.
- AR/VR: Oculus Quest and ARKit support.
- Better built-in documentation.
- Several bug fixes and improvements.





Projects comming from Godot 3.1 are compatible with Godot 3.2, because this is not a major version (as Godot 2.1 to Godot 3.0), with minor adjustments to some function parameters. Check the Official Documentation for more info. 

Godot is an advanced, feature packed, multi-platform 2D and 3D open source game engine (MIT). It provides a huge set of common tools, so you can just focus on making your game without reinventing the wheel.

Godot Engine 3.1 Released


The release of Godot 3.1 comes one year after the release of Godot 3.0 with more of 7000 commits, bringing a more polished and user-friendly interface, adding new features, as well the return of OpenGL ES 2.0 renderer (very optimized for performance on low end devices or WebGL). Check the Godot Official Announcement and the Godot Changelog for more info:

- Added OpenGL ES 2.0 rendering support.
- Added 2D and 3D CPU accelerated particles.
- Readded Visual Shader editor with new PBR output nodes.
- 3D soft-body physics support.
- 3D ragdoll system.
- 2D meshes and skeletal deformation.
- 3D Inverse Kinematic.
- Various improvements to KinematicBody2D.
- Added Constructive Solid Geometry (CSG).
- A revamped inspector with several usability improvements.
- New FileSystem dock.
- Improved Animation editor and AnimationTree.
- Optional static typing and warning system in GDScript.
- New and improved TileSet editor.
- Improved 3D editor grid.
- Support for BPTC texture compression.
- Support for WebSockets.
- Added Project Settings tooltips.
- Several bug fixes and improvements.





Projects comming from Godot 3.0 are compatible with Godot 3.1, because this is not a major version (as Godot 2.1 to Godot 3.0), with minor adjustments to some function parameters. Check the Official Documentation also. 

Godot is an advanced, feature packed, multi-platform 2D and 3D open source game engine (MIT). It provides a huge set of common tools, so you can just focus on making your game without reinventing the wheel.

Godot Engine 3.0 Released



After one and a half years of development, the long awaited version 3.0 of Godot Engine is available! The Godot Engine 3.0 has a new graphics engine (GLES 3.0) with several improvements for 3D rendering besides a redesigned and more modern editor. Check the Godot Official Announcement and the Godot Changelog for more info:

- Brand new 3D renderer featuring physically-based rendering, real-time global illumination and improved post-processing effects, using OpenGL ES 3.0 (Mobile) and OpenGL 3.3 (PC).
- GDNative to load native code as plugins.
- New shader compiler that is mostly based on GLSL ES 3.0.
Entirely new audio engine with buses and realtime effects.
- New 3D physics engine using Bullet.
- Improved memory management architecture with better performance.
GPU accelerated particles.
- Support for C++ (GDNative), C# (Mono) and Visual Scripting.
- VR and AR improvements, including support for OpenVR, OpenHMD and ARKit.
- Support for onion skinning.
- Automatic import and reimport of assets.
- Autotiling for 2D tilemaps.
- Support for 2D soft shadows.
- Enhanced debugger with remote SceneTree edit.
- Better and improved built-in documentation.
- Several usability improvements in the script editor such as code folding and customizable themes.
- Simplified and more flexible export system using presets.
- Improved HTML5 export using WebAssembly and WebGL2.
New high-level networked multiplayer API with IPv6 support.
- Several bug fixes and improvements.




Projects from Godot 2.1 are not compatible with Godot 3.0, as many things changed in the Godot API as well as in GDScript. There is no porting guide for now (only some Migration Notes), but there is an export tool in Godot 2.1.3 and later which can be used to export 2.1 games to the formats expected for Godot 3.0, helping in the migration process (check the Official Documentation also). 

Godot is an advanced, feature packed, multi-platform 2D and 3D open source game engine (MIT). It provides a huge set of common tools, so you can just focus on making your game without reinventing the wheel.

Godot Engine 2.1 Released



Version 2.1 of the Godot Game Engine is released, with several usability and editor improvements (check the Godot News for more info):

- Drag & drop support and contextual menus in the editor.
- Several usability improvements in the script editor.
- Live script editing.
- Custom themes support and customizable keybindings for the editor.
- New asset sharing platform.
- Dynamic font support (TTF or OTF files).
- Fully internationalized editor UI.
- Improved profiler.
- HiDPI/Retina support.
- New plugin API.
- Improved asset pipeline and resource previews.
- Several bug fixes and minor improvements.


Godot is an advanced, feature packed, multi-platform 2D and 3D open source game engine. It provides a huge set of common tools, so you can just focus on making your game without reinventing the wheel.

ZEEF Godot Engine


Check this nice ZEEF curated directory with several resources, tutorials, scripts, demos and games related with Godot Engine.


ZEEF is a place where you find and create lists of links about your favourite topics. It's a very powerful way to share information where everybody wins!

Godot Engine 2.0 Released



The Godot Game Engine reaches version 2.0 with many new features (check the Godot News for more info):

- Improved scene instancing and scene inheritance.
- Editor with new layout and theme.
- Live scene editing.
- New tools layout with Output Console, better Debugger and Animation Editor.
- New text-based scene format (.tscn).
- Multiple scene editing support.
- Onready keyword and singletons.
- Very improved gamepad support.
- New file dialog and filesystem dock.
- Improved code editor.
- Several bug fixes and minor improvements.



Godot is an advanced, feature packed, multi-platform 2D and 3D open source game engine. It provides a huge set of common tools, so you can just focus on making your game without reinventing the wheel.

Upgrading to melonJS 2.1


With the release of melonJS 2.1, is time to conduct a upgrade to this solid version of the engine, with nice features as:

- New screen independent scaling methods
- Improved collision handling and detection
- Support for Physics Editor tool, to define entities collision shapes
- Added support for pointerenter and pointerleave events
- High-precision color transform with more accurate color effects
- Several improvements in the WebGL renderer (reached a beta quality level)
- Added support for the new Tiled 0.11 object id property
- Fixed various bugs and issues

Check the melonJS Blog for a official announcement and get the lastest version in melonJS Site.

The recommended is to migrate the current version used in the game to one immediately more recent facilitating the upgrade process (some melonJS versions have API breaks). For example, if your game uses melonJS 1.0.2, you need to update first to 1.1.0 version (check the post Upgrading to melonJS 1.1), after to 2.0.2 version (check the post Upgrading to melonJS 2.0) and finally to 2.1.3 version.

Below we will check some of the necessary changes to upgrade from melonJS 2.0.2 (previous version) to melonJS 2.1.4 (current version when writing this post). For a complete list of changes visit the melonJS Upgrade Guide.


Before the Upgrade


The melonJS 2.1 is a major release and include some breaking changes which forces you to make adjustments in your game code.

Before starting the migration, check the Upgrade Guide and the Changelog of engine and decide if the amount of work for the upgrade compensates the new features of this melonJS version!

Don't forget to always have a backup of the last game version before starting the upgrade process!


Piece of Cake


Start renaming the functions, objects and variables changed in this version, which can be easily performed via a Search and Replace (or Refactor) available in your preferred Code Editor (or IDE):

// Old Code -> New Code
spritewidth -> framewidth
spriteheight -> frameheight
me.TextureAtlas -> me.video.renderer.Texture
me.video.shader.gltexture2d() -> me.video.shader.createTexture()
The me.video.init has arguments more flexible and robust requiring three params: width, height and a list of properties for the various options (the pattern function(x, y, {settings}) for constructors signature will be applied to others melonJS functions in future):

// Before melonJS 2.1
me.video.init("screen", me.video.CANVAS, 800, 600, true, "auto", false);

// After melonJS 2.1
me.video.init(800, 600, {
    wrapper: "screen", 
    renderer: me.video.CANVAS,     
    scale: "auto", 
    scaleMethod: "fill-max",
    doubleBuffering: true,
    transparent: true
}); 
The new and functional scaling mode is enabled through the scaleMethod param set in me.video.init and are detailed in the melonJS Blog:

- fit (default): Letterboxed; content is scaled to design aspect ratio.
fill-max: Canvas is resized to fit maximum design resolution; content is scaled to design aspect ratio.
- flex-width: Canvas width is resized to fit; content is scaled to design aspect ratio.
flex-height: Canvas height is resized to fit; content is scaled to design aspect ratio.
- stretch: Canvas is resized to fit; content is scaled to screen aspect ratio.

Check also the addition of the "transparent" parameter to enable support for the new opaque canvas feature and the removal of the old maintainAspectRatio replaced by the new scaling method.

The me.sys.scalingInterpolation setting for enable or disable the anti-aliasing is avaliable now directly in the me.video.init antiAlias params:

// Before melonJS 2.1
me.sys.scalingInterpolation = true;

// After melonJS 2.1
me.video.init(800, 600, {
    wrapper: "screen", 
    renderer: me.video.CANVAS,
    doubleBuffering: true, 
    scale: "auto",      
    antiAlias: true
});


Let's Rock


In order to standardize objects constructor in melonJS, me.Sprite, me.AnimationSheet and me.ImageLayer signature have been update to follow the pattern function(x, y, {settings}):

// Before melonJS 2.1
var sprite = new me.Sprite(20, 80, me.loader.getImage("image"));
var animationSheet = new me.AnimationSheet(30, 50, image: me.loader.getImage("animationsheet"), spritewidth: 32, spriteheight: 32});

// After melonJS 2.1
var sprite = new me.Sprite(20, 80, {
   image: me.loader.getImage("image")
});

var animationSheet = new me.AnimationSheet(30, 50, {
  image: me.loader.getImage("animationsheet"),
  framewidth: 32,
  frameheight: 32
});
Most keywords and name lookups have been made case-sensitive now. This affects file names, pooling, and container child searches and may give more or less work as the patterns used in your project. To perform a case-insensitive search, you can use Javascript RegExp in container child searches:

// Before melonJS 2.1 - Get objects named "Player" or "player"
me.game.world.getChildByProp("name", "PLAYER");

// After melonJS 2.1 - Use the RegExp for Case Insensitive Search
me.game.world.getChildByProp("name", /player/i);
Lastly, remove the references to body.updateBounds() because this function is automatically called by the engine now, providing an extra facility to the developer.


Work Done


After the completion of the steps above, you must run the game performing various tests to detect possible adjustments or fixes to be made. For possible questions, use the melonJS Forum or analyze directly the source code on GitHub Repo.

The practical and functional screen scaling modes, the better support to WebGL and the easy migration proccess (if compared with the whirlwind of changes and new features introduced with melonJS versions 1.1 and 2.0), make the upgrade a good and right choice. And you can enjoy to review some "obscure" or "hackish" code, using the best practices you acquired in recent times or to implement new features in your game.

ZEEF Game Assets

https://game-assets.zeef.com/andre.antonio.schmitz

Check this awesome ZEEF curated directory with several resources and tools for creating assets used in games as graphics, sounds, video, maps and others.


ZEEF is a place where you find and create lists of links about your favourite topics. It's a very powerful way to share information where everybody wins!

Upgrading to melonJS 2.0


With the release of melonJS 2.0, is time to conduct a upgrade to this solid and awesome version of the engine, packed with nice features, as:

- New Shape based collision (replaced the Tile based collision)
- Added support for Tiled 0.10 allowing shape transforms (scaling and rotation) and TMX Tileset Animations
- Automatic collision response handling
- Physics bodies now support multiple shapes
- Many fixes and improvements with collision detection in isometric maps
- Initial WebGL support (alpha quality)
- Fixed various bugs and issues

Check the the melonJS Blog for a official announcement and get the lastest version in melonJS Site.

The recommended is to migrate the current version used in the game to one immediately more recent facilitating the upgrade process (some melonJS versions have API breaks). For example, if your game uses melonJS 1.0.2, you need to update first to 1.1.0 version (check the post Upgrading to melonJS 1.1) and after to 2.0.2 version.

Below we will check some of the necessary changes to upgrade from melonJS 1.1.0 (previous version) to melonJS 2.0.2 (current version when writing this post). For a complete list of changes visit the melonJS Upgrade Guide.


Before the Upgrade


The melonJS 2.0 ends a cycle of major changes started from version 1.0, in order to make the engine most concise, fast, robust, cleaner and future proof, with the replacement of the naive collision mechanism. It's a major release and include some breaking changes so you should do adjustments in your game code. Probably, the most work to be done for this version is the adjustment of all Tiled maps, due the replacement of Tile based collision to Shape based collision, finalizing the implementing of the new collision mechanism!

Before starting the migration, check the Upgrade Guide and the Changelog of engine and decide if the amount of work for the upgrade compensates the incredible new features of this melonJS version!

Don't forget to always have a backup of the last game version before starting the upgrade process!


Piece of Cake


Start renaming the functions, objects and variables changed in this version, which can be easily performed via a Search and Replace (or Refactor) available in your preferred Code Editor (or IDE):

// Old Code -> New Code
debugPanel -> me.debug.Panel
me.Sprite.resize() -> me.Sprite.scale()
me.PolyShape -> me.Polygon
me.game.world.collide -> me.collision.check
The me.Body now supports multiple shapes and the me.Body.getShape() function now needs an index as argument, returning the shape specified at the index:

// Before melonJS 2.0 - Body has only one shape
var bounds = this.body.getShape().bounds;

// After melonJS 2.0 - Body has only one shape, see index = 0
var bounds = this.body.getShape(0).bounds;
The functions flipX and flipY have been removed from me.Entity and me.Body and are available only through the entity renderable component:

// Before melonJS 2.0
game.Entity = me.Entity.extend({
    init: function(x, y, settings){
        // Call the constructor
        this._super(me.Entity, 'init', [x, y , settings]);

        // Set the entity renderable
        this.renderable = game.texture.createSpriteFromName("sign.png");

        // Check for entity renderable flip - passed as constructor param
        this.flipX(settings.flip); 
    }
});

// After melonJS 2.0
game.Entity = me.Entity.extend({
    init: function(x, y, settings){
        // Call the constructor
        this._super(me.Entity, 'init', [x, y , settings]);

        // Set the entity renderable
        this.renderable = game.texture.createSpriteFromName("sign.png");

        // Check for entity renderable flip - passed as constructor param
        this.renderable.flipX(settings.flip); 
    }
});
Update the HUD pattern making it a floating container, because a bug in previous version allowed non-floating containers to always be within the viewport. For this, only add this.floating = true; in the HUD Container init function.


Let's Rock


With the new collision mechanism, the entities now automatically respond to collision, not requiring that me.Body have a explicit onCollision function callback, being necessary directly in me.Entity:

// Before melonJS 2.0
var entity = me.Entity.extend({
    init: function(x, y, settings) {
        // Call the constructor
        this._super(me.Entity, 'init', [x, y , settings]);

        // Set the default velocity
        this.body.setVelocity(3, 15);

        // Set the collision callback function
        this.body.onCollision = this.onCollision.bind(this); 
    },
   
    // Update logic
    update: function(dt) {
        // Change velocity 
        this.body.vel.x -= this.body.accel.x * me.timer.tick;
 
        // Apply physics to the body (this moves the entity)
        this.body.update();

        // Handle collisions against other shapes
        me.collision.check(this, true, this.collideHandler.bind(this), true);

        this._super(me.Entity, "update", [dt]);
        return true; 
    },

    // Collision handler
    collideHandler: function(response) {
        // Check for collision with enemy
        if (response.b.body.collisionType === me.collision.types.ENEMY_OBJECT) { 
            // Change velocity 
            this.body.vel.y -= this.body.maxVel.y * me.timer.tick;

            // Change position
            this.pos.x -= 20;

            // Update the entity bounds since we manually changed the position
            this.updateBounds();
        }
    },

    // Collision callback
    onCollision: function(res, obj) {
        // Disable collision
        this.body.setCollisionMask(me.collision.types.NO_OBJECT);

        // Remove from game
        me.game.world.removeChild(this);
    }
});
In this way, the callbacks used in this.body.onCollision and me.collision.check() are joined into a single callback onCollision defined in me.Entity (check the new signature of me.collision.check() function in the Online Documentation):

// After melonJS 2.0
var entity = me.Entity.extend({
    init: function(x, y, settings) {
        // Call the constructor
        this._super(me.Entity, 'init', [x, y , settings]);

        // Set the default velocity
        this.body.setVelocity(3, 15);       
    },
   
    // Update logic
    update: function(dt) {
        // Change velocity 
        this.body.vel.x -= this.body.accel.x * me.timer.tick;
 
        // Apply physics to the body (this moves the entity)
        this.body.update();

        // Handle collisions against other shapes
        me.collision.check(this);

        this._super(me.Entity, "update", [dt]);
        return true; 
    },    

    // Collision callback
    onCollision: function(response, other) {
        // Check for collision with enemy
        if (other.body.collisionType === me.collision.types.ENEMY_OBJECT) { 
            // Change velocity 
            this.body.vel.y -= this.body.maxVel.y * me.timer.tick;

            // Change position
            this.pos.x -= 20;

            // Update the entity bounds since we manually changed the position
            this.updateBounds();
        }

        // Disable collision
        this.body.setCollisionMask(me.collision.types.NO_OBJECT);

        // Remove from game
        me.game.world.removeChild(this);
    }
});
The Number.prototype.random(min, max) function has changed to match the standard Javascript function Math.random(), using the range [min, max), i.e, from min (inclusive) up to but not including max (exclusive):

// Before melonJS 2.0 - Random Number between 0 and 5
var random = Number.prototype.random(0, 5);

// After melonJS 2.0 - Random Number between 0 and 5 (Normal Syntax)
var random = Number.prototype.random(0, 6);

// After melonJS 2.0 - Random Number between 0 and 5 (Short Syntax)
var random = (0).random(6);


Come Get Some


Completing the new changes to collision system, the legacy Tile based collision mechanism has been replaced with a Shape based collision mechanism, using the same SAT implementation of the entities (added in version 1.1). This change requires adjusting the layer collision of all maps from Tiled, which can be a time consuming work, depending on the complexity and number of maps!

Before melonJS 2.0, you used a Tiled Tile Layer to define the world collision shapes, in accordance with the tiles types supported by engine (using the "metatiles" solid, platform, ladder, slope and breakable):

Tiled Level with Tiles Collision Layer

After melonJS 2.0, you should use a Tiled Object Layer and the world collision shapes can be defined using all standard objects from Tiled, like Polyline, Polygon (only convex with clockwise winding) and Ellipse, giving greater freedom and creativity to define the game collisions, not getting stuck with fixed shapes!

Tiled Level with Shape Collision Layer

Remember that you must use a Tiled Object Layer with name "collision" so the engine detects the collision layer properly. With this change in collision shapes the engine no more support builtin Platforms and Ladders tiles and they must be implemented using the new onCollision response callback:

// melonJS 2.0 - me.Entity onCollision callback
onCollision: function(response, other) {
    if (other.body.collisionType === me.collision.types.WORLD_SHAPE) {
        // Simulate a platform - property defined in Tiled Object
        if (other.type === "platform") {
            if (this.body.falling && !me.input.isKeyPressed('down') &&
               (response.overlapV.y > 0) && 
               (~~this.body.vel.y >= ~~response.overlapV.y)) {
                // Disable collision on the x axis
                response.overlapV.x = 0;

                // Respond to the Platform (it is solid)
                return true;
            }

            // Don't respond to the Platform (pass through)
            return false;
        }
    }

    // Make the object solid
    return true;
}
With the new Shape collision mechanism, some functions related to collisions have been removed from engine:

// Functions removed from Engine
me.Body.onslope
me.Body.onladder
me.Body.disableTopLadderCollision
me.Body.canBreakTile
me.Body.onTileBreak
me.Body.collisionMap
me.game.collisionMap
These functions can now be implemented through smart use of the onCollision callback with a similar logic as previously demonstrated to simulate a platform.


Work Done


After the completion of the steps above, you must run the game performing various tests to detect possible adjustments or fixes to be made. For possible questions, use the melonJS Forum or analyze directly the source code on GitHub Repo.

Even with the extra work, the upgrade compensates for the awesome shape based collisions, bug fixes and performance enhancements. And you can enjoy to review some "obscure" or "hackish" code, using the best practices you acquired in recent times or to implement new features in your game.

The melonJS 2.0 is a solid and stable version, demonstrating the maturity and evolution that the engine achieved during the last three years. Congrats melonJS Team for the job well done!

ZEEF HTML5 Game Development


Check this ZEEF curated directory with several resources for develop games using HTML5, Javascript and WebGL. Some resources can be used for general game development.


ZEEF is a place where you find and create lists of links about your favourite topics. It's a very powerful way to share information where everybody wins!

Implementing Particles with melonJS


With the popularity of games on smartphones and browsers, 2D gaming is back on the scene, recalling the classic age of the late '80s and early '90s. At that time, most games used animation techniques with images (sprite sheets) to display special effects such as explosions, fire, or magic. In current games we can use particle systems, generating random and interesting visual effects in them. In this post I will briefly describe what a particle system is and how to implement models using the HTML5 engine melonJS.

Note: Although the examples are specific to the melonJS game engine using JavaScript as a programming language, the concepts and ideas can be adapted for other languages ​​or game engines as well.


Packt Publishing mission is to help the world put software to work in new ways, through the delivery of effective learning and information services to IT professionals.