Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by FernandoGBR · Sep 20, 2017 at 05:55 PM · multiplayerprocedural-generation

Starting multiplayer architecture.

I am working on a new 3d game based on a 2D tiled map. After developing the most basic features (procedural map generation, and player movement) i want to make it work in multiplayer.

I have read the whole HLAPI documentation and I have done twice the HLAPI tutorial [link al tutorial] , but my current architecture seems pretty different to the architecture shown in the mentioned tutorial.

This is how the game works without multiplayer:

Pregame Scene objects:

  • An empty object with an script called "GlobalController", this will be alive through all scenes taking care of scene management and as global data storage.

  • Another empty with an script called "PregameUIController", this will take care about the user interaction with the pregame scene.

  • A Canvas an other irrelevant objects.

Pregame scene main flow:

  • The global controller load from files the game definitions (types of tiles, types of biomes, types of entities)

  • The player select the size and seed of the planet and click play

  • The global controller creates a new planet(c# class, not monobehaviour, only for data storage) prepared for creation

  • The global controller changes the scene to planet creation scene

Planet creation Scene objects:

  • Planet creation controller, taking care of planet creation and displaying the user the current state of the planet creation.

Planet creation main flow:

  • Planet creation controller (PCC from now) get the reference to the planet from the global controller

  • PCC creates the planet terrain and entities while telling the state of the process to the player

  • PCC sets the starting position of the planet based on a complex algorithm

  • PCC tells Global controller to start playing the planet

  • Global controller creates a new Player (c# class, not monobehaviour, only for data storage) as activePlayer, which will contain the starting position of the player

  • The global controller changes the scene to playing scene

  • A Canvas an other irrelevant objects.

Playing scene objects:

  • Render controller, taking care of what is showed on the player screen

  • InputController, taking care of the player inputs

  • PlayerController, taking care of the player prefab and his different behaviours

  • A Canvas an other irrelevant objects.

Playing scene main flow:

  • Render controller and player controller gets the planet and players references from global controller

  • Render controller render the nearest chunks to the player

  • Player controller instantiate the player prefab

  • Input controller manages the input to ask playerController move the player + Moving the player consists in: + player controller verify the destination is a valid destination + playercontroller asks playerObject (monobehaviour attached to the playerPrefab) to move + when movement ends, playerObject modify the player position

This is what i try to achieve

Pregame scene:

  • The user decide if play as host or client + If client go to planet creation scene + If host set seed, size and other parameters and then go to planet creation

Planet creation scene:

  • If host, procede normally (lets create the planet while notifying the player, then create the player, finally go to main scene)

  • If client: + Get the planet data from server + Global controller creates a new Player as activePlayer, which will contain the starting position of the player. (Same as before)

Playing scene:

  • Both players can move and see the other movements in the same map (which currently is not being modified)

  • Player controller can verify if a player can move to the next tile (local verification)

  • When PlayerPrefab starts moving, the server is notified, if it is an illegal movement server notifies back and movemet is aborted.

The problems:

  • Making the planet only to be generated (complex perlin algorithm) on the server.

  • Sharing the planet info (custom class that contains more custom classes) with the client when he connects?

  • Making the controllers (Global controller, Network controller, ...) extend from NetworkBehaviour and assign them a NetworkIdentity then, as said in the documentation, them will be deactivated till the scene is loaded preventing to sync the data of the controllers from server to client.

  • Avoiding the playerPrefab to spawn while I still have not the need info to spawn it (even I am not in the playing scene).

THE QUESTIONS:

  • Do I need to refactor the whole game to change how things communicate with each others? If you think I can stick to this architecture, can you give me some guidelines to make this work.

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

0 Replies

· Add your reply
  • Sort: 

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

114 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Spawn network objects in procedural map 0 Answers

Transferring procedural map to clients 1 Answer

Unity networking tutorial? 6 Answers

What is the maximum feasible number of players in a procedural-generated, top-down 2D MMO? 1 Answer

How to Modify Multiplayer Script for iPhone 0 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