Posts Tagged ‘Multiplayer’

Unload vs UnloadAndstop

May 7th, 2010 by aabhaanjan

I had a SWfLoadersClass for a large application which loads a bunch of external swfs, and when requested distributes copies of those swfs to the part of application. The application was developed in

Flash CS3. When I was using Loader.unload() method of Flash Player 9 I found it was very difficult to remove a loaded SWF from memory after it is unloaded . Most fired Events were still running and within

15 minutes my application hanged.

How I knew the Events were still running after unload ?

package {

import flash.display.*;

import flash.net.URLRequest;

public class loadSWF  extends MovieClip {

private  var ldr:Loader = new Loader();

private function loadSWF(){

     var url:String = "http://www.unknown.example.com/content.swf";
     var urlReq:URLRequest = new URLRequest(url);
     ldr.load(urlReq);

this.addEventListener(Event.ENTER_FRAME,traceEnterFrameLisnerIsWorking);

btnUnload.addEventListener(MouseEvent.CLICK, unloadButtonClicked);

}

private function traceEnterFrameLisnerIsWorking (e:Event):void {

trace(“ENTER_FRAME is running.”);

}

private function unloadButtonClicked(e:MouseEvent):void {

ldr.unload()

}

}

}

I found ‘trace’ calls that the listeners were still  active even after the loader.unload() was called.

After some Googling J I found The Loader.unload() method doesn’t do much. In that case Garbage

Collector is not working properly.

I found some other facts too :

A SWF file that has a music track is loaded into an application. Later, the SWF is unloaded using Loader.unload(). Though the SWF will be removed from the screen, the music will still be heard.

Solution :

In Flash Player 10, there is a new method, Loader.unloadAndStop(). The latter method stops execution of the left-over listeners and prompts the garbage collector to remove the external swf file from memory.

Loader.unloadAndStop() method is supposed to trigger garbage collector to remove an unloaded swf file from memory.

The unloadAndStop() method tries to solve this by stopping all actions running in a loaded element and clearing the element out of RAM. The unloadAndStop() methos belongs to the Loader class. The idea is to call this method on your Loader instance to clean what you have loaded.

What unlaodAndStop() does ? :

  • Stops all MovieClips
  • Stops all sounds playing/streaming
  • Stop/removes all Timer objects
  • Removes all global listeners for enterFrame, exitFrame, frameconstructed, activate, deactivate
  • Removes all stage listeners that have been created by the child.
  • Closes all NetConnection/NetStream and Video.attachNetStream/attachCamera(0) and Microphone.setLoopback(0)
  • Removes AS3 fonts from the global font table
  • Stops sockets, xmlsockets, filereference downloads, other downloading objects (grandchildren SWF), etc.
  • Frees bitmap related to cacheAsBitmap/filter, etc.

After converting my files into Flash CS4 and calling unlaodAndStop() my application worked fine 🙂 .

Thank you various sources..

Keep reading coming soon with some thing amazing about the CPU Memory usage in a multiplayer virtual world 🙂

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

SmartFox server Chapter- 01-Inroduction and Installation

March 21st, 2010 by aabhaanjan

Starting with SmartFox Server after its Installation :

Go to Program files then SmartFoxServerPro_1.6.6 you will see list of items of Smartfox

Admin : From where you can handle all the events and can see the server status.

Docs: Where you can find the documents of Smartfox , you can find here all the detail and

Helpful  material.

Server :  From where you can edit and Install/Uninstall Services.

ServerDetail

Examples : A lot of examples are stored here . J

Flash API : API of AS2.0  and AS 3.0 are stored here.

How to change the IP

Open Edit Config as per given figure :

Server Config

After opening config you can change the IP as example given below.

change IP

Changing the admin login and password .

change password

Opening Admin panel: When you will open the admin  panel you will be able to see login credential fields , where by entering correct Username and password you will be able to enter into the admin panel.

AdminPanel

OpenedAdminPanel

Inside the admin panel you will be able to see below mentioned figure. It have various components .

InsideTheadminPanel

Zone browser :

It will show all the created  zones and associated rooms detail.

ZoneLevelDetail

Ban Manager : From where you can see the Banned User and IP details.

bannedUserDetail

Logs : Here you will find all the  written record of messages sent or received and activity done by the

User.

logDetail

Extension manager :

Here you can see and edit all used extensions .

ExtensionDetail

Keep watching coming soon , with next chapter 🙂

Next Chapter

Tags: , , , , , , , , , , , , , ,

Unity 3D Game

March 4th, 2010 by

During my experiment for a 3D game  I found Unity3D. Let me share some facts about the Unity3D.

It’s not only how fast the 3D rendering is. Unity3D has a very intuitive interface organized around a simple and clear concept.

Unity is a multiplatform game development tool, designed from the start to ease creation. A fully integrated professional application.

Something more about Unity 3D I got from Its website and other sources :

  1. 1. Scripting language:

Unity supports three scripting languages: JavaScript, C#, and a dialect of Python called Boo. All three are equally fast and interoperate. All three can use the underlying .NET libraries which support databases, regular expressions, XML, file access and networking.

  1. 2. NET based

Game logic runs on the Open Source .NET platform, Mono.

  1. 3. Java Script

Unity’s JavaScript implementation JIT-compiles to native machine code. It runs 20x faster than      Flash or Director based JavaScript, and the same speed as C# and Boo.

4. SCOPE for Multiplayer games

Create real-time networked multiplayer functionality. Unity supports all networking needs out of the box with little learning and even less effort.

  1. 1. Web Browser Integration

When running in a web browser, the deployed Web Player can communicate seamlessly with the container web page. That way you get javascript communication and full AJAX capabilities.

  1. 2. Backend Connectivity

.NET socket libraries can be used for real-time networking, by opening TCP/IP sockets or sending UDP messages. They also make speaking XML easy, and can connect to ODBC database connections.

  1. 3. Advanced Physics

  1. 4. Fully Integrated Editor

This integration allows the Editor to do everything a published game can do. The simple, visual, and intuitive nature of the Editor makes building games fun again.

  1. 5. Graphical Fidelity

Unity has a highly optimized graphics pipeline for both DirectX and OpenGL. Animated meshes, particle systems, advanced lighting and shadows, all will run blazing fast.

  1. 6. Supported File format

All major tools and file formats are supported, any art application can be used with Unity.

  1. 7. Web Deployment

Unity-made games can be played inside a web browser thanks to the Unity Web Player Plug-in. The plug-in download is small (about 3 MB), auto-installs without a browser restart, and already has a 8-digit distribution. It works on all modern browsers including Internet Explorer, Firefox, Safari, and most Mozilla-based browsers

  1. 8. iPhone publishing

9. Shadow & Light

Unity’s provides a highly optimized lighting system with realtime shadows and baked lightmaps. Use    shadow and light to great effect, without worrying about the gritty technical details.

10. Supported File format

All major tools and file formats are supported, any art application can be used with Unity.

11. Web Deployment

Unity-made games can be played inside a web browser thanks to the Unity Web Player Plug-in. The plug-in download is small (about 3 MB), auto-installs without a browser restart, and already has a 8-digit distribution. It works on all modern browsers including Internet Explorer, Firefox, Safari, and most Mozilla-based browsers


Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,