Posted:

(Cross-posted with the Google Developers Blog)

Fun Propulsion Labs at Google* is back today with some new releases for game developers. We’ve updated Pie Noon (our open source Android TV game) with networked multi-screen action, and we’ve also added some delicious new libraries we’ve been baking since the original release: the Pindrop audio library and the Motive animation system.

Pie Noon multi-screen action

Got an Android TV and up to 4 friends with Android phones or tablets? You’re ready for some strategic multi-player mayhem in this updated game mode. Plan your next move in secret on your Android phone: will you throw at an opponent, block an incoming attack, or take the risky approach and wait for a larger pie? Choose your target and action, then watch the Android TV to see what happens!

We used the NearbyConnections API from the most recent version of Google Play Games services to easily connect smartphones to your Android TV and turn our original Pie Noon party game into a game of turn-based strategy. You can grab the latest version of Pie Noon from Google Play to try it out, or crack open the source code and take a look at how we used FlatBuffers to encode data across the network in a fast, portable, bandwidth-efficient way.

Pindrop: an open source game audio library

Pindrop is a cross-platform C++ library for managing your in-game audio. It supports cross compilation to Android, Linux, iOS and OSX. An early version of this code was part of the first Pie Noon release, but it’s now available as a separate library that you can use in your own games. Pindrop handles loading and unloading sound banks, tracking sound locations and listeners, prioritization of your audio channels, and more.

Pindrop is built on top of several other pieces of open source technology:

  • SDL Mixer is used as a backend for actually playing the audio.
  • The loading of data and configuration files is handled by our serialization library, FlatBuffers.
  • Our own math library, MathFu, is used for a number of under-the-hood calculations.

You can download the latest open source release from our GitHub page. Documentation is available here and a sample project is included in the source tree. Please feel free to post any questions in our discussion list.

Motive: an open source animation system

The Motive animation system can breathe life into your static scenes. It does this by applying motion to simple variables. For example, if you’d like a flashlight to shine on a constantly-moving target, Motive can animate the flashlight so that it moves smoothly yet responsively.

Motive animates both spline-based motion and procedural motion. These types of motion are not technically difficult, but they are artistically subtle. It's easy to get the math wrong. It's easy to end up with something that moves as required but doesn't quite feel right. Motive does the math and lets you focus on the feeling.

Motive is scalable. It's designed to be extremely fast. It also has a tight memory footprint -- smaller than traditional animation compression -- that's based on Dual Cubic Splines. Our hope is that you might consider using Motive as a high-performance back-end to your existing full-featured animation systems.

This initial release of Motive is feature-light since we focused our early efforts on doing something simple very quickly. We support procedural and spline-based animation, but we don't yet support data export from animation packages like Blender or Maya. Motive 1.0 is suitable for props -- trees, cameras, extremities -- but not fully rigged character models.  Like all FPL technologies, Motive is open source and cross-platform. Please check out the discussion list, too.

What’s Fun Propulsion Labs at Google?

You might remember us from such Android games as Pie Noon, LiquidFun Paint, and VoltAir, and such cross-platform libraries as MathFu, LiquidFun, and FlatBuffers.

Want to learn more about our team? Check out this recent episode of Game On! with Todd Kerpelman for the scoop!

by Jon Simantov, Fun Propulsion Labs at Google

* Fun Propulsion Labs is a team within Google that's dedicated to advancing gaming on Android and other platforms.

Posted:
After months in development, the FlatBuffers 1.1 update is here. Originally released in June 2014, it’s a highly efficient open source cross-platform serialization library that allows you to read data without parsing/unpacking or allocating additional memory. It supports schema evolution (forwards/backwards compatibility) and optional JSON conversion. We primarily created it for games written in C++ where performance is critical, but it’s also useful more broadly. This update brings:


  • an extensive overhaul to the Java API
  • out-of-the-box support for C# and Go
  • an optional verifier to make FlatBuffers practical in untrusted scenarios
  • .proto parsing for easier migration from Protocol Buffers
  • optional manual assignment of field IDs
  • dictionary functionality through binary search on a key field
  • bug fixes and other improvements thanks to 200+ commits from 28 contributors -- thank you!


Download the latest release from our github page and join our discussion list for more details.

By Wouter van Oortmerssen, Fun Propulsion Labs at Google*

*Fun Propulsion Labs is a team within Google that's dedicated to advancing gaming on Android and other platforms.

Posted:
(cross-posted with the Android Developers Blog)


We’re pleased to announce Pie Noon, a simple game created to demonstrate multi-player support on the Nexus Player, an Android TV device. Pie Noon is an open source, cross-platform game written in C++ which supports

  • up to 4 players using Bluetooth controllers.
  • touch controls.
  • Google Play Games Services sign-in and leaderboards.
  • other Android devices (you can play on your phone or tablet in single-player mode, or against human adversaries using Bluetooth controllers).


Pie Noon serves as a demonstration of how to use the SDL library in Android games as well as Google technologies like Flatbuffers, Mathfu, fplutil, and WebP.






You can download the game in the Play Store and the latest open source release from our GitHub page. We invite you to learn from the code to see how you can implement these libraries and utilities in your own Android games. Take advantage of our discussion list if you have any questions, and don’t forget to throw a few pies while you’re at it!


By Alex Ames, Fun Propulsion Labs at Google*



* Fun Propulsion Labs is a team within Google that's dedicated to advancing gaming on Android and other platforms.


Posted:
(Cross-posted with the Google Developers Blog)

Today we're announcing the 1.0 release of MathFu, a cross-platform geometry math library for C++ game developers.  MathFu is a C++ math library developed primarily for games focused on simplicity and efficiency.


It provides a suite of vector, matrix and quaternion classes to perform basic geometry suitable for game developers.  This functionality can be used to construct geometry for graphics libraries like OpenGL or perform calculations for animation or physics systems.


The library is written in portable C++ with SIMD compiler intrinsics and has been tested on Android, Linux, OS X and Windows.


You can download the latest open source release from our GitHub page.  We invite you to contribute to the project and join our discussion list!


By Stewart Miles, Fun Propulsion Labs at Google*


*Fun Propulsion Labs is a team within Google that's dedicated to advancing gaming on Android and other platforms.


Posted:

(cross-posted with the Android Developers Blog)

Today we're announcing the 1.0 release of fplutil, a set of small libraries and tools by Fun Propulsion Labs at Google* (the FPL in fplutil) that is useful when developing C/C++ applications for Android.

fplutil introduces the following:

  • build_all_android.py, an all-in-one build script that allows you to build (with the Android NDK), install and run native (C/C++) Android apps from the command line. This is ideal for build automation, but is also useful in a developer’s compile/run loop.
  • buildutil performs the configuration, build and archive steps of Android and Linux C/C++ applications using a suite of Python modules. This suite of modules can automate builds in a continuous integration environment. This framework uses legacy tools in the Android Development Toolkit.
  • libfplutil enables C/C++ developers to write traditional applications (like Hello World) using "main()" and "printf()" on Android.
  • android_ndk_perf.py is a desktop tool that enables native (C/C++) developers to measure the CPU utilization of their applications on Android, guiding their optimization efforts.  An example report is shown below:

android_ndk_perf.py example HTML report


You can download the latest open source release from our github page. We invite you to contribute to the project and join our discussion list!

By Stewart Miles, Fun Propulsion Labs at Google*

*Fun Propulsion Labs is a team within Google that's dedicated to advancing gaming on Android and other platforms.

Posted:
Today we are happy to announce the first stable release of Glide 3.0. Glide is an open source media management framework for Android that wraps media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface.

Glide is specifically designed not only to be easy to use, but also to make scrolling lists of images as smooth and pleasant to use as possible. To reduce stuttery scrolling in lists caused by garbage collections due to Bitmap allocations, Glide uses reference counting behind the scenes to track and reuse Bitmap objects. To maximize the number of Bitmaps that are re-used, Glide includes a Bitmap pool capable of pooling arbitrary sizes of Bitmaps. 

The 3.0 version of Glide includes a number of improvements, including support for animated GIF and video still decoding, improved lifecycle integration to intelligently pause and restart requests, and thumbnailing support. 

Despite all of the new features, Glide’s interface is still simple and easy to use. To display an image, video still, or animated GIF in a view, you still need only one line:

Glide.with(context).load("http://goo.gl/h8qOq7").into(yourImageView);

Glide will intelligently determine the type of media you’re trying to load, decode it, and return a drawable object that can display the animation or still image in the view. If you want to load specifically a Bitmap, you can do that too:

Glide.with(context).load("http://goo.gl/h8qOq7").asBitmap().into(yourImageView);

You can also do more complex transformations. For example, to upload the bytes of a 250px by 250px profile photo for a user:

Glide.with(context)
.load("/user/profile/photo/path")
.asBitmap()
.toBytes()
.centerCrop()
.into(new SimpleTarget<byte[]>(250, 250) {
@Override
public void onResourceReady(byte[] data, GlideAnimation anim) {
// Post your bytes to a background thread and upload them here.
}
});

For a more complete list of changes, documentation, or to report issues please see the Github page. To see Glide being used in a real application, check out the recently released source of the 2014 Google I/O app and their excellent blog post on image loading. Finally, for questions, comments, or suggestions please join our discussion list.

By Sam Judd, Google Engineering

Posted:
We are thrilled to announce the 1.1 release of LiquidFun, an open-source 2D physics engine. It adds particle simulation to Erin Catto’s popular Box2D engine, and can be used as a drop-in replacement for Box2D. If your program is written in C++, Java, or JavaScript, you can easily use LiquidFun.

Today’s release adds some exciting new features to LiquidFun. Some highlights:

  • LiquidFun now runs in your browser! Using Emscripten, we’ve translated LiquidFun into JavaScript. You can see LiquidFun’s Testbed application, rewritten in JavaScript, running on our landing page.
  • We’ve added iOS support for LiquidFun’s internal Testbed and EyeCandy applications. Earlier versions of LiquidFun could be made to run on iOS, but iOS is now officially supported.
  • We’ve optimized LiquidFun's particle simulation. In particular, we’ve written NEON (a.k.a., Advanced SIMD) code to improve performance on ARM processors.
  • We’ve stabilized the simulation, fixed bugs, and added some cool new functions, including one that automatically splits a particle group into multiple, disjoint particle groups. 
  • We’ve clarified and improved the documentation, thanks to questions from the LiquidFun community.

LiquidFun Games

The 1.1 release also includes two physics-based, open-source games from Google, currently available in the US Play Store.

VoltAir, written in C++, is a fast platformer based on a compelling physics system, plenty of speed and motion, and interesting puzzles. If you’re a native developer, VoltAir’s source code is a great example of how to use LiquidFun.














The second game, LiquidFun Paint, lets you create art that moves, shakes, and delights. It is written in Java, and uses LiquidFun via SWIG bindings. If you’re a Java programmer, you may want to peruse the source code of LiquidFun Paint.



Several other games also have incorporated LiquidFun since its initial 0.9 release last December. One such game is the beautiful Battle of the SeaSons, written by three students from the technology university ETH Zurich.


Adoption

Our March 2014 release of LiquidFun 1.0 has already been integrated into several game development toolkits.
  • LiquidFun is also now a built-in component of the Lobster game programming language. 

Inside LiquidFun

If you’d like to learn even more about how the LiquidFun particle simulation works, you may enjoy our new presentation describing the tech and algorithms, Inside LiquidFun.

By Jason Sanmiya, Fun Propulsion Labs at Google*

*Fun Propulsion Labs is a team within Google that's dedicated to advancing gaming on Android and other platforms.

Posted:
Today, we are releasing FlatBuffers, a C++ serialization library that allows you to read data without unpacking or allocating additional memory, as an open source project.

FlatBuffers stores serialized data in buffers in a cross-platform way, supporting format evolution that is fully forwards and backwards compatible through a schema. These buffers can be stored in files or sent across the network as-is, and accessed in-place without parsing overhead.

The FlatBuffers schema compiler and runtime is written in platform independent C++ with no library dependencies outside the STL, which makes it possible to use on any platform that has a C++ compiler. We have provided methods to build the FlatBuffers library, example applications, and unit tests for Android, Linux, OSX and Windows.

The schema compiler can generate code to read and write FlatBuffers binary files for C++ and Java. It can additionally parse JSON-formatted data into type-safe binaries.

Game developers can use this library to store game data with less overhead than alternative solutions (e.g. Protocol Buffers or JSON).  We’re excited about the possibilities, and want to hear from you about how we can make this even better!

Download the latest release from our github page and join our discussion list!

By Wouter van Oortmerssen, Fun Propulsion Labs at Google*

*Fun Propulsion Labs is a team within Google that's dedicated to advancing gaming on Android and other platforms.

Posted:
Some of the best apps are those that specialize in a single task. With Patchfield, a new open-source audio library for Android, you can create highly focused audio apps (such as synthesizers and effects) and then combine their capabilities by connecting them to one another in a virtual patch bay. Inspired by JACK, the JACK Audio Connection Kit, Patchfield provides a simple, callback-driven API for implementing audio modules, a flexible API for managing the signal processing graph, and support for inter-app audio routing. Patchfield is the 20% project of Peter Brinkmann, an engineer on the speech infrastructure team.

Running as a remote service, Patchfield allows audio developers to create interoperable apps that focus on a single task each, such as synthesis or effects or recording. The output of one app can be connected to the input of another, for a combinatorial explosion of possibilities. Running locally within a single app, Patchfield provides a powerful way of organizing the audio components of an app. The implementation resides entirely in user space and works on many stock consumer devices, such as Nexus 7 and 10.

Patchfield is available at GitHub, under the the Apache 2.0 License. The repository includes the core library as well as a number of sample projects that illustrate how to use Patchfield. Happy hacking!

DevBytes video: http://www.youtube.com/watch?v=LTisevoxm64

By Peter Brinkmann, Speech Infrastructure team

Posted:
In the 90s, a big company from up north was extremely successful with a dialect of the programming language BASIC (acronym for Beginner's All-purpose Symbolic Instruction Code). One of the reasons it was so successful was that the language was easy to learn and use.

Bringing an easy to learn and use language to the mobile world and the Android platform is the goal of the Simple project. Simple is a BASIC dialect for developing Android applications. It is particularly well suited for non-professional programmers (but not limited to). Simple allows programmers to quickly write Android applications by using the components supplied by its runtime system.

Similar to its 90s relative, Simple programs are form definitions (which contain components) and code (which contains the program logic). The interaction between the components and the program logic happens through events triggered by the components. The program logic consists of event handlers which contain code reacting to the events. In reality it is even simpler than this description.
Let's see how simple it really is. We will quickly write a program simulating the famous Etch-A-Sketch on an Android device. Tilting the device will move the pen, shaking the device will clear the screen. The Simple runtime system gives us three components to provide most of the needed functionality:
  1. the Canvas component - for drawing
  2. the OrientationSensor component - to detect tilting
  3. the Accelerometer component to detect shaking
Let's take a look at the source code for this application:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Dim x As Integer
Dim y As Integer

Event OrientationSensor1.OrientationChanged(yaw As Single, _
pitch As Single, roll As Single)

If roll < -20 Then
x = Math.Min(Canvas1.Width, x + 1)
ElseIf roll > 20 Then
x = Math.Max(0, x - 1)
End If
If pitch < -20 Then
y = Math.Min(Canvas1.Height, y + 1)
ElseIf pitch > 20 Then
y = Math.Max(0, y - 1)
End If
Canvas1.DrawPoint(x, y)
End Event

Event AccelerometerSensor1.Shaking()
Canvas1.Clear()
End Event

The code defines two global variables (lines 1 and 2) and two event handlers, one to handle changes in the device's tilt (lines 4 to 17) and another to handle shaking of the device (lines 19 to 21). The code in the first event handler makes sure to only react to tilting above a certain degree (lines 6, 8, 11 and 13), and if that is the case then it further ensures that the pen does not run off the drawing surface (lines 7, 9, 12 and 14). And finally a point is drawn at the pen position (line 16). As for the other event handler, the only thing it does is clearing the drawing surface in case of shaking (line 20).

Last part missing is the form definition. It defines the form and its properties (lines 24 to 27), followed by the components it contains (lines 28 to 33).

22
23
24
25
26
27
28
29
30
31
32
33
34
35
$Properties
$Source $Form
$Define EtchSketch $As Form
Layout = 3
BackgroundColor = &HFFFFFFFF
Title = "EtchSketch: Tilt to draw - Shake to clear"
$Define Canvas1 $As Canvas
$End $Define
$Define OrientationSensor1 $As OrientationSensor
$End $Define
$Define AccelerometerSensor1 $As AccelerometerSensor
$End $Define
$End $Define
$End $Properties


That's it. The only thing left to do is to compile and deploy the application to an Android device. And voila, here is a screenshot of the application running:

For a definition of the Simple language see the Simple Language Definition (download, 199 KB PDF). For more information on writing Simple applications see the open source project page at code.google.com/p/simple. You can also find information there on contributing to the project, and we encourage you to join our discussion list to provide us feedback.
Programming made Simple!