Forum ActionScript 3.0 Away3D or Papervision yet?

Problems and discussions relating to ActionScript 3.0 here.

Away3D or Papervision yet?

Postby loucsam » March 11th, 2010, 6:00 am

Anyone using a 3D engine such as Away3d or Papervision in multiplayer yet?

I'm interested in giving it a go and just wondering if anyone has already done the hard work and cares to share experiences?

I have an idea for a game/sandbox but think it may be a little beyond me to get anything working quickly.
Struggling with away3d and with this API so combining them will be a challenge.

Posts: 23
Joined: March 1st, 2010, 8:46 am

Re: Away3D or Papervision yet?

Postby Cyclone103 » March 11th, 2010, 9:07 pm

While I don't think anyone has actually done it yet, I am certain it is possible. If you do try this, please let me know, as I am thinking of converting my game to 3D eventually
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Away3D or Papervision yet?

Postby loucsam » March 12th, 2010, 9:43 am

I'm sure this probably isn't the right way of doing things but my first success was getting the simple rotating plane example working. There's no interaction or muliplayer or anything, just displaying a plane which rotates, and connects to the server.

Anyway this is what worked, with my game-id removed from the code. Some input from more experienced coders would be appreciated.

package {
import flash.display.MovieClip
import playerio.*
import flash.display.*;

import away3d.cameras.*;
import away3d.containers.*;
import away3d.materials.*;
import away3d.primitives.*;

public class away3dplayerio extends MovieClip{
//engine variables
var scene:Scene3D;
var camera:Camera3D;
var view:View3D;

//material objects
var material:ColorMaterial;

//scene objects
var plane:Plane;

function away3dplayerio(){
stage, //Referance to stage
"your game-id here", //Game id (Get your own at
"public", //Connection id, default is public
"GuestUser", //Username
"", //User auth. Can be left blank if authentication is disabled on connection
handleConnect, //Function executed on successful connect
handleError //Function executed if we recive an error

private function handleConnect(client:Client):void{
trace("Sucessfully connected to");

//Set developmentsever (Comment out to connect to your server online)
client.multiplayer.developmentServer = "localhost:8184";

//Create pr join the room test
"test", //Room id. If set to null a random roomid is used
"bounce", //The game type started on the server
false, //Should the room be hidden from the lobby?
{}, //Room data. This data is returned to lobby list. Variabels can be modifed on the server
{}, //User join data
handleJoin, //Function executed on successful joining of the room
handleError //Function executed if we got a join error

private function handleJoin(connection:Connection):void{
trace("Sucessfully connected to the multiplayer server");

//Add disconnect listener

//Add listener for messages of the type "hello"
connection.addMessageHandler("hello", function(m:Message){
trace("Recived a message with the type hello from the server");

//Add message listener for users joining the room
connection.addMessageHandler("UserJoined", function(m:Message, userid:uint){
trace("Player with the userid", userid, "just joined the room");

//Add message listener for users leaving the room
connection.addMessageHandler("UserLeft", function(m:Message, userid:uint){
trace("Player with the userid", userid, "just left the room");

//Listen to all messages using a private function
connection.addMessageHandler("*", handleMessages)

//away3d here?


private function handleMessages(m:Message){
trace("Recived the message", m)

private function handleDisconnect():void{
trace("Disconnected from server")

private function handleError(error:PlayerIOError):void{

* Global initialise function
function init():void

* Initialise the engine
function initEngine():void
scene = new Scene3D();
camera = new Camera3D({zoom:10, focus:100, x:0, y:0, z:-1000});

view = new View3D({scene:scene, camera:camera});
view.x = 400;
view.y = 300;
addChild( view );

//add signature
//Signature = Sprite(new SignatureSwf());
//SignatureBitmap = new Bitmap(new BitmapData(Signature.width, Signature.height, true, 0));
//stage.quality = StageQuality.HIGH;
//stage.quality = StageQuality.LOW;

* Initialise the materials
function initMaterials():void
material = new ColorMaterial( 0xcc0000 );

* Initialise the scene objects
function initObjects():void
plane = new Plane({material:material, width:500, height:500, yUp:false});
plane.bothsides = true;
scene.addChild( plane );

* Initialise the listeners
function initListeners():void
addEventListener( Event.ENTER_FRAME, onEnterFrame );

* Render loop
function onEnterFrame( e:Event ):void
plane.rotationY += 2;

* stage listener for resize events
function onResize(event:Event):void
view.x = stage.stageWidth / 2;
view.y = stage.stageHeight / 2;
//SignatureBitmap.y = stage.stageHeight - Signature.height;

I did the init of the 3d code at the end of the handleJoin, is that the best place?

away3d code in red
Posts: 23
Joined: March 1st, 2010, 8:46 am

Re: Away3D or Papervision yet?

Postby tripknotix » March 12th, 2010, 11:07 am

My first Game was a Papervision3D Multiplayer first person shooter ( 3D Future Ops: Mech Deathmatch ... deathmatch ), it used the Nonoba Multiplayer API, the predecessor to the Player.IO api, when i developed a sequel on the nonoba api in a alternativa3D engine, it was 70% of the same code when i went to so the games work perfectly, for an example, i have ported over the 2nd, 3rd, and 4th sequels of my game over to the game code, you can view it here (3D Future Ops 4: First Strike ... rst-strike ).

In Simple, these 3d engines work great in multiplayer APIs

- -
Paid Member
Posts: 23
Joined: March 12th, 2010, 11:00 am

Return to ActionScript 3.0