Page 1 of 1

Creating objects bulets,towers,boxes in the game "word""

Posted: 04 May 2012, 17:24
by Morph899
He Everyone,

I am new in this forum, i am trying some cool features with smartoxserver and alternativaplatform. I just came up with an idea to create objects in the 3d enviroment that everyone can see example a Sprite3d bullet or putting a turret to the sceen etetc. How can i achieve that thing? How will in sfs the object syncronised? Can anyone show me some examples about that? Thank you very much!

Good Day!

Re: Creating objects bulets,towers,boxes in the game "word""

Posted: 04 May 2012, 17:26
by rjgtav
Hi.
I suggest you to check the Unity Examples, to better understand how to integrate SFS2X with the 3d environment:
http://docs2x.smartfoxserver.com/Exampl ... troduction

Re: Creating objects bulets,towers,boxes in the game "word""

Posted: 04 May 2012, 17:32
by Morph899
Thans for answer. Am i have a 3d enviroment where players moving jumping on the x,y,z my problem is creating objects example droping my weapon to the ground that everyone can se or pick up.

Edit: I asume that a droped item is not an NPC than what is it? How can i create a player created object?:) Thank you for help!

Re: Creating objects bulets,towers,boxes in the game "word""

Posted: 04 May 2012, 18:03
by rjgtav
Well, maybe you could use an SFSObject as a RoomVariable which would store all the objects that had been dropped, but this variable would only be used by the users that were joining the room. For the other users that are already in the room, you simply use a ObjectMessageRequest to send the object information (id, position, etc.).
Of course the best option would be to control all the game from the server, and so you would store the dropped objects in a list in an Extension.

Re: Creating objects bulets,towers,boxes in the game "word""

Posted: 18 May 2012, 10:10
by Morph899
Hm. I'm trying to shoot a bullet with sfs.objectmessage but i havent found any example about it:

Code: Select all

protected function onRightClickNow(event:MouseEvent):void
		{

sfs.addEventListener(SFSEvent.OBJECT_MESSAGE, onObjectMessage);

	
			bullet=new Bullet()
			bullet.x = myplayer.x
			bullet.y = myplayer.y
			bullet.z = myplayer.z+50
			
			bulletDirection.x = 100*Math.cos(camera.rotationX + (Math.PI/2)) * Math.sin(-camera.rotationZ);  
			bulletDirection.y = 100*Math.cos(-camera.rotationZ) * Math.cos(camera.rotationX + (Math.PI/2));  
			bulletDirection.z = 100*Math.sin(camera.rotationX + (Math.PI/2)); 
				
			scene.addChild(bullet)
			bullet.registerCollisionObject(scene);
			
			
		[b]	var dataObj:ISFSObject = new SFSObject();
			dataObj.putInt(bullet.x, myplayer.x);
			dataObj.putInt(bullet.y, myplayer.y);
			
			sfs.send(new ObjectMessageRequest(dataObj));[/b]

}

	private function onObjectMessage(evt:SFSEvent):void
		{
	//Dont know how to describe this event

		}

How will other see my object created and moving?

Re: Creating objects bulets,towers,boxes in the game "word""

Posted: 18 May 2012, 11:07
by Morph899
Pf. Made it in 10 minutes...:D
Thanks anyway:)