Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by user-305 (yahoo) · Nov 23, 2009 at 02:33 AM · scenescene-loadingcommunity

How to have multiple scenes concurrently runnning

Newbie here. I don't get it. In the online strategy game we're trying to make, the player plays on a certain map against AI opponents or other players. The server is an authoritative server. So the player data, AI objects, the map itself also exist on the server.

The thing is, its an online game, so more than one player plays the game. This means the server needs to administer multiple play sessions concurrently, processing collisions on multiple autonomous maps, making sure collisions on one player's playing session does not affect collisions on another player's playing session.

Is it even possible at all for Unity to administer multiple scenes?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by jashan · Nov 23, 2009 at 12:02 PM

You can handle multiple scenes. What you're probably looking for is Application.LoadLevelAdditive, which loads a scene without destroying the objects that are currently loaded already. With this, you can load multiple maps simultanuously.

Of course, for a complete solution, things get a little more involved: What I'm doing in Traces of Illumination is laying out the different levels "spatially" so that when I load all of them at once on the server, they don't intersect. That way, multiple game groups (groups of up to 20 players playing one level) can play simultanuously in different levels. To make it possible for different groups of players play in the same level without interfering with each other, I disable collisions between any objects that belong to different groups.

It is kind of complex (you also need to make sure that network messages only get sent to those players for which they are really relevant) but quite doable in Unity.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image M0no · Jul 23, 2016 at 05:28 AM 0
Share

What's the new alternative for "Application.LoadLevelAdditive"?

Edit: it's Scene$$anonymous$$anager.LoadScene("SceneName",LoadScene$$anonymous$$ode.Additive);

avatar image
2

Answer by Jaap Kreijkamp · Nov 24, 2009 at 07:29 AM

Although you can try to get things working with merging all active matches in one scene the best way to go is to startup a headless instance for every match going on. You can start instances of your app in batchmode (headless) using the -batchmode flag.

Search for batchmode in forums give more details how to use it and its limitations (you'll need UnityPro for example).

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by user-305 (yahoo) · Nov 25, 2009 at 01:40 AM

I've thought about spawning several instances of the server. That's one way to do it. It would scale well too since it can take advantage of multi-core hardware easily without needing multi-threading.

I managed to create some code that spawns a new instance of the program and pass arguments to it. This only works on standalone builds as webplayers can't receive command line arguments.

var args : String[];

function OnGUI() { for (var arg : String in args) { GUILayout.Label(arg); }

if (GUILayout.Button("Spawn New Instance")) { var proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; // args[0] is the filename of the current program proc.StartInfo.FileName = args[0]; proc.StartInfo.Arguments = "25006 argument2 argument3"; proc.Start(); //proc.WaitForExit(); } }

function Start() { args = System.Environment.GetCommandLineArgs(); }

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

How to determine whether a Scene with 'name' exists (with the new SceneManager)? 5 Answers

Why does loading the scene not work? 2 Answers

Help with loading scenes. 2 Answers

How to disable Dont destroy on load 0 Answers

Get the currently open scene name or file name 8 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges