Spawning a networked object for all clients

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

Post Reply
JuliusBtesh
Posts: 58
Joined: 30 Sep 2014, 17:08

Spawning a networked object for all clients

Post by JuliusBtesh »

So I've started to get the hang of SFS and have a basic setup for spawning remote players along with local players. I was wondering what would be a good way to spawn an object for all users in the current game room to see. This would be like an enemy object with no relation to any of the users.

Thanks!
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Spawning a networked object for all clients

Post by Lapo »

Can you give me a bit more context?
Are you using MMORooms? http://docs2x.smartfoxserver.com/Advanc ... /mmo-rooms

If not, how does your game work?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
JuliusBtesh
Posts: 58
Joined: 30 Sep 2014, 17:08

Re: Spawning a networked object for all clients

Post by JuliusBtesh »

Right now I am not using the MMORoom. I'm just using the SFSGame but will probably try switching to MMORoom. The reason why I didn't start with MMORoom was because I was having issues with the MMORoom Tutorial with the players not showing up properly. I basically just want to be able to spawn one 'Enemy' NPC for all clients to see and have that NPC synced between all clients with the same movement. (Also to have knowledge of all users in room)
JuliusBtesh
Posts: 58
Joined: 30 Sep 2014, 17:08

Re: Spawning a networked object for all clients

Post by JuliusBtesh »

Ok, So I just went ahead and switched over to the MMORoomSettings and I noticed that I no longer can find the room.UserCount information. Why is that?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Spawning a networked object for all clients

Post by Bax »

The reason is that in an MMORoom each client is only "aware" of the users surrounding him (in other words the users that are in his Area of Interest).
So knowing the total number of users in the Room is useless.
Also, as MMORooms are targeted at very large number of users, keeping the counter updated would be a huge waste of bandwidth.
Paolo Bax
The SmartFoxServer Team
Post Reply