- Home /
NPCs and players across a network in the same scene.
I am using badumna to make a multiplayer learning project. However, even if you know nothing about badumna please keep reading, becasue my issue is undoubtably a conseptual one.
Here is why I am confused.
1 A player cannot have npcs running from their computer, so the server that powers te npcs must be a different project.
2 I cannot figure out from the tutorial hoe to connect different projects todether, but they obviously do. 3 If they are in seperate projects, then how does one update the terrains in both projects at the same time? Is there any way to "link" them?
OR
Have I missed something?
Edit: To Clarify: I think that the movements of the npcs are governed by a seperate server. If that is the case, then how would I have npcs and players in the same scene, without spawning npcs whenever a player opens the scene?
Answer by Julian-Glenn · Aug 13, 2010 at 07:35 PM
It is all part of one project. Of course you can have many different "zones" which can equate to scenes in Unity, as well as multiple "shards", but it is still all one project.
NPC's are added to your scene just like in any other non-networked scene. The "multi-player" code layer simply keeps things synchronized so that if players are within a certain distance from each other what they see the same things.
Baduma is interesting because of its use of P2P technology``, but in all honesty it isn't ready for "prime-time" yet. I would suggest "photon" or SFS pro which are very well documented, but which ever middleware you choose I would first read as much as you can about multi-player networking theory and technology.
Correct me if I'm wrong, but I think that the movements of the npcs are governed by a server. If that is the case, then how yould I have npcs and players in the same scene, wihtout spawning npcs, when a player opens the scene?
The middleware handles all that for you. baduma won't "awaken" npcs until there are "players" within in interest range. And whilke it is true that the "logic" is on the server for the npcs, again the middleware you choose handles the segmentation and reconciliation of the server/client logic. You don't need to create separate projects in Unity
Thanks so much for all the help you have givewn me. However, in the tutorial from badumna they do not show precisely how to do this. Any Ideas?
Badumma is still rather "beta". There is a thread here by the author who is quite helpful with answers:
I posted there too. Also, at the risk of sounding like an ignoramus, what is a shard?
Answer by Peshwa Prince · Aug 16, 2010 at 01:28 AM
You don't need to have different projects to support NPC. You can have one project and two different scenes. This will make it easier to maintain consistent terrain information across the scenes. Shard is a physically separate instance of your scene. If you wanted to separate users based on the country (or any other parameter) you can have them connect to different shards. Each shard has the exact same information in terms of the terrain, assets, etc but different players. Hope that helps, Peshwa Prince
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Learning Project: How is Badumna for a server? 1 Answer
When using the NetworkServer.Spawn() netID is not added to the NetworkServer.objects 0 Answers
Is there a way to notify to the app once client has connected to server? 2 Answers
How can I send a mouse click to a server using an RPC? 0 Answers