Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

1. June 2017


Ever wish you could go back in time to the days of 8bit computing, when coding was simple and pixels were large?  Thanks to the rise of Fantasy Consoles, this process is easier than ever before.

So what exactly is a fantasy console?  Basically it’s a virtual console with a complete development environment.  The console is designed to be Pico3intentionally limiting, much like the primitive retro computers of the 8bit era.  Generally each also comes with a code editor, programming language (Lua), tile and world editor and some form of music composer.  This gives you a very focused, simple and constrained programming environment to work with.  You’d be surprised how striping away all the modern trappings enables you to focus on a single concept... fun.


So without further ado, let’s take a quick look at 4 virtual consoles available today.


PICO-8

PICO-8 is the application that seemingly launched the entire fantasy console movement.  The hardware it emulates provides a 128x128 pixel display, support for 4 channel audio, 128 8x8 sprites and 32k console/disk sizes.  It is PICO-8 illustrated in the image to the right.  In addition to the virtual machine, it also provides a code editor, sprite editor, map editor as well as music and sound editors.  It is available for $15 USD.


TIC-80

TIC-80, or Tiny Computer, is very similar in concept to PICO-8, with slightly less restrained virtualized hardware.  In this case it provides a 240x136 display, up to 256 8x8 foreground and 256 8x8 background sprites, 4 channels of audio and a 64kb disk/console size.  Tic is open source with the code available here.  TIC-80 also provides a VM, code editor, sprite editor, map editor and music/sound editors.


LIKO-12

Another open source option, LIKO-12 is heavily inspired by PICO-8, built on top of the LOVE game framework.   LIKO is currently less feature complete than the others, lacking many of the editors others provide.


PixelVision 8

Perhaps the most interesting of the options out there, certainly the most polished from a UI perspective, PixelVision 8 is heavily inspired by PICO-8 witha  major twist.  PixelVision aims to emulate the development experience of real world hardware such as the NES, Gameboy and SEGA Master System.  It also enables you to customize the capabilities of your target platform.  It also contains several built in editors for graphics, music and code.  Currently it is only available for purchase for $15USD, although a free version is in the works.


You can learn a bit more about fantasy consoles and go hands on with PICO 8 in this video, which is also embedded below.


Programming

31. May 2017


Defold Engine 1.2.105 was just released.  The Lua powered cross platform 2D game engine adds support for native extensions on HTML5 platforms.  This release also added a profiler module for monitoring CPU and memory usage of your app.  If you are interested in learning more about the Defold game engine, we have a complete tutorial series available here.


Details of this release:

Engine
  • DEF-1058 - Added: Profiler memory and CPU usage information.
  • DEF-2685 - Added: HTML5 support to native extensions.
  • DEF-2727 - Added: Addded html5.run() function to call JavaScript from Lua.
  • DEF-1995 - Fixed: msg.url() can be created before collection is loaded, and also be reused (msg.socket is a hash).
  • DEF-2721 - Fixed: Bob.jar now lists all options (including defoldsdk).
Native Extensions

We have now added support for building your native extensions for HTML5
It works both when using 'Build HTML and Launch' as well as when bundling.
It supports C++, embedded JavaScript, and Emscripten JavaScript libraries.
Editor 2 support for HTML5 native extensions is being worked on and will follow shortly.

We also fixed an issue during the sprint where the build server didn't take all the
Android flags, linkFlags and libs into account.

Documentation

There is a new section on the site called "Examples23" where you can find small contained examples on how to do common things in Defold. We will expand this section and are taking requests!

30. May 2017


Back in Part One of our look at the PlayCanvas HTML5 3D game engine, we started creating our simple bowling game.  We already created our lane and pins.  Now it is time to continue on and create our bowling ball.  Attached to our bowling ball will also be the script the controls the majority of our game.  Let’s jump back in.


Creating the Bowling Ball

This time, instead of importing a model, we are simply going to use a built in procedurally generated mesh.  Simply right click the Root in the Hierarchy view, select New Entity then Sphere.

image

Scale the newly created ball down and position it accordingly.

image

Under the Entity properties, I renamed it from Sphere to BowlingBall.  Right now our ball doesn’t look all that great.  Let’s go ahead and make it a bit shiny.  Right click in the asset area, select New Asset->Material.

image

Select the newly created material from the assets tab.  In the Material panel, I rename it to BowlingBallMaterial.  What I want to do is make the bowling ball a bit shiny.  I am going to leave it white, but if you want to change the color, do so under the Diffuse tab.  Next head on down to the Specular tab.  I used the following settings

image

Finally we need to apply the material to our bowling ball.  In the Hierarchy view, select the BowlingBall entity, under the Model panel, select our newly created Material.

image

Our bowling ball also needs to have a Collision shape and Rigid Body attached to it.

image

image

Be sure to set the Collision object to a Sphere and size the radius to be only slightly larger than our bowling ball model.


Now we have all the pieces needed for our game.  The pins, the lane and the bowling ball.  Now all we need to do is add some logic to the game.  This is done by attaching scripts to entities within our game.  In this case we are going to attach the logic to our bowling ball.


Scripting

With our BowlingBall entity active, add a component and select Script.

image


Scroll down to the Script panel, select Add Script->New Script.

image

Enter a name for the script.

image

Now click Edit Script to launch the script editor.

image

Now enter the following script:

var BallScript = pc.createScript('ballScript');

BallScript.attributes.add('speed', {
    type: 'number',
    default: -8
});

BallScript.prototype.initialize = function() {
    this.entity.collision.on('collisionstart', this.onCollisionStart, this);
    this.app.keyboard.on('keydown', this.onKeyDown, this);
    
    var pins = this.app.root.findByTag("Pin");
    this.startingPositions = [];
    this.startingRotations = [];
    for(var i = 0; i < pins.length; i++){
        this.startingPositions.push(pins[i].getLocalPosition().clone());
        this.startingRotations.push(pins[i].getLocalRotation().clone());
    }
    
    this.ballPosition = this.app.root.findByName("BowlingBall").getLocalPosition().clone();
    this.ballMoving = false;
};

BallScript.prototype.onCollisionStart = function (result) {
    
    if (result.other.rigidbody) {
        if(result.other.name == "BowlingPin")
            this.entity.sound.play("Hit");
    }
};

BallScript.prototype.onKeyDown = function(e) {
    if(e.key == pc.KEY_SPACE || e.key == pc.KEY_W){
        this.entity.rigidbody.applyImpulse(0,0, this.speed);
        this.ballMoving = true;
    }
    if(e.key == pc.KEY_R){
        var pins = this.app.root.findByTag("pin");
        for(var i = 0; i < pins.length; i++){
                pins[i].rigidbody.teleport(this.startingPositions[i],this.startingRotations[i]);
                pins[i].rigidbody.linearVelocity = pc.Vec3.ZERO;
                pins[i].rigidbody.angularVelocity = pc.Vec3.ZERO;
        }
        // now the ball
        this.entity.rigidbody.teleport(this.ballPosition);
        this.entity.rigidbody.linearVelocity = pc.Vec3.ZERO;
        this.entity.rigidbody.angularVelocity = pc.Vec3.ZERO;
        this.ballMoving = false;
    }
    if(e.key == pc.KEY_B){
         // Just the ball
        this.entity.rigidbody.teleport(this.ballPosition);
        this.entity.rigidbody.linearVelocity = pc.Vec3.ZERO;
        this.entity.rigidbody.angularVelocity = pc.Vec3.ZERO;
        this.ballMoving = false;
    }
    if(e.key == pc.KEY_LEFT || e.key == pc.KEY_A){
        this.entity.rigidbody.applyImpulse(-0.2,0,0);
    }
    if(e.key == pc.KEY_RIGHT || e.key == pc.KEY_D){
        this.entity.rigidbody.applyImpulse(0.2,0,0);
    }    
};

// update code called every frame
BallScript.prototype.update = function(dt) {
};


One thing you may notice in the script above is the definition of the speed attribute.  This exposes this variable back to the editor, like so:

image


You may notice the line of code in the script for playing audio when we collide with a pin:

    if (result.other.rigidbody) {
        if(result.other.name == "BowlingPin")
            this.entity.sound.play("Hit");
    }

Now we need to add this audio asset to our bowling ball.  First add the audio file as an asset.  Simply click add asset –> Upload, then upload a WAV file.  Now we need to add a sound component to our BowlingBall entity. 

image


Now scroll down to Slot 1 and add the asset you just uploaded and be sure to set name to Hit.

image


And done.  A complete, rather simple but fully functioning 3D bowling game in just a few minutes.


The Video

Programming , , ,

29. May 2017


SharpDX is a managed wrapper for the DirectX series of APIs including Direct 3D 9/11/12, Direct2D, DirectInput, XInput and more.  This library makes it easy to use DirectX libraries with languages such as C#, VB.net and more.  It is released under the incredibly flexible MIT open source license.  This release brings support for Visual Studio 2017 and perhaps most importantly, support for .NET core platform.


This new release of SharpDX contains:

  • Several bug fixes, see the full list below
  • A migration of the build system to VS 2017
  • Added support for the .NET Core Platform (netcoreapp1.0, netstandard1.1, uap10)

This release is the dedicated work of external contributors, thanks a lot for their work!

The binaries are accessible on nuget.


The full list of new features and bugs is available here.

GameDev News

27. May 2017


Tiled, an open source 2D map editor, finally hit the 1.0 milestone release.  As expected from a major point release, this one is loaded with new features.  External tilesets, text objects, grouping of layers are perhaps the largest new features, there are however dozens more.  If you areTiled interested in learning more about Tiled, we have done a comprehensive set of tutorials to get you started.


Details from the release notes:

Changelog

Many more improvements were made, here is the full list:

  • Added support for editing external tilesets (#242)
  • Added a text object with configurable font and wrapping (#1429)
  • Added layer grouping (#1038)
  • Added Tile.type and inherit tile object properties from the tile (#436, #1248)
  • Added a start page
  • Added selection of underlying objects with Alt modifier (by Yuriy, #1491)
  • Added an option to disable safe writing of files (#1402, #1404)
  • Added invert selection action (by Leon Moctezuma, #1423)
  • Added support for isometric terrain overlays and tile collision objects (#419, #757)
  • Added 180-degree symmetry mode to terrain brush with Alt modifier
  • Added short and consistent map format names to use with --export-map (by Marce Coll, #1382)
  • Added Swap Tiles action (by Alexander Münch, #866)
  • Added tileset background color property (#227)
  • Added 60 degree tile rotation support for hexagonal maps (by Victor Nicolaichuk, #1447)
  • Added a check for duplicates when adding tiles (by Simião, #1227)
  • Added option to run commands from menu as well as edit them (by Ketan Gupta, #943)
  • Added custom shortcuts for commands (by Ketan Gupta, #1456)
  • Added optional ID and Position columns to objects view (by i-ka, #1462)
  • Added an executable picker for custom commands (by Ketan Gupta, #942)
  • Added marching ants effect on selected objects (by Mohamed Thabet, #1489)
  • Added all open tilesets to the Tilesets view
  • Added auto-show/hide all views (Clear View) action (by erem2k, #563)
  • Added minimap in the resizing dialog (by Yuriy, #1516)
  • Added drag-n-drop support in Layers view (#178)
  • Added support for storing object type definitions in JSON format (#1313)
  • Added cut/copy/paste actions for custom properties (#515)
  • Allow changing the tile of tile objects (by Mohamed Thabet, #409)
  • Allow selecting a folder to fix multiple broken links at once
  • Added support for dragging external tilesets into the Tilesets dock
  • Added support for dragging images into image collection tilesets
  • Write out Tiled version in TMX/JSON “version” attribute (#1416)
  • Remember last view on map also for closed files (#905)
  • Remember tileset zoom level in the tileset editor (by Artem Sharganov, #408)
  • Change current layer depending on selected objects (by Glavak, #1424)
  • Improved support for using Tiled on HiDpi screens
  • Improved the behavior of the tile selection tool
  • Made Ctrl+D duplicate objects instead of deleting them
  • Use an eye icon instead of a checkbox for layer visibility (by Ketan Gupta, #1127)
  • JSON tileset: Save width/height of individual tile images
  • Linux: Added MIME type for tileset files
  • Fixed hexagonal rotation of tile stamps (by Bdtrotte, #1476)
  • Fixed handling of broken tile references, which now render as a red marker
  • Fixed manual reloading of images for image collection tilesets
  • Fixed Offset Layers tool to wait until mouse is moved
  • Fixed current stamp to always update when a tile is clicked
  • Fixed handling of pinch gestures (#1305)
  • Fixed flipping a group of objects to work like expected (by Vitek1425, #1475)
  • Fixed stamp brush to work better on staggered maps (by Bdtrotte)
  • Fixed objects offsetting while resizing (by Acuion, #1518)
  • Fixed fill tool for hexagonal maps (#883)
  • Fixed potential crash in Terrain Brush
  • Windows: Fixed menus when using OpenGL in full screen mode (#1576)
  • Windows: Added Sticker Knight and Python example scripts to installer (#819)
  • Windows: Fixed bringing existing Tiled window to foreground (#1256)
  • AutoMapping: Fixed object groups always getting added
  • AutoMapping: Improved map boundary handling (by Stefan Beller, #1224)
  • AutoMapping: Apply custom properties set on output layers
  • terraingenerator: Made the amount of columns configurable
  • terraingenerator: Copy tile properties from the source tilesets
  • Added Ukrainian translation (by Olexandr Nesterenko)
  • Added Hungarian translation (by Balázs Úr)
  • Added Finnish translation (by ekeimaja)
  • Updated Bulgarian, Dutch, French, German, Russian, Spanish and Turkish translations


You can learn more about and download tiled here.

GameDev News

Month List

Popular Comments