Skip navigation
Help

stage3d

warning: Creating default object from empty value in /var/www/vhosts/sayforward.com/subdomains/recorder/httpdocs/modules/taxonomy/taxonomy.pages.inc on line 33.

Pirate!We recently announced AIR 3.2 with Stage3D support for mobile. Some of you have asked about learning more about GPU programming, best practices and also some of you had questions regarding the BunnyMark test we had in the AIR 3.2 video.

The BunnyMark demo we showed, uses a tiny framework developed internally at Adobe (named GPUSprite). It makes use of support classes called GPUSprite/GPUSpriteLayer, which optimize rendering by allowing a large number of of sprites to be drawn in a single draw call (batching).

This means all those sprites must be able to sample their image from the same sprite sheet.  Performance is really nice.  You could extend it to multiple sprite sheets, but you will have to organize your content into layers with one layer per SpriteSheet.

All the objects on a higher layer will be rendered on top of objects on lower layers.  For a scrolling game with background, foreground, characters, effect layers and so on, it is a nice authoring solution. Of course this has way more restrictions than what Starling would allow, it actually has very limited features.

So do not consider this as a silver bullet, consider this as an example to learn how to program GPUs efficiently, or also tweak frameworks to achieve higher framerates.

You can download GPUSprite on the FP-SDK github repo.
Download the BunnyMark code (using GPUSprite).

Special thanks to Iain Lobb for the original BunnyMark.
Special thanks to Philippe Elsass for the modified BunnyMark test.

Live demo of GPUSprite below :

Get Adobe Flash player

0
Your rating: None

Unity 3.5 was released and is a game changer even for Unity, download it now!.  There are so many great new features that have already made development faster and cool features to help bring your games to Flash from Unity !

Workflow Improvements

Since I have been using Unity fulltime pretty much on games like SupaSupaCross for SupaSupa Games (pick up a copy at Apple, Amazon or Google for your devices!) and Kimi Raikkonnen IceOne Racing for 24mas while at Impossible Interactive from my *drawlabs game studio, Unity has addressed some major trouble points when doing a full scale multiplatform rollout to mobile (iOS + Android), web and desktop.

Switching Platforms

One major problem was switching platforms and rebuilding the asset cache. Unity now has an Asset Cache server that will minimize library reimports so that it will be easy to switch platforms in minutes.  I can attest that our projects towards the end were really painful switching platforms, no kidding 45+ minutes.  Having that removed is oh so nice when you have 5+ projects that run on all platforms. The horror of accidentally selecting the wrong platform while you have to wait 45 minutes for it to convert one direction and then back is over.  We actually ended having to have the projects on different machines and making two projects hooked to source control that were set to iOS and one to Android to help minimize this.

Occlusion Culling + Lightmapping

Unity updated and replaced the occlusion culling system for speed and better occlusion generation, taking the time down orders of magnitude.  This version also is more precise and you can take the time to do detailed occlusion during development more often.

Lightmapping probes is also a very nice technique to integrate to get what looks like dynamic lights without having dynamic lights and the cost associated.

Source Control for Everyone

A big problem with the pipeline before was having artists work for a day or two and need Unity but they only had the indie version and thus could not participate in our Mercurial and git repositories.  Now even the indie version has source control support (still with .meta files though which is a necessary evil for now — still going to have straggling metas when developers/artists remove/add one they didn’t edit).

Text Based Serialization of Scenes and Prefabs!

This one is epic, I loathe binary formats of old which turn files into blackboxes of repository filling chunks, now you can choose to serialize your scenes and prefabs in text which they have chosen very wisely as YAML.  Perfect use case for YAML and now we can have 2+ people work on the same scene and not end up hating one another when the other has to overwrite all changes since they used to be all binary.

The removal of binary files in game development is very needed and one of the most difficult things to shake with all game engines I deal with.  Binary files for development are bad…  YAML, JSON, even XML is a better way so you can see what changed on each update not just replace the file.

At this point I love Unity for making my day faster…

That isn’t even the really cool stuff like Native Client Support and Flash Player Exporting!

Native Client Support

I feel this could be big if NaCL is adopted widely, this also helps with the Chrome Web store and again taking your game to places that individual development of the engine to do so would be non economical.  Unity knows when to even overlook their own WebPlayer in favor of other players such as Flash and NaCL from Google.

Flash Player Export

note: (Still preview and will require extra license when final)

The big daddy setup to scrape up all the Flash developers.  You can now develop Flash games inUnity using a better programming platform that Adobe was just too protective of Flash old guard to pursue 4 years ago, at least they are now. Flash 11 to Stage3D exporting to lower level Flash was a very smart move for Adobe at this point to keep evolving Flash.  However with them dropping mobile player Flash’s future is still a little shaky as it loses developer mind share, typically that is fatal.  One way to keep great game and interactive developers is what they are doing with Stage3D and Flash 11. Unity is very smart to jump in here and it is a great opportunity for both Adobe and Unity.

2 big pieces missing from the Flash version are terrain export and use of non Flash classes like WWW class.  Unfortunately since this is the only supported Unity WWW class that works across all platforms well this may require some #if defs to route around web/service calls and rewriting web and or networking classes in AS3.

Since this is the first version and has such great potential for overtaking Flash gaming on the web with more native and lower level hardware access, watch this space to grow and be a game changer.

Flash features that are in and out of the current iteration

Supported

  • Lightmapping
  • Occlusion culling
  • Basic scripting
  • Editor scripting (JavaScript / C# / Boo). Note: for JavaScript, use #pragma strict.
  • Custom shaders
  • Animation / skinning
  • Basic audio features, such as AudioSource / AudioListener
  • Physics
  • Navigation meshes
  • Baked substance textures
  • PlayerPrefs
  • UnityGUI, except for text input
  • Realtime shadows

Limited support – features with potential issues

  • Image Effects. Some work, some don’t.
  • Not all parts of .NET scripting work (lambda expressions and LINQ aren’t supported, for example)
  • GUIText will have a dramatic impact on performance
  • The new Particle System (Shuriken) works, but scripts that use the Shuriken API will fail to convert to flash

Not supported

  • Unity profiler
  • Asset bundles
  • Text input in UnityGUI
  • WWW classes. Note that you can write your own ActionScript that uses Adobe networking APIs.
  • Raknet networking (if you need networking, you can write it in Action Script 3 directly, using flash API)
  • Terrain
  • Cloth
  • Using VertexLit shaders in combination with:
    - Specular highlights
    - Spot lights
    - Emissive material color
  • Advanced audio features, such as audio effects. Also pitch manipulation is not supported.
  • Deferred rendering
  • AnimationEvents that carry arguments

More on Unity 3.5

0
Your rating: None

Adobe製Stage3D用フレームワーク Proscenium に付属してくる物理演算ライブラリ「Pellet」を単独で使ってみた。

btConvexHullShape Test(要:FlashPlayer11)

Pellet は、C++で書かれたオープンソースの物理演算ライブラリ「Bullet」のAS3移植版。
BulletはBlenderのゲームエンジンで使われてたりする。(MMDが採用してるっていうほうが通りがいいのかな)そのAS3ポートといえば、

Away3D 4.0 jiglib vs Bullet « DevJamMemo
AwayPhysicsを使って衝突判定をしてみる
Flash Player 11 対応の 3D 物理演算ライブラリ「AwayPhysics」 | ClockMaker Blog

等のエントリーですでに紹介されているAway3D4.0用のAwayPhysicsがあるけど、PelletはAlchemyでネイティブのBullet呼び出す形式ではなくて、ピュアAS3で書いてるっぽい? そういう理由からか、現状はBulletの一部の機能が実装されている状況。Petit Bullet 略して Pellet ってことなんだろうか。

機能・パフォーマンス的にAwayPhysicsに及ばないけど、描画と完全に切り離して扱うことができるので自前ライブラリと組み合わせて動かすことができた。Box2DとかJigLibとか触ったことがあれば概ね扱いは同じ。

  1. dynamicsWorldにもろもろのパラメータ渡して初期化
  2. dynamicsWorld内で扱うbtRigidBodyを登録
  3. EnterFrame毎に stepSimulation() で演算
  4. btRigidBodyの行列を、表示用のオブジェクトにコピー

みたいな流れ。

とはいうものの、JigLibと比較すると設定しなくちゃならない必須パラメータが随分多い上に、リファレンスの類が何も用意されてないので、最低限動かすのに必要な情報は Proscenium のサンプルコード

  • TestPhysicsAPI.as
  • TestPhysicsFractalTerrain.as
  • TestPhysicsStaticMesh.as
  • Tutorial06_SimplePhysics.as

から拾った。特にTestPhysicsAPI.as が有用。

あと、Pellet.swc内の catalog.xml からクラス一覧を取り出して、本家Bulletのリファレンスや、Bullet 2.76 Physics Japanese Manual と突き合わせながら用意されてそうなメソッドを探した。無駄に労力使って泥臭く。開発環境大事 orz 「bt〜」というクラス名を本家Bulletと揃えてくれてあるので、アタリを付けるうえでとても助かる。

エントリー冒頭のデモは、凸構造形状を扱うクラスbtConvexHullShapeを使って、球などで近似しない場合にどの程度動くのかを試したもの。一つのコリジョンデータあたり20頂点くらいなんだけど10個くらい動くとキツい。勘所が分かってないのでオレの実装がしょーもないことやってる可能性のほうが高いけど、大量のオブジェクトをガンガン出してヒャッハーしたいとなるとやっぱ球か。

 

ということで btSphereShape(球体)100個。

btSphereShape Test(要:FlashPlayer11)

自分の環境だと40〜45fps。マジメに最適化やって改善できるんだろうか。。

 

地形との衝突判定用途の検証に、凹面三角形メッシュを扱うbtBvhTriangleMeshShapeを使ったウォークスルーも作ってみた。

btBvhTriangleMeshShape Test(要:FlashPlayer11)

初期化に結構な負荷と時間がかかりますが、気長にお待ちください。
カーソルキーで移動、Z,Xキーでカメラのピッチング操作。
※モデルデータは、BTAさん制作の「ケロリン町1.05」をお借りしました。
※主な道路に沿う形でコリジョンメッシュ作ったので、通れそうで通れない路地があったり、ぶつかるはずのオブジェを貫通したりします。

コリジョンメッシュは△1000程度。これは思っていたより現実的な速度で動いた。コリジョンのポリゴン削ればさらに負荷を下げられるかもしれない。

 

今のところ btPoint2PointConstraint、btHingeConstraint といった、複数の剛体を繋いで複雑な物理モデルを構成するためのクラスの大部分が移植されてないようなので、連動して btRaycastVehicle、btKinematicCharacterController という有用なアクションインターフェースが使えない。この辺でもAwayPhysicsに大きく差をつけられてる感じ。

もうひとつ気になるのは、Proscenium を含めて今後もAdobeが開発を続ける気があるのかどうか。Pixel Bender 3Dもツールキットさえ提供されないまま消えてしまいそうだし、同じようにフェードアウトしそうな悪寒。Stage3D API 直叩き派としては描画ライブラリを規定しないPelletのほうが扱いやすいし、名前もカワイイので今後も開発が続行されることに期待したい。
あとリファレンス欲しい。

0
Your rating: None

Starling LogoI am excited to introduce today a new project we have been working on, called "Starling". So what is it ?

Starling is a 2D framework for game development developed in collaboration with the Austrian company Gamua (already behind the Sparrow-Framework on iOS), running on top of Stage3D (Molehill). It allows developers to leverage the power of the GPU without diving into the low-level details of the Stage3D APIs (available in Flash Player 11 and Adobe AIR 3). I am convinced that most of Flash developers will love this initiative, as most developers would like to leverage the GPU while reusing concepts like an event model, a display list, movieclips, sprites, etc.

Most of you, who had a look at the Stage3D APIs understand that this can be complex sometimes. So instead of writing 60 lines of code to draw a textured quad.

You will write the following :

// create a Texture object out of an embedded bitmap
var texture:Texture = Texture.fromBitmap ( new embeddedBitmap() );

// create an Image object our of the Texture
var image:Image = new Image(texture);

// set the properties
image.pivotX = 50;
image.pivotY = 50;
image.x = 300;
image.y = 150;
image.rotation = Math.PI/4;

// display it
addChild(image);

Quite nice hu ?

Of course, as a little obligatory test, find below a bunch of things (yes, sausages!) moving around :

Sausages

Click for demo.

Here is below another demo using Starling plugged with Box2D (for physics) :

Starling and Box2D

Click for demo.

Then, you have complete rendering of the your physics scene on the GPU.

Then of course particles! :

Starling Particles

Click for demo (press right key for starting the particles and change).

Below a more concret example including MovieClip (through spritesheet) :

Sausage Kong

Click for demo.

If you want to learn more about Starling, check the little book (Introducing Starling - 107 pages) I wrote about it, you can download it from the link below, it covers many concepts to get started with Starling :

Starling Book

click to download (Introducing Starling - rev 1.0).

Check the official Starling website to download it and share your content with the Starling community.

I hope you will like it!

0
Your rating: None