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 Aezora · Jun 29, 2017 at 08:24 PM · graphicsspawning problems

How to reduce lag / generation time when generating large tile maps

I am creating a game which is similar to a dungeon crawler. To do that, I started by creating a map generator. The map generator I have currently uses co-routines so I can have a loading bar, and to generate tiles it uses the Instantiate command. My problem is that at my larger map sizes (Medium - 150 x 150 tiles per floor, 5 floors, and Large, 210 X 210 tiles per floor, 7 floors) the rendering of the tiles causes drastic lag (which originally made it appear like it was frozen, now with the loading bar it does not).

For the small map it only takes about 10 seconds of generation, about 5 minutes for the medium and over an hour for the large. (Note, the large map generation is timed out by unity).

I've looked up ways to reduce the amount of time and all I've come up with are meshes. However I really don't understand meshes and so couldn't implement them even if I wanted to (at the moment anyway, I'm a fairly new programmer). As well, I am not sure I even want to use meshes since I would then have to spawn in a bunch of tiles every turn for each player, which the player would then select his/her choice and then I would remove the tiles only to repeat it a second later.

Basically I am looking for the best method to (significantly) reduce the generation time of my maps. If this is meshes, then obviously I'm going to have to learn more about meshes, but I am hopeful there is another, easier way, to do this. (Oh, and the actual time it takes to generate everything but the actual instantiation of the tiles is fairly reasonable, a couple seconds for the large. Most of the time is spent instantiating).

Thanks!

Comment
Add comment · Show 1
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 toddisarockstar · Jun 30, 2017 at 05:21 AM 0
Share

If there was a problem with your code I couldn't help without seeing your code. but my guess is your code is good! Cheers to you for your successful map generation! i dont think there is any way to get around the load time. IT IS WHAT IT IS. the CPU needs time. if you are instantiating a 210*210 amount of objects on five floor is 220500 calls of instaniate. and i'm guessing you are asking to do that in one frame:( I dont know what format you are saving in but if you cant load your big levels. keep a maximum for arrays holding info And read/instatiate sections at a time. to avoid clogging the users ram with your arrays! and you will load big levels:) you also should skip a frame between sections. unity's standard setup is single thread so it looks like an unresponsive program if you don't skip a frame here and there. as far as the time that it takes to load you just need to be creative and find a "work around". my soulution was hiding the delay behind the main menu intro. If its during play time possibly only load smaller sections at a time that are within a distance from the camera??? if you are asking for 220500 objects to be created I would hope you already have some sort of custom system/file format pry in byte arrays that only holds relevant info!

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by ShadyProductions · Jun 30, 2017 at 08:22 AM

You are probably creating over millions of gameobjects because you are not using meshes. If you use meshes it would only take 1 second to render maps like 750x750 http://studentgamedev.blogspot.be/2013/08/unity-voxel-tutorial-part-1-generating.html This is a great tutorial on voxel meshes the way you probably want your tilemap. It's not super difficult, you just need to get your base layer layed down.

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

72 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

Related Questions

Render just one object 1 Answer

Render Two texture IOS not using Blend 1 Answer

Multiple cameras, depths, and image effects! 2 Answers

find out graphic chip of Android Device 1 Answer

destroy doesn't remove the graphics 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