Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

12. January 2017

 

Today we are going to take a quick look at the Tilengine 2D game engine.  Tilengine in their own words is:

Tilengine is a free, cross-platform 2D graphics engine for creating classic/retro games with tilemaps, sprites and palettes. Its unique scanline-based rendering algorithm makes raster effects a core feature, a technique used by many games running on real 2D graphics chips.Untitled 3

Tilengine is open source (sorry, the core isn't open ), available on Github however I never could locate what license it’s released under.

EDIT—Since posted, there has been a bit of conversation about the licensing since this was posted, read here.

  It’s a C library, but contains bindings for Python, C# and Java.  I’m actually going to use the C# bindings for the example in this review as it’s the least documented of the available bindings.  There is a single page class reference available here and a small manual available here.  The engine is geared towards creating retro sprite style games and handles graphics, animations, palettes, input and window management, but has no sound or physics engine built in.  It is also designed to be used as a backend solution to an existing front end renderer.  There are several C based examples available here, and this represents the primary way you will get up to speed.  The graphics system is designed to emulate classic sprite systems like Sega’s SuperScaler arcade board but with Super Nintendo’s Mode 7 style graphics effects available.  Tilengine is layered over SDL and is cross platform, capable of running on most desktop operating systems, as well as Raspberry Pi devices.

Tilengine is composed like so:

image

 

Tilengine has direct support for tiled map files created using the Tiled map editor.  If you want to learn more about Tiled, I have done a complete tutorial series available here.

 

As a pretty straight forward game engine, let’s jump right in with the example created using the C# bindings:

using Tilengine;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var engine = Tilengine.Engine.Init(320,240,1,16,16);
            var window = Tilengine.Window.Create("",Tilengine.WindowFlags.Vsync);
            
            // This is the clear color drawn each frame.  Think of it as the sky color
            engine.BackgroundColor = new Color(0,128,238);

            // Load tsx and tmx file.  These are created in the Tiled level editor
            // tsx is a collection of tiles, tmx is a map painted using those tiles
            var tileset = Tileset.FromFile("SOTB_bg.tsx");
            var tilemap = Tilemap.FromFile("SOTB_bg.tmx","Layer 1");
            
            // create a new layer using our just loaded tiles.  Games can have multiple layers
            var layer = new Layer();
            layer.Setup(tileset,tilemap);
            layer.SetPosition(0,0);

            
            // Now we are loading an animated sprite riped from the 90s classic Shadow of the Beast
            // Spriteset is simply the image collection composing our game Spriteset
            // SequencePack is simple text format describing the available animations, their frames, speed etc
            // While Sequence is a named entry in the SequencePack text file
            Spriteset ss = Spriteset.FromFile("SOTB");
            SequencePack sp = SequencePack.FromFile("SOTB.sqx");
            Sequence walk = sp.Find("walk");

            // Now finally create a sprite using our spritesheet
            Sprite sprite = new Sprite();
            sprite.Setup(ss,TileFlags.None);

            int spriteX = 15;
            sprite.SetPosition(15,215);
            
            // Now play the animation sequence named "walk".  We also pass the final 0 in to tell it how many times the animation
            // should loop.  Zero equals forever
            Animation anim = new Animation();
            anim.SetSpriteAnimation(0,walk,0);
            
            
            int frame = 0;

            // This is your game loop
            while(window.Process()){
                // Draw the current frame of graphics (sprites, layers, etc)
                window.DrawFrame(frame++);

                // Now check if left or right arrow/gamepad are pressed, in which case move in that direction
                // IF moving left, flip the sprite over on the X axis
                if(window.GetInput(Input.Right)){
                    spriteX ++;
                    sprite.Flags = TileFlags.None; 
                }
                if(window.GetInput(Input.Left)){
                    spriteX --;
                    sprite.Flags = TileFlags.FlipX; 

                }
                sprite.SetPosition(spriteX, 185);
                if(spriteX > engine.Width) spriteX = 0;
            }
            

            //Cleanup
            tilemap.Delete();
            tileset.Delete();
            window.Delete();
            engine.Deinit();
        }
    }
}

 

The comments pretty much describe everything that is going on there.  For more details, be sure to check the video version of this tutorial available here [coming soon].  This example loads a sprite and animation from the game Shadow of the Beast, an Amiga platformer classic.  The SequencePack file format is extremely simple XML file, here is the example used:

<?xml version="1.0" encoding="UTF-8"?>

<sequences>
  <sequence name="walk" delay="6" loop="0">
    1,2,3,4,5,6
  </sequence>
</sequences>

 

The tsx and tmx files are generated using the Tiled level editor, another open source and free tool.  As you can see, it’s extremely simple to get up and going.  Run this code you will see:

SOTB

 

This is of course a primitive example, but does show the many parts of a game.  A game loop, sprite loading, animations, level loading, etc.  The major features of the engine, that I’m not covering here, are the various sprite effects it emulates.  You can see these effects demonstrated here or in the samples.

 

The Video

Programming , , ,

8. July 2016

 

Released just a few days ago on the App Store is Continuous, a complete C# and F# development environment that runs directly on your iPhone or iPad.  It contains a fairly full featured IDE with capable text editor, programming friendly on screen keyboard and more.  In addition to the editor it contains everything you need for development, a port of the Roslyn compiler, VM as well as implementations of several key libraries such as Xamarins WinForms implementation.

From the App Store entry:

    • Continuous is always building and running your code so you can see changes as you type. Writing interactive apps in Continuous is a pleasure compared to the traditional code-build-run cycle. It frees you to make lots of small changes and see their effects immediately - no more waiting for builds or deployments and no more clicking around trying to get to the screen you're trying to code.
      Continuous looks and works in many of the same ways as traditional .NET IDEs so you'll feel right at home, but it also strives to advance the state of the art in IDEs with these features:
    • Full C# 6 and F# 4 compilers so you can use the latest tech
    • Automatic compiling and running so you can focus on the code and the results
    • Fancy text editor with tabs, semantic highlighting, inline error bubbles, and inline values that are updated as you type
    • Watch window enables you to view graphical objects in your app (UI and images), inspect live objects as your app runs, create instances of new objects, and call methods
    • Code completion with inline type info and documentation makes learning new APIs fun
    • Uses standard .NET file and project formats so you can share code with other IDEs
    • Includes Xamarin.Forms and UIKit to build apps and SpriteKit and SceneKit to build games
    • Split screen support so you can keep documentation by your side
    • Execution powered by a new IL interpreter

 

If you are interested in learning more I already did a hands-on video available here or embedded below.  After some more experience I may follow up with a full blown review.  If you are a C# developer and are interested on developing directly on your device, check out Continuous.  It’s a pretty amazing piece of software.

 

GameDev News , ,

1. July 2016

 

Xenko Engine, formerly Paradox 3D, just released version 1.7.  I previously featured this engine as part of the Closer Look series if you are interested in learning more.  Majordragdrop_propertyview features of this release are:

 

  • Practical Clustered Shading ( forward + rendering ) added (Video here)
  • Re-written lighting code for improved performance
  • Vulkan support experimental on Linux and Windows
  • Simplified asset creation, import assets directly from file
  • Improved camera preview
  • Drag and Drop assets and scripts to the properties panel
  • Linux Platform support as target (Ubuntu)
  • Rewritten audio engine
  • Misc bug fixes and improvements

 

You can read the full release notes here.

GameDev News ,

1. July 2016

 

NeoAxis, a .NET powered 3D game engine with full editor, just released version 3.5.  The key features of this release are:terrain_editor

 

  • Graphic user interface of the tools has been updated.
  • A tool to easily import 3D models from a file has been added.
  • Example maps have been updated.
  • Freeze Objects Manager has been added. The object is indended to optimize maps with big amount of objects on them. With this object the developer can make some objects on the map freeze to save resources.
  • Streaming terrain has been improved. Better management of load/unload mechanism.
  • The ability to skip mip maps during loading textures.
  • Bug fix: Broken rendering with enabled SoftParticles parameter of the material.
  • Bug fix: Broken decals on terrain.
  • Bug fix: Broken export of 3D models from Map Editor to DAE.

 

You can read more about the release here.

GameDev News ,

27. June 2016

 

.NET Core was just released today, along with ASP.NET Core 1.0 and Entity Framework 1.0.  .NET Core is a new implementation of .NET that is available on Windows, Linux and Mac OS and is completely open source and available on Github.  Along with the release there are also Visual Studio extensions available as well as Visual Studio Update 3, which was also released today.

 

The biggest selling points of .NET Core according to Microsoft are:

  • Cross-platform: Runs on Windows, macOS and Linux.
  • Flexible deployment: Can be included in your app or installed side-by-side user- or machine-wide.
  • Command-line tools: All product scenarios can be exercised at the command-line.
  • Compatible: .NET Core is compatible with .NET Framework, Xamarin and Mono, via the .NET Standard Library.
  • Open source: The .NET Core platform is open source, using MIT and Apache 2 licenses. Documentation is licensed under CC-BY. .NET Core is a .NET Foundation project.
  • Supported by Microsoft: .NET Core is supported by Microsoft, per .NET Core Support

 

.NET Core isn’t a single product, instead it’s a composition of the following tools and libraries:

  • A .NET runtime, which provides a type system, assembly loading, a garbage collector, native interop and other basic services.
  • A set of framework libraries, which provide primitive data types, app composition types and fundamental utilities.
  • A set of SDK tools and language compilers that enable the base developer experience, available in the .NET Core SDK.
  • The ‘dotnet’ app host, which is used to launch .NET Core apps. It selects and hosts the runtime, provides an assembly loading policy and launches the app. The same host is also used to launch SDK tools in the same way.

 

I recently released a video on using Visual Studio Code with .NET Core if you are interested in learning more.

 

.Net Core is available here.

GameDev News

Month List

Popular Comments