Planet Gamedev

Game AI for Developers

BROADCAST: Star Citizen's Flight Simulation and Combat AI (November 30th)

by Alex J. Champandard at November 29, 2014 04:00 AM

BROADCAST: Star Citizen's Flight Simulation and Combat AI (November 30th)

This upcoming broadcast on Sunday, November 30th at 20:00 UTC will take place online within your browser using streaming audio/video:

“This interview with Matthew Jack will dig into the technical details behind the technology that powers Star Citizen, in particular for Arena Commander: a dog-fighting and flight simulation module for the game. You'll see the debugging tools in particular, as well as the wider challenges of building a living world AI.”

To subscribe for email reminders and check the exact time in your current timezone, visit this broadcast's page on AiGameDev.com.

Procedural World

Progressive LOD

by Miguel Cepero (noreply@blogger.com) at November 28, 2014 03:28 PM

We still have to apply this to entire scenes, but here you can see how it is possible to have progressive level of detail transitions with voxel data.

Below you can see the same mushroom from the earlier post going through several LODs:


Here is another example, this time using a more regular object so you can better follow the voxel splits:


iPhone Development Tutorials and Programming Tips

Open Source Tool For Automatically Downloading And Updating Your Provisioning Profiles

by Johann at November 27, 2014 10:41 PM

Earlier this month I mentioned some nice tools from Felix Krause for automatically taking and framing screenshots, generating pem files for your push notification server, and updating app data and ipa files on iTunes connect.

Here’s a nice command line tool submitted by Krause for working with providing profiles allowing you to avoid going through the menus in Xcode in case you need to download or repair a provisioning profile called Sigh.

The features of Sigh as listed in the readme include:

- Download the latest provisioning profile for your app
- Renew a provisioning profile, when it has expired
- Repair a provisioning profile, when it is broken
- Create a new provisioning profile, if it doesn’t exist already
- Supports App Store, Ad Hoc and Development profiles
- Support for multiple Apple accounts, storing your credentials securely in the Keychain

You can easily integrate Sigh with your continous integration server and it is very helpful in case your existing profile suddenly becomes invalid.

You can install with: sudo gem install sigh

You can find Sigh on Github here with full usage instructions.

A nice time-saving tool.

Original article: Open Source Tool For Automatically Downloading And Updating Your Provisioning Profiles

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.



OpenGL

Introducing DOPP – an AMD FirePro OpenGL Extension to Capture and Transform the OS Desktop

November 27, 2014 07:52 PM

Need to grab and modify the OS desktop image, or perform display output post-processing of any kind? Learn how AMD makes it simpler and faster, and get the new DOPP SDK here.

Game Producer Blog

Unity sprites tip: not using “generate mip maps” might help with non-blurry images

by Juuso Hietalahti at November 27, 2014 05:34 PM

I tested the new Unity 4.6 and noticed that in the web player, my sprites became blurry. After fiddling with the settings I realized it’s the “generate mip maps” that basically meant “generate blurry images”.

unity_sprite_mip_maps

Game From Scratch

Adventures in Phaser with TypeScript– Physics using the P2 Physics Engine

by Mike@gamefromscratch.com at November 27, 2014 02:55 PM

 

 

Now we are going to look at using the P2 Physics engine.  Truth of the matter is, the experience is very similar to what we just experienced with Arcade physics.  The biggest difference is P2 is more accurate, has greater options for simulation and critically, takes up more CPU power.

 

Let’s jump in straight away with a simple example.  We are going to load two identical sprites, anchor one and create a spring between them.  Code time!

/// <reference path="phaser.d.ts"/>
class SimpleGame {
    game: Phaser.Game;
    player1: Phaser.Sprite;
    player2: Phaser.Sprite;

    constructor() {
        this.game = new Phaser.Game(640, 480, Phaser.AUTO, 'content', {
            create: this.create, preload: this.preload
        });
    }
    preload() {
        this.game.load.image("decepticon", "decepticon.png");
    }
    create() {
        this.player1 = this.game.add.sprite(this.game.width/2, 0 + 50, "decepticon");
        this.player2 = this.game.add.sprite(this.game.width/2, this.game.height, "decepticon");

        this.game.physics.startSystem(Phaser.Physics.P2JS);

        // Enabled physics on our sprites
        this.game.physics.p2.enable([this.player1, this.player2]);

        // Make our one body motionless
        this.player1.body.static = true;
        
        // Now create a sprite between our two bodies, parameters are rest length, stiffness and damping
        // Rest length is the length of the spring at rest ( where it's not under pressure )
        // Stiffness is the resistance to movement of the spring
        // Damping determines how fast the spring loses it's "boing"  Our low damping keeps our spring "boinging"
        // Boing is a word I made up to describe the up and down motion of a spring doing it's spring thing
        this.game.physics.p2.createSpring(this.player1, this.player2, 200, 2, 0.3);

        // Lets loop a timed event every 10 seconds that moves the one end of our spring back to the start
        // Mostly just so people that didn't see it run the first time in the browser have something to see!
        this.game.time.events.loop(Phaser.Timer.SECOND * 10, () => {
            this.player2.body.x = this.game.width/2;
            this.player2.body.y = this.game.height;
            }, this);

    }
}

window.onload = () => {
    var game = new SimpleGame();
};

The code is fairly well commented, so I'll just go through the gist of what's happening here.  Just like before, you have to start the Physics subsystem, this time we pass in Phaser.Physics.P2JS.  You also have to register your objects with the physics system.  In this case we do it by passing an array of Sprite to p2.enable();  We set one of our physics bodies to static, which will cause it to not be moved or updated by the physics system.  We then create a spring between the two sprites.  This will cause the second sprite to “spring” toward the first, until the rest length is met ( plus any momentum ), then the spring will, well, spring.  Finally, just to make the demo run a bit better in the browser, we schedule a looping event every 10 seconds that resets the second sprites physics body back to the starting position to start the whole game all over again. 

 

Here is our code running in the browser:

... exactly what kind of browser are you using?

 

One of the big advantages to P2 is it can use Polygon data for more precise collision calculates than body boxes.  Consider the following sprite:

 

megatron

 

When doing bounding box based collisions tests, this would be considered a “hit”:

 

BoundingBox

 

Ideally instead we should create a tighter bounding volume for our collision tests, like so:

BoundingPoly

 

Well, the good news is we can, but we need a third party editor to create the bounding volumes.  One such tool and the one I am going to use in this example is Physics Editor by CodeAndWeb.  It’s commercial software, but there is a free version with the following restrictions:

 

image

 

It can be purchased currently for about $20.

 

CURRENTLY, I COULD NOT GET THE CURRENT WINDOWS VERSION TO EXPORT!

There is a DLL missing, I’ve reported it to the developer, for now instead use the older version available here.

 

For this, I am just using the unregistered version.  Load it up, then click Add Sprites:

image

 

Navigate to the sprite you want to work with and click OK.  It should appear in the window like so:

image

 

I’m full of serious lazy, so I’m going to let the app do the work, simply click the Shape Tracer icon:

image

 

Now in the resulting dialog, play with the tolerance and alpha value until you have a bounding volume you like with a vertex count you can deal with:

image

 

Once you are happy with it, set the Exporter on the right to Lime + Corona ( JSON ).

image

 

Save the resulting file to your project directory.

 

Now time to actually use the results in Phaser:

/// <reference path="phaser.d.ts"/>
class SimpleGame {
    game: Phaser.Game;
    player1: Phaser.Sprite;
    player2: Phaser.Sprite;

    constructor() {
        this.game = new Phaser.Game(640, 480, Phaser.AUTO, 'content', {
            create: this.create, preload: this.preload
        });
    }
    preload() {
        this.game.load.image("megatron", "megatron.png");
        this.game.load.physics("physicsInfo", "physics.json");
    }
    create() {
        this.player1 = this.game.add.sprite(0, 0, "megatron");
        this.player2 = this.game.add.sprite(0, 0, "megatron");

        // Being lazy, positioning sprite after creation so we have a valid width/height
        this.player1.position.set(this.player1.width / 2, this.player1.height / 2);
        
        // Now another sprite on the right side of the screen, down slightly
        this.player2.position.set(this.game.width - (this.player2.width / 2),  this.player2.height / 2 + 85);

        

        this.game.physics.startSystem(Phaser.Physics.P2JS);
        
        // Passing in true while enabling physics on an object causes the debug renderer to draw the physics body
        this.game.physics.p2.enable([this.player1, this.player2], true);

        // You need to call clearShapes() to get rid of the existing bounding box
        this.player1.body.clearShapes();
        this.player2.body.clearShapes();

        // Now load the polygon bounding data we created externally
        this.player1.body.loadPolygon("physicsInfo", "megatron");
        this.player2.body.loadPolygon("physicsInfo", "megatron");

        // Now let's get this party started
        this.player2.body.moveLeft(80);

        // Finally, when the collision occurs, move back to the beginning and start over
        this.player2.body.onBeginContact.add((body, shapeA, shapeB, equation) => {
            this.player2.body.x = this.game.width - (this.player2.width / 2);
            this.player2.body.y = this.player2.height / 2 + 85;
            }, this);
    }
}

window.onload = () => {
    var game = new SimpleGame();
};

 

WARNING!  When using P2 physics, if your physics body starts even slightly outside the bounds of the screen, it will start with forces applied against it!

 

When you run this code, it creates two identical Megatrons, on each side of the screen, slightly offset, then sends one towards the other… ok, let’s just watch it:

... exactly what kind of browser are you using?

 

As you can see, using Polygon volumes allow for much greater precision in your collision tests.  Using simple bounding boxes, the collision would occur a great deal earlier.

 

There is a lot more about P2 physics, but in all honesty, Polygon’s are probably the single biggest reason to use it.  Again it is important to remember that P2 is the slowest option, but the most precise.  Also, you have the option of mixing and matching physics engines within the same game.

 



iPhone Development Tutorials and Programming Tips

Open Source Swift Module For Creating Neatly Animated Tab Bar Items

by Johann at November 27, 2014 07:59 AM

I’ve mentioned a number of custom libraries and components for enhanced tab bars, most recently JFATabBarController which provides a nicely scrolling tab bar for going through several pages of items.

Here’s an open source Swift module that allows you to add a number of very slick animations to your tab bar, and also allowing you to provide animations of your own called RAMAnimatedTabBarController from Ramotion.

RAMAnimatedTabBarController includes flip, bounce, and rotation animations, that enhance the interactivity of the tab bar. You can subclass the RAMItemANimation to include your own animations for when an item is selected, deselected, and loaded.

This image from the readme shows RAMAnimatedTabBar in action:

RAMAnimatedTabBar

RAMAnimatedTabBar

You can find RAMAnimatedTabBarController on Github here.

A very nice module for enhancing the tab bar.

Original article: Open Source Swift Module For Creating Neatly Animated Tab Bar Items

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Tutorial: Using The UIPrintInteractionController To Print Content With Proper Formatting

by Johann at November 27, 2014 12:56 AM

More and more apps are adding a print feature, and here’s a nice in-depth guide by Nate Cook on using the UIPrintInteractionController API to print content exactly as desired.

In the guide Nate shows:

- How to perform the basic printer job setup using UIPrintInfo, printing already formatted content with UIPrintItem
- Printing already formatted items with printItem, creating a basic UIPrintFormatter and formatting your content
- Using UIPageRenderer to print an item with complete control
- Setting up a UIPrintPickerController to present an in-app UI for printing in iOS 8

You can find the guide over on the NSHipster blog.

A nice guide for those looking to add a printing feature within their apps

Original article: Tutorial: Using The UIPrintInteractionController To Print Content With Proper Formatting

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Procedural World

The Missing Dimension

by Miguel Cepero (noreply@blogger.com) at November 26, 2014 06:34 PM

I believe when you combine voxels with procedural generation you get something that goes well beyond the sum of these two parts. You can be very successful at any of these two in isolation, but it is when you mix them that you open up a whole set of possibilities. I came to this realization only recently.

I was watching a TV series the other night. Actors were filmed against a green screen and the whole fantasy environment was computer generated. I noticed something about the ruins in this place. The damage was clearly done by an artist's hand. Look at the red arrows:


The way bricks are broken (left arrow) reminds me more of careful chisel work than anything else. The rubble (right arrow) is carefully arranged and placed around the floor. Also we should see smaller fragments of rocks and dust.

While the artists were clearly talented, it seems they did not have the budget to create physically plausible damage by hand. The problem with the series environment was not that it was computer generated. It wasn't computer generated enough.

Consider physically-based rendering. It is used everywhere now, but there was a time when artists had to solve the illumination problem by hand. Computing photons is no different than computing rolling stones. You may call it procedural generation when it is about stones, and rendering when it is photons, but these are the same thing.

As we move forward, I see physically based generation becoming a thing. But there is a problem. Until now we have been too focused on rendering. Most virtual worlds (like game scenes) are described only as a surface. You cannot perform physically based generation in a world that is only a surface. We are missing the inner dimension.

Our world is 4D. This is not your usual "time is the fourth dimension" pickup line. The fourth dimension is the what, like when you ask what's inside a box. Rendering was focused mostly on where the what turns from air into solid, which is a 3D surface. While 3D is good enough for physically based rendering, we need 4D for a physically plausible world.

Is that bad that we are not 4D? In games this translates to static worlds, or scripted destruction at best. You may be holding the most powerful weapon in the universe but it won't make a dent on the floor. It shows everywhere as poor art, implausible placement of rocks, snow, debris and damage, also as lack of detail in much larger features like cities, castles and landscape.

If you want worlds that can be changed by its inhabitants, or if you want to generate content by simulation, you need to know your world as a volumetric entity. Voxels are a very simple way to achieve this.

Going 4D with your content is a bit of a problem. Many of the assets you may have could not work. Not every mesh defines a volume. Often, meshes have holes in them. They do not show because they are hidden by other parts of the object. These are not holes like the center of a doughnut. It is a cut in the mesh that makes it just a surface in 3D space, not a closed volume.

Take a look at the following asset:

The stem of this mushroom is not volumetric. It is missing the cap. This does not show because the top of the mushroom is sunk into the stem and this hole is completely hidden from sight. If you tried to voxelize this stem it would have unpredictable results. This hole is a singularity to the voxelization, it may produce all sorts of artifacts.

We have voxelization that can deal with this. If you voxelized the top and bottom together, the algorithm is robust enough to realize the hole is capped by other pieces. But we just got lucky in this case, the same does not apply to any open mesh.

Even if you get meshes that are closed and topologically correct, you are only describing a surface. What happens when you scratch the surface? If I cut the mushroom with a knife, it should reveal some sort of mushy, moist material. Where is this information coming from? Whoever is creating this asset has to put it there. The same applies to the bricks, rocks, plants, even living beings of your virtual world.

I think the have reached a turning point. Virtual worlds will remain static and very expensive to build unless we can make physically correct decisions about the objects in there. Either to destroy them or to enhance them, we need to know what they are made of, what is inside.



iPhone Development Tutorials and Programming Tips

Open Source Project Allowing You To Use The iOS 8 UIAlertController Syntax In iOS 7

by Johann at November 26, 2014 02:21 PM

With the iOS 8 SDK Apple has delivered a much simpler API for creating UIAlertView’s and UIActionSheet’s, but if you’re looking to support iOS 7 you can’t use the new clean and simple syntax of UIAlertController.

Here’s an open source project from Peter Steinberger that bring backwards compatibility to the iOS 8 UIAlertController API with PSTAlertController.

PSTAlertController brings the new alert controller API to iOS 7 allowing, you simply need to replace UIAlertController with PSTAlertController, program the way you would with iOS 8’s UIAlertController API and on iOS 8 the new alert controller will be used, and on iOS 7 PSTAlertController.

You can find PSTAlertController on Github here.

A useful component for those looking to use the new UIAlertController API while supporting iOS 7.

Original article: Open Source Project Allowing You To Use The iOS 8 UIAlertController Syntax In iOS 7

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Library Providing A Nice Collection Of Custom Transitions And Interaction Controllers

by Johann at November 26, 2014 07:25 AM

Earlier this year I mentioned a nice collection of interesting animated transitions and a tutorial on using the transition API that was added with iOS 7.

Here’s another nice open source library that simplifies use of the transition API and providing a number of custom  transitions and interaction controllers from Raizlabs called RZTransitions.

RZTransitions provides a wide number of animation, and interaction controllers, and provides a simple api for using custom transitions and you can mix and match all the included transitions and interaction controllers for interesting effects.

Here’s an animation from the readme showing off some of the included transitions:


RZTransitions

You can find RZTransitions on Github here.

A great library for creating different transition effects.

Original article: Library Providing A Nice Collection Of Custom Transitions And Interaction Controllers

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Tutorial: Creating A High-Performance Smooth Scrolling Collection View With AsyncDisplayKit

by Johann at November 26, 2014 12:11 AM

Last month I mentioned an interesting library from Facebook called AsyncDisplayKit for creating smooth interactive user interfaces.

Here’s a nice practical hands on-guide by René Cacheaux that explains how to use AsyncDisplayKit to create a smooth scrolling collection view with image and text even when the view has multiple layers, and blurring/unblurring effects.

You’ll learn how to set up the different elements of the view as nodes, perform operations in the background, and reuse cells for maximum performance.

You can find the tutorial over on the Ray Wenderlich blog.

A nice guide on using the powerful AsyncDisplayKit library.

Original article: Tutorial: Creating A High-Performance Smooth Scrolling Collection View With AsyncDisplayKit

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Procedural World

Instance Voxelization

by Miguel Cepero (noreply@blogger.com) at November 25, 2014 04:29 PM

We are finishing the voxelization features in Voxel Studio.  Here is how it looks like:


At only 40x80x40 voxels it is a good reproduction of the Buddha. You can still see the smile and toes.

This computes 12 levels of detail so when this object is distant we can resort to a much smaller representation. If you know what texture mipmaps are, you'd see this is a very similar concept.

The LOD slider produces a very cool effect when you move it quickly: you can see the model progress quickly from high to low resolution.

And here is the Dragon at 80x80x50 voxels:


Game Design Aspect of the Month

IGDA Webinar: The Evolution of Videogame Design

by noreply@blogger.com (Sande Chen) at November 25, 2014 03:49 PM

In this video, creative producer Patrick Holleman describes how tenets of game design evolved during the three historical ages that he calls the arcade era, the composite era and the set piece era.




Game design Webinars from the IGDA are held on every third Wednesday of the month.



iPhone Development Tutorials and Programming Tips

Tool: An Easy To Use Cocoa Dependency Manager That Works With Github And Git Repositories

by Johann at November 25, 2014 02:30 PM

Carthage is an open source Cocoa dependency management solution released by Justin Spahr-Summers that makes it dead simple to checkout and build dependencies from Github or any Git repository, and has a number of advantages over other solutions.

Carthage takes a new approach and does not require any specification files to be included with your dependencies, you simply need to create a single cartfile listing your dependencies along with your version requirements. Carthage will only work with iOS 8 as it uses the new dynamically linked framework capability.

Carthage supports Github and other Git repositories, allowing you to easily checkout and build your dependencies from the command line. Carthage does not modify your Xcode projects you simply need to drag the freshly built frameworks into your projects.

This snippet from the readme shows an example Cartfile:

# Require version 2.3.1 or later
github “ReactiveCocoa/ReactiveCocoa” >= 2.3.1

 

# Require version 1.x
github “Mantle/Mantle” ~> 1.0 # (1.0 or later, but less than 2.0)

 

# Require exactly version 0.4.1
github “jspahrsummers/libextobjc” == 0.4.1

 

# Use the latest version
github “jspahrsummers/xcconfigs”

 

# Use a project from GitHub Enterprise, or any arbitrary server
git “https://enterprise.local/desktop/git-error-translations.git” >= 0.1

Note that Carthage will only work with iOS 8 because it uses the dynamically linked framework functionality.

You can find Carthage on Github here.

A nice easy to use dependency management solution for Github and Git based dependencies.

Original article: Tool: An Easy To Use Cocoa Dependency Manager That Works With Github And Git Repositories

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.



Tool: View The Memory Heap In App To Avoid Any Memory Issues

by Johann at November 25, 2014 07:12 AM

When ARC was introduced in Objective-C memory management become much less of an issue, but you can still create issues especially with holding objects longer than needed.

Here’s an open source tool that allows you to monitor the memory heap from within your app and quickly identify any memory issues called HeapInspector from tapwork.

With heap inspector you can get data from running objects that includes the reference history, detailed information, and screenshots.

You can also take snapshots to compare the heap before you started recording so you can quickly identify any leaking objects, unneeded objects that are still alive and more.

Here’s an animation from the readme:
HeapInspector

You can find HeapInspector-For-iOS on Github here.

A nice tool for easily identifying any potential memory issues.

Original article: Tool: View The Memory Heap In App To Avoid Any Memory Issues

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.