Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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 /
avatar image
0
Question by alexisbarrette · Nov 11, 2020 at 06:29 PM · renderingbuildingrtsgrid based gameprojectors

Displaying the tiles of an immense grid over a terrain

Hello fellow game devs.

My friend and I are working on a city builder/empire building game. We have succesfully implemented a grid system that functions entirely through code (the tiles aren't represented by gameobjects) and allows us to snap objects to the position of the tile which is closest to the mouse cursor.

So far so good, however:

We kind of hit a wall when the question of displaying the grid came. Something to note is that we're going to need in the tens of thousands of tiles. Now, we don't want to be able to display the entire grid all at once, so that helps, but we will probably need to display at least a few thousands of those tiles at once when the player goes into "zoning mode", where he can paint zones on the grid that will be tagged as "agricultural" or "residential" etc. This means we need to change the color of individual tiles, since any one tile could be made part of a zone. Something quite similar has been done in Cities : Skylines, which also happens to have been made with Unity.

What we came up with so far

1. At first, we thought of using projectors. We thought a single projector could display a portion of the grid over the terrain (using a rather large grid texture, displaying about 15 square tiles of the grid) where the mouse cursor is, and then individual projectors would be instantiated (and quite possibly pooled) over the tiles that are part of zones, even if they're far from where the cursor is. This of course means an awful lot of projectors if the player creates really large zones, so this method might not be the best. It also means we're going to be overdrawing a lot, by stacking projectors on top of each other.

2. So my friend came up with the idea of having each tile on the map be displayed by a single gameobject. Each and every one of those gameobjects would have a mesh component that would render a plane with a few dozen vertices, so that we can line those up with the height of the terrain and thus not have it clip through the tiles. We could then display any tile that we need and make it whatever color it needs to be, depending on whether it is part of a zone or not. Rendering a mesh is also probably faster than rendering a projector, so there's that. The problem with this is that it's probably not gonna look very good since the tiles are going to be slightly above the ground, so we'll have a sort of paralax effect going on, and I don't know how optimized tens of thousands (probably even well over 100k) of gameobjects will be, even if all they have is a mesh renderer component attached to them. Another problem with this method is that it will require a raycast for every single vertex of every single tile to allow them all to line up with the terrain somewhat properly. This would only be done once, when the game is initialized, but it would certainly add quite a bit of time to the loading screens.

Quick note : I also came up with a workaround that would allow us to simply not display large numbers of tiles (by sort of getting rid of the zones system), and my friend admitted that the idea had potential, but still prefered (and I agree with him) not to give up on that system just yet.

The question

So finally, our question(s) is/are : Does one of these two methods of displaying tiles seem better? What would be some alternatives? How is this typically done in professional titles?

Thank you very much for your time, and we hope to get some good ideas out of this.

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

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

Place a building in a RTS game (like Age Of empires 3) 0 Answers

Grid system visualization 1 Answer

RTS building placement collision problem C# 1 Answer

RTS Building Structures - How to have building follow my cursor until I click and place it on the grounds? 2 Answers

Some questions about RTS games 1 Answer


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