19. March 2015

 

In this tutorial we are going to take a look at two key topics in Godot game development, Collision Detection and Physics Simulations.  Collision Detection is simply detecting if two objects overlap.  Physics on the other hand simulates the movement and interaction of game objects based on physical properties.  This of course also includes handling collisions.  There is also a video of this tutorial and this might be one of those times, due to all of the motion in the results, that you may in fact want to refer to the video even if you prefer text based tutorials.  So if you struggle to understand what I am talking about here, be sure to quickly check the video, it may have the answer.

 

You can watch the video here, or embedded below.

 

Checking for Collisions

 

Let’s start with checking collisions between two objects, in this case, two different Sprite objects.  I have created the following scene:

image

It’s simply two sprite objects side by side.  I then attached a script to the one on the left.  This script updates the position of the left sprite until a collision occurs, at which point it resets to the beginning and does it all over again.  Like so:

anim

 

Let’s take a look at the script now:

extends Sprite

var start_pos = Vector2()
var box1 = null
var box2 = null

func _ready():
   set_process(true)
   start_pos = get_pos()
   box1 = RectangleShape2D.new()
   box2 = RectangleShape2D.new()



func _process(delta):
   # Get a reference to the other sprite
   var sprite2 = get_node("/root/SceneRoot/Sprite 2")
   
   # Update our location
   self.move_local_x(0.1)
   
   # set the boundaries of each RectangleShape2D to those of the texture making up our sprite
   # values are relative to center, thus half width and height
   box1.set_extents(Vector2(self.get_texture().get_size().width/2,self.get_texture().get_size().height/2))
   box2.set_extents(Vector2(
sprite2.get_texture().get_size().width/2,sprite2.get_texture().get_size().height/2)) #Now check to see if box1 at sprite1's pos collided with box2 and sprite2's position if(box1.collide(get_transform(),box2,sprite2.get_transform())): set_pos(start_pos) # it did, so reset position to beginning, what's old is new again!

Essentially what you are doing here is creating a RectangleShape2D using the boundaries of each Sprite’s texture image.  AKA, creating a rectangle the size of the texture.  You then check if box1 at the transformed position of Sprite1 collides with box2 at the transformed position of Sprite2.  Of course, since they both use the same texture map, you don’t actually need to create two different RectangleShape2D objects!  Also, since the size never changes, you don’t actually need to set_extents() in process().  There are a number of simple shape classes that can be used to check for collisions such as concave and convex polygons, circles and even rays ( for mouse picking ).

 

This is one way to check for simple collisions.  However you will quickly find it gets unwieldy as you add more and more objects and have to check them against each other.  Fortunately the physics engine makes this process a whole lot easier.

 

Physics Simulations

 

Now that we looked at a way to test for collisions, lets move on and discuss the physics system.  Basically a physics engine simulates movement using complex math, calculating how items interact with each other and external forces like gravity.  The physics simulation then updates, either on a fixed or per frame basis, a set of objects with the new locations calculated by the simulation.  You then update your visible game objects positions accordingly.  In Godot however, you don’t generally need to perform that last step, it’s done automatically.

 

Let’s start with an extremely simple example, gravity.

 

First we start by creating a RigidBody2D node:

image

 

Next, parented to the RigidBody2D node, create a sprite node.  I am using the default icon.png that comes with Godot.  Your heirarchy should look like this:

image

 

… and that’s it.  You have now created a physics object that gravity will be applied to.  Run your game and you should see:

anim2

 

Now let’s pause a second to see exactly what is happening here.

 

First, let’s start with the RigidBody2D part…  There are three kinds of physics objects you can use in your 2D game world:

image

The biggest difference is how they are dealt with by the simulation.

 

A RigidBody can be thought of as a typical physics object.  It’s the most processing intensive, but it’s also got the most functionality.  Unless you have a reason otherwise, if something needs physics, it’s probably a rigid body.  This is a physics object that can move, can collide with other objects and itself by collided with.

 

Next up is the StaticBody2D.  This is an unmoving object in your world.  Basically things can hit it, it can be hit, but it doesn’t move.  It also takes a lot less processing power to handle.  Generally things like the world, or invisible but unmoving triggers will be static bodies.

 

Finally is KinematicBody2D.  This is a physics object that doesn’t have the range of functionality of a rigid body ( for example, you cant apply force to it ), but can move and can collide with other physics objects.  The biggest thing about a Kinematic body is that its motion is generally controlled directly by you no the physics simulation.  Generally this is the character sprite.  You want the physics simulation to react to its actions, but you generally control those movements directly in code.

 

So, those are the three major types of physics objects, now let’s look at global settings.  You notice how gravity is being applied to our simulation automatically?  Where is this coming from?

 

The answer is trust ole project settings:

image

 

So… what do those values means?  Well this is one of the nice things about working entirely in Godot.  In many physics engines like Box2D, you work in meters, then have to translate from meters to pixels when transforming your sprites.  In godot, these values are in pixels.  So a gravity value of 98 means gravity moves at 98 pixels per second.

 

Now what about Rigid Body settings?  Well let’s take a look:

image

 

Mass Friction and Bounce are the most commonly used values.  Hey, aren’t mass and weight the same thing?  Nope, not exactly.  Mass is the amount of “stuff” that composes and object, while weight is the amount that stuff weighs.

 

Consider the classic question “What weighs more, a ton of bricks or a ton of feathers?”  Both objects would have identical weights ( one ton ), but vastly different masses.  In some ways it can be easier to think of mass instead as density. 

 

Friction on the other hand is how it slides in contact with another surface.  Picture sliding a mouse down a surface on a 45 degree angle.  If one surface was rubber and the other was glass, the mouse is going to move at vastly different rates.  Friction controls this.   Bounce is often refered to as restitution.  This is the amount of, well, bounce in an object.  Or how much it reacts to a collision.  A rubber ball has a higher “Bounce” value, while a brick is almost 0.  Another key concept is sleep, this is the ability to turn the Rigid Body off during calculations, determines if it is or isn’t used as part of the over all simulation.  Linear and Angular velocity finally are the default movement values of the object.

 

Collisions Physics Style

 

Now let’s take a look at how collisions are handle using a Physics engine.  Let’s change the above scene to add another physics item, this time a static body, like so:

image

 

The top sprite has a RigidBody2D as it’s parent.  The bottom has a StaticBody2D for a parent.  Now we need to define a collision volume for each one, just like we did back at the beginning.  Simple add a new node to each Body ( not the sprite, it’s parent! ) of type CollisionShape2D, so your hierarchy looks like this:

image

 

Then for each CollisionShape2D, you need to pick a bounding shape.  With the CollisionShape2D selected in Inspector simply select the Shape dropdown and pick the one that is best suited:

image

Finally, size it so it covers the collide-able portions of your sprite:

image

 

Now when you run the game:

anim3

 

Tada!  Collisions calculated by the physics engine.  Now you can play around a bit with the physical properties of your Rigid Body and see how it reacts differently.

 

In this case we used a simple box for our collision detection, and that works well for box shaped objects.  But if your object isn’t box or circle shaped, what do you do?  Enter CollisionPolygon2D:

image

 

It works exactly the same as CollisionShape2D, but you can define the shape yourself.  Remove one of the CollisionShape2D nodes and replace it with a CollisionPolygon2D node.  With the Collision node selected, you will notice a new option in the 2D window:

image

 

Click the pen, and you can now draw a polygon around your object:

image

 

And once closed:

image

A MUCH more accurate representation of your object for collisions!

 

Kinematic Nodes

 

Finally let’s look at KinematicBody2D objects.  These are special in that the physics engine doesn’t control their motion, you do.  They can however collide with entities in the physics world.  Generally speaking, this is how you would create your character.  Unlike RigidBodies you cannot apply forces or impulses.  Instead you move them directly.  Let’s create a simple example:

 

First add a KinimaticBody2D to your scene, add a sprite and collision shape for it, like so:

image

 

Now apply a script to the KinematicBody2D with the following code:

extends KinematicBody2D



func _ready():
   set_process(true)
   
func _process(delta):
   move(Vector2(0.04,0))

We are simply moving the body by 0.4 pixels per update.  As you can see from the results however collisions will occur between your game code controlled object and the physics simulation:

anim4

 

There is obviously quite a bit more to the physics simulation.  You can create joints and springs and define what objects collide with other objects, but that covers most of the basics.  Be sure to watch the video if you struggle, as it covers things in a bit more detail!

 

The Video

 

Programming , ,

16. March 2015

 

This post popped up on reddit a few days back and didn’t really get a ton of interest.  I almost missed it myself, but I am glad I didn’t.  Off and on the last couple days, I’ve been playing around with BDX and I have to say, there is the kernel of something really cool here!

 

First off, let me say BDX is really young and it shows some times.  You do some things wrong and you are left with either a crashing game or a cryptic Python error message.  Armature support is currently missing as are a few other features I looked for.  The community is currently small and we are talking a 0.10 release here…  I had to work around a couple bugs, the Android SDK path was getting an extra “ added and I simply can’t get gradle import to work with IntelliJ without hacking out the Android project.  So expect some warts and experimentation.  It’s worth it though, this is pretty cool stuff, as you will now see.

 

Oh yeah, there is also a video version of this post.  It’s also embedded below if you scroll down.  It covers basically the same topics as this tutorial.

 

What is BDX?

 

So, what exactly is BDX?  Well basically it’s a Java library built over top of LibGDX adding 3D support.  Essentially I suppose you can think of it as a 3D scene graph.  Then the cool part… it’s also a plugin to Blender that turns Blender into your 3D world editor.  Basically you create your assets and world in Blender, apply properties using the BGE and Physics portions of Blender, then export and run.  To a much lesser degree, it is also a code generator… sort of.  Let’s take a look at how it works now…

 

Prerequisites

 

First off, you need to have a Java JDK installed, personally I am using JDK 1.7.  If you are going to be building BDX from sources ( we wont here ) you also need Ant installed.  If you have trouble, watch this video on configuring a Java/LibGDX development environment.  It’s more than what you need, but will certainly get you running.

 

Next head on over to the BDX download page and download the BDX zip file.  If you happen to be running on Mac, turn off that infernal “automatically run trusted downloads” setting, as you want the file to remain zipped.

 

image

 

Of course, you will also need Blender installed.  You can download it here.  For the record I, at the time of writing this, am using 2.73a and as you can see from the screenshot above, 0.1.1 of BDX.

 

Please note, I WILL NOT be covering how to use Blender in this post, except for the configuration bit below.  Fortunately I’ve got that down already, so if you are brand new to Blender run through this tutorial series.  It will cover everything you need to get started (and more).

 

Installing BDX

 

At this point I assume you have Blender installed and BDX downloaded.  Now we need to set it up in Blender.  Don’t worry, it’s pretty simple.

 

Load Blender up.

In the menu, select File->User Preferences…

image

 

Select the Add-ons tab, then Install From Disk:

image

 

Now navigate to and select Bdx.zip then click “Install from File…”

image

 

Now we need to enable the plugin.  Back in the Add-ons tab, on the left hand side toggle the option Testing.  Import-Export: BDX should now appear as an option.  Click the Checkbox beside the dynamite icon.

image

 

BDX should now be ready to use!

 

Creating Your First Project

 

BDX does an impressive job of wrapping the project generator for you.  Coincidentally if you see the LibGDX project wizard you’ve made a mistake!

 

In Blender, make sure you are in Default view to start:

image

 

Now, assuming you are running factory settings, look for the Properties window on the right hand side, and scroll down to locate the BDX settings:

image

 

Fill in the settings like so:

image

 

Click Create BDX project.  For Java Package, make sure to give the entire name, not just the url qualifier.   Base Path is the directory the project will be created in, while Directory is the folder within that directory that will be created.  So using the above settings, you will get the directory c:\temp\bdxdemo.

 

Once you click the Create BDX project, the magic begins!

 

It will churn away for a few seconds, and assuming no errors occurred, it should create a new scene for you like so:

image

 

A complete but very simple “game” created for you.  A couple things to notice.  First your Blender now has a new display mode “BDX” available:

image

 

This enables you to switch in and out of the BDX view you see in the screenshot above.  Also, the controls in the BDX scene are now completely different:

image

 

Go ahead and click Export and Run.   This will package your Blender scene, generate some Java code for you, call the Java compiler and assuming no errors, run your game.

 

image

 

Cool stuff!

 

So basically you can now create and edit a world in Blender and code it using LibGDX.  Let’s take a look at the code portion now…  actually, lets look at the project this created.  Go to the directory you specified earlier.

 

The Project Hierarchy… how it works

 

So, here’s the directory structure that is created, with the critical directories expanded:

image

 

If you’ve done any LibGDX development, most of the structure should be immediately obvious.  You get one directory for each project ( android, desktop, html, ios ), then all of the common code goes in to core.  All of the assets ( graphics, scenes, data files, etc… ) that make up your game are put in the assets folder of the android folder.

 

The other folder of note is the Blender folder.  This is where your Blender .blend files are generated/stored.  In many ways, when using BDX, this becomes the heart of your project.  You re-open the .blend file in Blender to reload your project.

 

What about the code?

 

So far we’ve just used Blender… how exactly do we work in Java? 

 

Well the code is located in core/src/com/yourdomain/yourproject.

There are a pair of files generated by default here.  First is BdxApp.java

This is your main application class implementing ApplicationListener.  Here is the code below:

 

package com.gamefromscratch.bdxdemo;

import java.util.HashMap;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.g3d.ModelBatch;

import com.nilunder.bdx.Bdx;
import com.nilunder.bdx.GameObject;
import com.nilunder.bdx.Scene;
import com.nilunder.bdx.Instantiator;
import com.nilunder.bdx.utils.*;
import com.nilunder.bdx.inputs.*;

public class BdxApp implements ApplicationListener {

   public PerspectiveCamera cam;
   public ModelBatch modelBatch;

   @Override
   public void create() {
      modelBatch = new ModelBatch();
      
      Bdx.init();
      Gdx.input.setInputProcessor(new GdxProcessor(Bdx.keyboard, Bdx.mouse, Bdx.allocatedFingers));

      Scene.instantiators = new HashMap<String, Instantiator>();
      Scene.instantiators.put("Scene", new com.gamefromscratch.bdxdemo.inst.iScene());

      Bdx.scenes.add(new Scene("Scene"));
   }

   @Override
   public void dispose() {
      modelBatch.dispose();
   }

   @Override
   public void render() {
      Bdx.profiler.start("__graphics");
      Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
      Bdx.profiler.stop("__graphics");

      Bdx.updateInput();
      Bdx.profiler.stop("__input");

      for (Scene s : (ArrayListNamed<Scene>)Bdx.scenes.clone()){
         s.update();
         Bdx.profiler.start("__render");
         renderScene(s);
         Bdx.profiler.stop("__render");
      }
      Bdx.profiler.update();
   }
   
   
   public void renderScene(Scene scene){
      Gdx.gl.glClear(GL20.GL_DEPTH_BUFFER_BIT);
      modelBatch.begin(scene.cam);
      for (GameObject g : scene.objects){
         if (g.visible()){
            modelBatch.render(g.modelInstance);
         }
      }
      modelBatch.end();
   }

   @Override
   public void resize(int width, int height) {
   }

   @Override
   public void pause() {
   }

   @Override
   public void resume() {
   }
}

 

If you’ve worked in LibGDX before, this should all look pretty straight forward.  Basically it’s setting up the BDX classes and a regular LibGDX render loop.

 

However, the part that is critical to understand is this little line…  it goes a long way towards figuring out how BDX actually works:

 

      Scene.instantiators = new HashMap<String, Instantiator>();
      Scene.instantiators.put("Scene", new com.gamefromscratch.bdxdemo.inst.iScene());

 

This is the special sauce that links Blender and LibGDX together.  If you look in sub directory inst, you will see a class named iScene.java:

package com.gamefromscratch.bdxdemo.inst;

import com.badlogic.gdx.utils.JsonValue;
import com.nilunder.bdx.Instantiator;
import com.nilunder.bdx.GameObject;
import com.gamefromscratch.bdxdemo.*;
public class iScene extends Instantiator {

   public GameObject newObject(JsonValue gobj){
      String name = gobj.name;

      if (name.equals("Sacky"))
         return new com.gamefromscratch.bdxdemo.Sacky();

      return super.newObject(gobj);
   }
   
}

This is actually an area I struggled with at first because I kept editing it by hand, then when I would run the game my changes were being overwritten!  GRRRRRR…  Then it dawned on me, BDX is also a code generator.  This file is being created automatically when you click the “Export and Run” button.

 

So what exactly is it doing?  Well basically it loops through each object in the Blender scene by name and creates the cooresponding Java class in our scene.   For example, when it finds an object named “Sacky” in the Blender scene, it then creates a new com.gamefromscratch.bdxdemo.Sacky instance in our java code.  Essentially this is the link between Blender and Java.

 

Wait, you might ask… what the heck is a Sacky?

 

Great question!

 

First, lets take a look at our Blender scene graph:

image

 

Ahhh… so that’s a “Sacky”.  It’s basically a texture mesh in Blender that’s been named Sacky.  So… where exactly is the class Sacky.java?  If you look in the code directory:

image

 

No Sacky.java. 

 

This is because by default the code is actually “embedded” in the blend file.  In the BDX control buttons, there is a button “Make internal java files external”.  Click it:

image

 

Now in your src folder you should see:

image

 

Ahhh, much better.  At this point you can actually import the gradle project into your favorite IDE and work normally.  You only need to return to Blender and click Export and Run when you make changes to the Blender scene.

 

NOTE: I am using IntelliJ and had a problem with the gradle import.  It really doesn’t like the android gradle version created by default, but updating the version number caused other dependencies to break… oh the joy of Java build systems.  I personally just hacked out everything but desktop and core from the gradle build.  Leave a comment if you want more details how to do this… if you run into the same problem that is.

 

Meet the GameObject

 

The heart of the BDX scenegraph is GameObject.  It’s basically a thing in the world, often called an entity or node in other engines.  Here for example is Sacky.java:

package com.gamefromscratch.bdxdemo;

import com.nilunder.bdx.*;

public class Sacky extends GameObject{

    public void main(){
        if (Bdx.keyboard.keyHit("space"))
            applyForce(0, 0, 300);
    }
    
}

GameObjects have a couple key methods.  main() you see above is what you traditionally think of as update or tick.  It is called each frame, so this is where you update your objects logic.  There is also init() called on creation and onEnd() called when removed.   In the above example you simply poll to see if the user hits space, and if they do apply 300 “force” along the Z axis.  BDX makes use of the physics properties of Blender, as we will see shortly.

 

In a nutshell, the things that make up your game are GameObjects.  Under the curtain, GameObjects are still LibGDX classes we know and love, let’s take a quick look behind the curtain with a debugger and inspect what makes up Sacky here…

image

Essentially GameObject is a fairly light wrapper over the LibGDX ModelInstance class, which is what you ultimately get when you import a 3D model into LibGDX.  It holds all the nodes, animations, geometry and bones that make up an object.  Unfortunately bone animation isn’t currently supported by BDX.  You may also notice that each GameObject holds a reference to the Scene that contains it.

 

Scene itself is essentially the scene graph.  That is, the container that holds the contents of your game ( the GameObjects, Cameras, etc ):

image

 

All told, pretty straight forward stuff and a good reminder that below it all, LibGDX is still right there, just slightly wrapped.

 

Creating a new GameObject

 

Now let’s actually look at creating your own GameObject.  This is basically what the majority of your game development workflow will look like in BDX.  It’s a multistep process, but isn’t difficult.

 

First, in Blender, simply add a new object.  I am going to add a new Mesh->Cube:

image

 

Now in the scene graph select your newly created Cube, rename it to MyCube:

image

 

Now if you select Export and Run, you will now see your Cube:

image

 

Now let’s wire some code to it.

 

In the same directory as your App and the existing Sacky.java file, create a new Java class named MyCube.java, with the following contents:

package com.gamefromscratch.bdxdemo;

import com.nilunder.bdx.*;

public class MyCube extends GameObject{

    public void main(){
        if (Bdx.keyboard.keyHit("space"))
            visible(!visible());
    }

}

Next in Blender click the Export and Run button. Now when you press the spacebar, the visibility of the newly created cube will now toggle.

 

You will notice something… now that we have an object named MyCube in Blender and a class named MyCube.java, when we click the Export button, the iScene.java class is being auto generated each time:

package com.gamefromscratch.bdxdemo.inst;

import com.badlogic.gdx.utils.JsonValue;
import com.nilunder.bdx.Instantiator;import com.nilunder.bdx.GameObject;
import com.gamefromscratch.bdxdemo.*;
public class iScene extends Instantiator {

   public GameObject newObject(JsonValue gobj){
      String name = gobj.name;

      if (name.equals("MyCube"))
         return new com.gamefromscratch.bdxdemo.MyCube();
      if (name.equals("Sacky"))
         return new com.gamefromscratch.bdxdemo.Sacky();

      return super.newObject(gobj);
   }
   
}

Again, this is basically the glue that ties Java and Blender together

 

Texturing our Cube

 

An un-textured cube isn’t exactly exciting, so let’s quickly texture our cube.  To do so, switch to edit mode in Blender, select all vertices and unwrap.  Then create a new material, then a new texture.  Watch the attached video for more details of this process.

 

There is one critical part you need to be aware of, thus why I am bothering to mention it at all.  When generating your texture map, you need to put it in your assets folder!  So when saving it, save it to the correct folder, like so:

image

 

To the following location:

 

image

 

If you don’t implicitly save it to this folder, or a sub-directory, your code will die on execution.  Oh, another top tip… DO NOT RUN YOUR GAME WHILE IN EDIT MODE!  Yeah, it doesn’t work.  I’m guessing it’s a bug, but always switch back to object mode before running.

 

Now that we’ve got our cube textured, let’s run it:

image

 

Very cool.

 

Adding Physics

 

You can also make objects physics objects using Blender.  With your object selected selected the Physics tab in Blender:

image

 

You can now set the object to static ( unmoving ), dynamic ( affected by physics but not moving on its own ) or rigid body ( fully simulated physics ):

image

All other options are ignored, so stick to those three or No Collision.

 

For a Rigid Body there are a number of properties you can select.  You can also determine the bounding type.  Your choices are limited to Box (uses a bounding box to determine boundaries), Sphere (uses a sphere instead) and Mesh (uses the mesh itself. More accurate but much more CPU intensive):

image

As you can see, you can also configure Mass, velocity, etc.

 

Setting Properties

 

Another cool feature is you can actually set properties using Blender and access them in your code.  Therefore you can use Blender as a proper game editor, setting properties such as HP.

 

To do this, open the Logic Editor in Blender, and click Add Property.

image

 

Now name and type your property and set a default value, like so:

image

 

Then in code you can easily access these values:

public class MyCube extends GameObject{
    public void main(){
        if (Bdx.keyboard.keyHit("space")) {
            int hp = this.props.get("hitPoints").asInt();
            Gdx.app.log("Current HP",String.valueOf(hp));
            visible(!visible());
        }
    }
}

Very cool stuff

 

The Video

 

 

Conclusion

 

BDX is certainly a project to watch if you are working in 3D with LibGDX, especially if you use Blender as part of your workflow.  It does over all make for a pretty seamless pipeline and makes world authoring a breeze.

Programming , ,

3. March 2015

 

With GDC on, after Unreal’s announcement I think this will come as a surprise to absolutely nobody…  Unity 5 is here and it now has a new, more indie-friendly license.

 

Here is the release from their blog:

 

Unity 5 is here. For everyone.

Today is the big day. We’re launching Unity 5 globally.  Today.  Yes, you can all download it now.

There are literally over a thousand improvements in Unity 5 that we’d love to talk about.  My quick blog today is not the place to do that.  This note is being posted just as I go on stage to officially launch Unity 5 at GDC in San Francisco.  We’re live streaming the launch and you will see Joachim, Ralph Hauwert, Todd Hooper, Will Goldstone go deeper on the technical upgrades in Unity 5.0.  You will also see David, of course!  And, there will be a few ‘guests’ from the industry on stage to talk about Unity 5 in their own words.  Visit our website at Unity3d.com for the latest details and explanations.  Also — Joachim will post some thoughts later this week once he gets through the craziness of the start of GDC.

Watch the launch event live right here:

 

 

While I can’t get into all the technical detail on Unity 5 in a short post, I do want to share with you the big ideas that we think define Unity 5.

  1. It is a graphics powerhouse capable of rendering beautiful, complex and detailed scenes.

  2. The highly extensible and feature rich editor is now 64-bit and is even more robust than ever with additions like our huge suite of integrated audio design tools*.  (* full multi-track audio mixer.  very cool.)

  3. Unity’s industry leading multiplatform support grow with WebGL and improves with better console platform support and the introduction of IL2CPP.  Unity now supports 21(!) platforms.

  4. With the launch of Unity 5, we are launching Unity Cloud Build which is providing an option to developers to boost their productivity and efficiency through the cloud. You can learn more about Unity 5 here.

The business model…. one of the big questions for everyone.  We’re evolving the best licensing model in the business into something even better. We’re adding value and power so that everyone has the creative freedom they need to succeed.  Before I describe our pricing model, I want to take a moment and describe the philosophy behind the new pricing. I know I am on tricky ground in describing pricing philosophically.  For many, I am sure you’d rather just see the numbers.  Here goes.  First, know that our pricing for Unity 5 is as much about Unity and our values at Unity as it is about anything else. This is entirely different than with any company I have worked with in my life.  We did not start with setting a profit goal and working backwards.  We started with two goals and worked forward to our developers.

Goal #1 — One of the founding principles of Unity is the idea that we work hard to solve very hard technical problems so our developers / users won’t have to.  For this to be at all relevant, our best tools need to be a great value.

Goal #2 — Deep in Unity’s culture is the principle of Democracy. The goal is to price in such a way as to reflect our principles.  Democracy is the principle we were founded on, and it means we do our best to put Unity in the hands of developers, Indies or Pros, that may not have the resources to pay for it.  Its about enabling most everyone to create with the best tools we can make.  I won’t get too soppy in this post — but is is an honor for me to work in a company so mission driven and principled.

So, on to the pricing model.  We have two.

Unity 5 Professional Edition

With Unity 5 Professional Edition, we’re adding incredible value for teams of all sizes.  Unity 5 Pro will have same starting price point as with Unity 4 Pro, at  $75/month subscription or $1500 perpetual. Pro customers get all the power of Unity 5 plus:

  • Team License

  • Unity Cloud Build Pro (12-month subscription)

  • Unity Analytics Pro (currently in beta)

  • Game Performance Reporting (currently in preview)

  • Asset Store Level 11 (a new collection of free assets available each month)

  • Access to previews and betas

  • No revenue limit, no revenue share

We think this is a huge value.  Unity 5 Pro provides a huge upgrade from Unity 4, and it comes with a bunch of extra services and a team license, all for the base pricing of Unity 4.  Inflation gone backwards… or, put another way, better value than ever before.

Unity 5 Personal Edition

Democracy is something we believe in. It’s in the DNA of those that work at Unity. It’s one of the things that drew me to the company. It’s also one of the things that is most important to the games industry. So with that in mind, we are launching Unity 5 Personal Edition. Unity 5 Personal Edition provides all the power of Unity 5 engine and editor. To clarify — this is important — it is the same Unity 5 engine and editor as in the Pro Edition.  It comes with all the features including  Profiler, Occlusion Culling, Render-to-Texture, and Post-Processing Special Effects as well as all the big Unity 5 features like Physically-based Shading, Enlighten, reflection probes and much more.

Unity 5 Personal Edition is free.  No royalty.  Free.

Unity 5 Personal Edition is for professional developers, Indies, hobbyists and studios with revenue under $100,000 and funding under $100,000.

You can see a full comparison of the licenses here.

Download Unity 5, play with it, experiment with it, and create something beautiful and lasting.

Today is a big day.  I hope you are as excited about it as we are at Unity.

John Riccitiello

 

So what exactly does the new license mean? Well for small time developers it's absolutely awesome. Unity Personal edition is basically the exact same product as Pro now, except completely free.  What’s the catch?

 

Well, maximum revenue AND funding of $100,000.  Over that and you need to buy the Professional edition.  So essentially, if you are profitable or well funded, you need the pro version.  If not, it costs not a cent and you get the full version, free.  Not free plus royalties… free.  Up to 100K.

 

There are a couple catches though…  probably the biggest deal is you will have a Unity splash screen on startup.  You don’t have access to the team server, cloud builds and pro analytics tools, but for most people that should be a non-factor.

 

All told, it’s a pretty sweet day to be a game developer!

Programming

2. March 2015

 

Along with the Maya LT release Autodesk also teased a bit about their upcoming game engine Stingray.  You may recall sometime back that Autodesk acquired a company called Bitsquid that were working on a light weight, cross platform C++ game engine.  However since that announcement we have heard absolutely nothing.  Considering their importance to the content creation market place, you’d think Autodesk entering the game engine market ( well, other than Scaleform that is… ) would be a big deal.

 

Well now, after almost a year of silence, some details have emerged with more coming this week at GDC.  The Bitsquid engine is now Stingray.  Granted, details are still pretty sparse.  Here’s what we’ve got so far:

On Wednesday, March 4, from 3:30 - 4:30 p.m. in Moscone Convention Center, West Hall, Room 3003, Autodesk is hosting an exclusive tech preview of its Stingray Game Engine. Built using the core technology behind the Bitsquid engine acquired last summer, Stingray is currently in development and comprises intuitive, powerful tools that make it easier for professional and novice developers to bring graphically advanced games to market on a wide range of platforms. 

“Bitsquid has been a part of the Autodesk family since the acquisition last summer, and both teams have been hard at work to update, improve and add features to the engine,” said Martin Wahlund, CEO, Fatshark. “We are excited to announce that we are actually using the new Stingray engine to build our upcoming ‘Warhammer: End Times - Vermintide’ game.” 

The technical preview at GDC will highlight several core areas of focus that make it easier for game makers of every level create the next generation of blockbusters. Autodesk will give a live demonstration of several key advances it has made in Stingray such as: 

- Simultaneous Platform Deployment: A live link between Stingray and multiple target devices allows game designers to evaluate their games simultaneously on multiple platforms; 
- Integrated Workflow: A more efficient pipeline to export 3D content; 
- Modern Data-Driven Architecture and Powerful Rendering Capabilities: A data-driven core architecture makes it easier for a user to change the look of a game without having to rewrite and re-compile the engine.


As I said earlier, Autodesk entering the game engine market could certainly be a big deal.  Of course there are far too many unknowns  ( like for starters… pricing ) to get too excited yet.  There is a teaser video available, but it tells you absolutely nothing:

If you are interested in beta testing, you can sign up here.

News, Programming

27. February 2015

 

In this tutorial, we look at animating sprites using the Animation class.  We look at loading sprites two different ways.  First creates them by splitting up a Texture loaded into memory.  The second example uses a texture atlas.  As always the code is provide below.

 

You can watch the video in HD here.

 

 

The Source

 

Example 1:

package com.gamefromscratch;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class AnimationDemo extends ApplicationAdapter {
   SpriteBatch batch;
   Texture img;
   TextureRegion[] animationFrames;
   Animation animation;
   float elapsedTime;
   
   @Override
   public void create () {
      batch = new SpriteBatch();
      img = new Texture("walkcycle.png");

      TextureRegion[][] tmpFrames = TextureRegion.split(img,256,256);

      animationFrames = new TextureRegion[4];
      int index = 0;

      for (int i = 0; i < 2; i++){
         for(int j = 0; j < 2; j++) {
            animationFrames[index++] = tmpFrames[j][i];
         }
      }

      animation = new Animation(1f/4f,animationFrames);
   }

   @Override
   public void render () {
      elapsedTime += Gdx.graphics.getDeltaTime();
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
      batch.begin();
      batch.draw(animation.getKeyFrame(elapsedTime,true),0,0);
      batch.end();
   }
}

 

Example 2:

package com.gamefromscratch.com;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;

public class TextureAtlasAnimationDemo extends ApplicationAdapter {
   SpriteBatch batch;
   private TextureAtlas textureAtlas;
   private Animation animation;
   private float elapsedTime = 0f;
   
   @Override
   public void create () {
      batch = new SpriteBatch();
      textureAtlas = new TextureAtlas(Gdx.files.internal("spritesheets/myspritesheet.atlas"));
      animation = new Animation(1f/15f, textureAtlas.getRegions());
   }

   @Override
   public void dispose() {
      batch.dispose();
      textureAtlas.dispose();
   }

   @Override
   public void render () {
      elapsedTime += Gdx.graphics.getDeltaTime();
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
      batch.begin();
      batch.draw(animation.getKeyFrame(elapsedTime,true),0,0);
      batch.end();
   }
}

Programming , , ,

Month List

DisqusCommentsSummary