Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
1
Question by Nephophobic · Mar 09, 2018 at 10:49 AM · fog of war

Fog of war implementation in multiplayer and its difficulties

Hi,

I'm working on a RTS prototype and am trying to implement an optimized and clean Fog of War. The main issue I'm having is regarding the multiplayer implementation, i.e. proximity-checking for units, and runtime instantiation of units when they "appear" on a client's screen.

The basic concept

  • The camera hovers at a distance from the ground, and can move freely on the (x, z) plane (basic case: y/height is ignored for now).

  • Between the camera and the ground floats an opaque, black-texture plane. Its position is tied to the camera's, and the plane's texture is updated in real time with a shader.

  • The units lie on the ground, below the plane. They are either visible, or not (boolean state), and aren't affected by the opaque plane.


    The issues

    Multiplayer implementation

Since the game is supposed to go multiplayer at some point, there is a security issue to handle : the client doesn't know where the enemies units are, until they enter one of their units' view radius.

My guess is that the server sees every unit in the game, all the units have circle colliders, and whenever there is a OnCollision/TriggerEnter, it does the relevant checks (height comparison, mainly), and if the unit can see the other unit, the FoW manager of the client is notified.

I have two issues with this:

  • First, regarding the "circle collider" method: how optimized is it? What is the most efficient way of getting a notification when two entities get close to each other? The game could have around 600 units at the same time, so this part is important.

  • For security reasons, the client has no idea where the enemy units are, until the server tells him. Client-side, what actually happens to the enemy units when they don't see them? They don't exist? What happens when the server tells the client "Hey, there is a unit there!"? Is the unit instantiated at runtime, with its current animation/position/health/etc?

    Height implementation

Looking at modern RTS, you can usually zoom the camera in very close to the units. The camera ends up being around the same height as the units... Which means that there is no such "opaque plane".

Do these games use some sort of volumetric fog? How do they implement their FoW?

Thanks in advance for any help.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by nico_st_29 · Apr 28, 2020 at 01:40 PM

Did you ever get an answer to this? I'd be interested too.

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

129 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 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

Noise left on texture when cleared (fog of war, Shader) 0 Answers

RenderTexture map collisions and interactions. 0 Answers

[Shadernoob Q#1] How to create a transparent 2d fog of war material! 0 Answers

Shader Masking Question 0 Answers

Varying simultaneous Fog of War views for Local Multiplayer 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