Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon
30. April 2012

image

 

 

 

Research in Motion, of Blackberry and Playbook fame, recently released Gameplay 1.2, a cross-platform 3D game programming library aimed at Indie developers.  As a game maker, it is easy to ignore RIM these days, especially with their CEO making comments like:

 

"We plan to refocus on the enterprise business and capitalise on our leading position in this segment,"

 

That doesn’t exactly give you the warm and fuzzy about the future of RIM consumer devices now does it?

 

That said, ignoring GamePlay would be a foolish thing to do.  Why?

 

Well first off, it’s free.  I like free.  As in, I really like free.

 

Second and perhaps most amazingly, it is cross platform.  You can target Mac OS, Windows, iOS 5.0 or higher devices, Android 2.3 or greater devices in addition to Blackberry Tablet OS 2.0 and Blackberry 10 devices ( when they arrive ).

 

Third, it’s IDE agnostic, except when required otherwise ( aka, compiling for iOS ).  I can work in my preferred Visual Studio environment.  You however have the choice between Visual Studio, XCode or Momentics IDE ( an Eclipse based IDE Rim inherited from QNX ).

 

Fourth, it’s open source and hosted on GitHub.

 

Here is a screen shot from a demo game in development:

 

 

I have to say, it looks impressive to me.

 

 

Oh, did I happen to mention it’s C++ based?  I think I just heard half of you cheer, while the other half swore! Winking smile

 

 

I do have to say, the folks at Marmalade probably aren’t pleased.  They both fill the same niche… but gameplay is free.  Now the question is, how good is it?

 

Feature-wise, here is what you can expect:

 

Current features in gameplay
  • Written completely in C++ and well documented using doxygen.
  • Solution and workspaces for Visual Studio 2010, XCode 3.2.1 and Momentics IDE’s.
  • Platform-Game abstraction layer separating all operating system code from game engine code.
  • Input system support for Mouse, Keyboard and Touch.
  • Full vector math library with classes for Vector2/3/4, Matrix, Quaternion, Ray, Plane. Also Frustum and BoundingBox/BoundingSphere classes for object culling.
  • Solid OpenGL 3.2+ (for Desktop) and OpenGL ES 2.0 (for Mobile) based rendering system with classes for RenderState, FrameBuffer, Mesh, Material, Effect, Pass and Techniques.
  • Easy-to-use and efficient Font and Sprite classes.
  • Scene-graph components such as Scene, Node, Light, Camera and Model.
  • Binary encoding tool for creating optimized bundles for loading TTF fonts and 3D game assets supporting both COLLADA and FBX formats.
  • Extensible animation system with classes for Animation, AnimationClip and Curve with built-in AnimationTarget’s on Transform and MaterialParameter’s classes.
  • Complete 3D audio system with additional support for compressed audio using OGG and supporting HDMI gaming.

 

New features in gameplay v1.2
  • Newplatforms now supporting:
    • BlackBerry Tablet OS 2.0 and BlackBerry 10 ready!
    • Apple iOS 5.1 for iPhone and iPad
    • Google Android 2.3+
    • Microsoft Windows 7
    • Apple MacOSX
  • New shader-based material system with built-in common shader library.
  • New declarative scene binding.
  • New declarative particle system.
  • Improved physics system with rigid body dynamics and constraints.
  • New character physics and ghost objects.
  • Improved animation system supporting animated skeletal character animation.
  • New declarative user interface system with support for declartive theming and ortho, and 3D form definition with built-in core control classes such as Button, Label, TextBox, Slider, CheckBox, RadioButton. Also includes Layout classes such as Absolute/Vertical and FlowLayout.
  • New cross-platform new game project wizard scripts.
  • New game developer guide.
  • New game samples and tutorials.

 

 

With the following coming soon:

 

The ‘next’ feature branch for v1.3, v1.4, v1.5
  • Optimizations and Performance improvements
  • Shadows
  • Terrain and Sky
  • Gamepad input for Wii, Xbox 360 and Bluetooth® HID controllers
  • Scoreloop Social integration
  • Editor

 

 

Editor hmm?  Wonder what that means?

 

 

I am going to download and play with the SDK, and if I get some time ( something I am chronically short of lately ) I may post a walk around and possibly a tutorial or two.  Has anyone out there been playing with this technology?  Any opinions?

 

 

If you are interested, check out the announcement blog post as well as the source on GitHub.  Oh and perhaps most impressive of all for an open source gaming product… there is actually documentation. The documentation is available here including this development guide[direct pdf link].

 

I have to say, congratulations to Sean Paul Taylor and Steve Grenier on this impressive release!

General


5. April 2012

 

 

image

 

Uggh.  Create a new Ice Cream Sandwich ( Android 4 ) emulator in AVD Manager, hit run and KABOOM! “emulator-arm.exe has stopped working”.  Lovely.

 

Still haven’t figured out exactly what the problem is, but I do know disabling the camera “fixes” the problem.  The most confusing part, creating an emulator that runs ICS, but uses a different screen resolution than WXGA and everything works just fine.

 

So, if you are trying to run the Android emulator using WXGA resolution and it keeps crashing, try disabling the camera.  I’ll update if I ever figure out exactly what is causing the problem.  I found this thread, which suggested disabling ATI Tray tools, however, my machine is nVidia based so that isn’t going to do it.

General


4. January 2012

 

 

 

Mobile development is certainly hot these days and as a result a number of mobile frameworks have popped up allowing you to target multiple devices with a single code base.  Problem is, it’s not just one or two frameworks we are talking about, more like 20 or 30, maybe even more!   Trying to pick the right one is a simply daunting task!  You need to factor a number of things in such as quality, features available,  price, languages supported and perhaps most important of all, the platforms supported.

 

 

 

Fortunately there is a tool that can greatly help.  This handy matrix at markus-falk.com breaks down many of the available mobile frameworks.  Down the left hand side are all of the various Frameworks, then across the top are the platforms they support, the languages you can program in, the features they support ( such as Accelerometer, Camera, etc.. ), as well as if it is freely available and if it is open source.

 

 

 

Snapshot of a portion of the matrix:

image 

 

 

 

 

He also provided a handy filtering tool, oddly named “Start Wizard”.  You can check off your criteria here and it will dynamically update the matrix to include only the frameworks that meet your criteria.  Here is the wizard in action:

 

 

image

 

 

 

Simply click the features you require, hit Find Framework and PRESTO!  a list of Frameworks compatible with your selection.   The list is by no means perfect.  First off, it is very iOS centric, but given that iOS is possibly the most popular OS for mobile development, I suppose this makes sense.   Perhaps most glaringly, it doesn’t tell you if the framework can target PC, Linux or Mac, which is a shame as that is a very important detail to many people ( myself included ).  Finally there are frameworks missing ( again, this goes back to the iOS centric aspect ), such as mobile web apps like Flash and Silverlight, or projects like MonoGame and ExEn.  Additionally all the C++ specific frameworks like SIO or Marmalade are absent as well.  I can understand why Flash and Silverlight would be left out, but then why was jQuery included?

 

 

 

 

Faults aside, this handy tool provides a wonderful starting point if you are looking for a cross platform mobile framework.  Even better, much of the results are populated programmatically, so the data should stay fairly relevant as time goes on.  Just be sure to keep in mind, other options exist!

 

 

 

So go ahead and check it out.

Cool Thing of the Week


12. October 2011

Logo

 

Google has released their new open sourced write once run anywhere gaming library, PlayN.  Well if by anywhere you mean Android, Flash, HTML5 or Java that is.  Here is the announcement video:



 

 

In a nutshell, you write your code in Java and it cross compiles to the 4 supported formats.  It’s odd that in the video they announce iOS as one of the platforms that developers need to support ( probably the biggest platform to boot! ) and yet PlayN doesn’t support iOS.  A bit of a headscratcher there!

 

Anyways, I will take a closer look into PlayN and give a review of sorts over the next couple days.

Programming General


25. April 2011

 

So, in its relatively short lifespan Android has seen a 1.0, 1.5, 1.6, 2.0/2.1, 2.2, 2.3 and most recently 3.0 release.  As a developer, you need to decided which of these to target and which of these to ignore.  In many ways, if you are using Unity or another engine it makes the decision easier, as they set a minimum level and abstract away the details in their own code.  For the record, the minimum Android version supported by Unity is 2.0.

 

One of the most obvious factors in deciding what version to support is market penetration.  Luckily, Google provides such information.  This chart shows the OS version of devices that have connected to the market in the past 14 days.

 

Hmmm, pretty simple really when you look at it.  Support Android 2.1 and higher and you are good to go.

 

From a developer perspective this is pretty true too.  There were vast numbers of changes between 1.5 and 1.6, things you would think would be a no brainer like multi resolution support, but due to such small market numbers in the first place, I think we can simply ignore 1.5 and earlier.  Trust me, they aren’t worth developing for.

Android 2.0/2.1

From a game developer perspective Android 2.0 really isn’t all that different from Android 1.6 but there are a few giant gotchas, not to mention the various “undocumented” features.

First off, due to a move towards virtual buttons, HOME, MENU, BACK and SEARCH buttons now execute on key up, instead of down.  These little changes cause all kinds of nightmares moving between platform versions.

Perhaps of the most importance to game developers, MotionEvent can now report multiple simultaneous touches ( aka, multitouch ).  Also, if you are using the NDK ( C native code ), OpenGL ES 2.0 is now supported.

Really, that’s about it.  There are other changes of course, support for bluetooth 2.1 profiles, better thumbnail generation, etc… but to a game programmer, not much else of consequence changed between 1.6 and 2.0.

 

Android 2.2

This was the big daddy of all updates.  First of all, they enabled JIT in the Dalvik VM, resulting in 2x-5x performance increase CPUwise over Android 2.1.  Personally, I never experienced anywhere near that level of increase, but the improvement in speed is extremely noticeable.  So first and foremost, your code is going to be faster running on Android 2.2.  If CPU bound, in some cases then, your code is going to be MUCH faster on Android 2.2.

Besides enabling JIT there were a number of other changes of note to a game developer.  One exceedingly big one is the ability for Apps to install to SD card instead of into the devices memory.

Perhaps biggest of all is that OpenGL ES 2.0 support is now available to Java based apps.  The media framework also gained a few new abilities that are quite useful, like the ability to detect the completion of a sound loading in a SoundPool.

That’s about it, but then again… a massive increase in speed, the ability to load to an SD card and OpenGL 2.0 ES support…  that’s a pretty substantial upgrade.

 

Android 2.3

Android 2.3 is one of the first versions that actually looked at gaming as a priority.  They improved the garbage collector to minimize pauses, which are killer to immersion.  Nothing like having a 30fps shooter slow to a crawl because the garbage collector kicked in.  They also increased the performance of touch and keyboard events and used a 3rd party OpenGL ES video driver to increase 3D performance.

In the feature perhaps most called for, they implemented OpenSL ES for native audio support.  Up until 2.3, audio support has been at best weak on Android.  Now expect to see a lot of audio applications from the iPhone show up on Android because frankly until now, they were impossible to implement.

For the very few games that require it, if you want to use a front facing camera, Android 2.3 is where support was added.  Also added support for a slew of new sensors to enable Wii-esque actions, if of course the device has said sensors installed.

Really, in the end, the audio changes are the main event in the 2.3 release.

Unless of course you are doing Native Development using the NDK.  If that’s the case, this release was huge.  Until 2.3, you basically used the NDK to develop libraries that you called from a Java code.  All your UI and event management code had to be done in Java.  With 2.3, they added the NativeActivity class which pretty much allows you to work 100% in NDK/C++ code and kiss java goodbye. 

This should result in a performance improvement and make porting to Android easier.  My question is, will it fragment the market even more?

 

Android 3.0

And this brings us to the most current release as of writing, 3.0.  3.0 was mostly about adding tablet and tablet UI support to Android, but from a developers perspective there were a few new additions that are handy.  Lets go with the biggy first, Android 3.0 is the first OS release to support multicore processors.  So I suppose you want to target that shiny new Tegra2, 3.0 is where you are going.

They also added new animation support, but that’s not really animation support in a way that a game developer would care, that’s more for flying bouncing windows and other annoying and overly abused eye candy.

They did however add hardware acceleration for 3D graphics.  I am kind of surprised it took this long, but is definitely a welcome feature.

They also added something called Renderscript, which due to my ignorance may or may not be of use to game developers.  I really need to look into it further, but for now I will let Tim Bray @ Google explain it.

Renderscript is a new API targeted at high-performance 3D rendering and compute operations. The goal of Renderscript is to bring a lower level, higher performance API to Android developers. The target audience is the set of developers looking to maximize the performance of their applications and are comfortable working closer to the metal to achieve this. It provides the developer three primary tools: A simple 3D rendering API on top of hardware acceleration, a developer friendly compute API similar to CUDA, and a familiar language in C99.

Renderscript has been used in the creation of the new visually-rich YouTube and Books apps. It is the API used in the live wallpapers shipping with the first Honeycomb tablets.

The performance gain comes from executing native code on the device. However, unlike the existing NDK, this solution is cross-platform. The development language for Renderscript is C99 with extensions, which is compiled to a device-agnostic intermediate format during the development process and placed into the application package. When the app is run, the scripts are compiled to machine code and optimized on the device. This eliminates the problem of needing to target a specific machine architecture during the development process.

Renderscript is not intended to replace the existing high-level rendering APIs or languages on the platform. The target use is for performance-critical code segments where the needs exceed the abilities of the existing APIs.

When I get the chance I will look into this Renderscript a bit closer, but it does sound interesting.  3.0 is such a niche of installed devices however that it really isn’t a feasible minimum level to target at this point.

 

 

So in summary, 1.5 and earlier are so ancient and decrepit you are just as well as ignoring them.  1.6 is pretty much the “core” of the current API, but a large portion of the 1.6 install base will be running on old hardware where the resolutions simply may not be worth supporting ( like 320x480 ) in a game, so this generation may be skippable on that merit alone.  Multi-touch and ES2.0 native support are the big draw to 2.0/2.1, while 2.2 offered a fair number of advantages.  Simply put, 2.3 and 3.0 currently don’t have a big enough install base to bother supporting as your minimum target.

Therefore, and this is purely opinion, if I were starting a game today… which I suppose I am, I would look at 2.0 as my baseline target unless I really needed one of the new features or the performance gains that 2.2 offers.  Luckily in my case, the developers at Unity already came to the same conclusion I have.

One last word of warning.  In my brief time working with Android, I found version bugs to be a major pain in the ass, especially in code dealing with media.  I had code that wouldn’t work in the emulator, that would only work in the emulator, that would work in 1.6, and 2.2 but not in 2.1.  Put simply, Google have done a pretty terrible job at times in the forward/backward support category.  With your code, make sure you test on as many devices and as many OS versions as you can.  This single handedly is the reason I am not developing directly for Android any more.  I spent more time, by a large magnitude, dealing with crap like this than I actually did developing.  Of course, your mileage may vary!

Design


GFS On YouTube

See More Tutorials on DevGa.me!

Month List