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
0
Question by Talantyyr · Aug 08, 2014 at 07:30 AM · proceduraltileinstantiating

Random tilebased Dungeons - Best practice?

I'm working on a dungeon crawler game (like eye of the beholder) with tile based levels / movement, where i want to create random dungeons.

Currently i have created 2 prefabs (floor / wall tile) and i tried to create a 15 x 15 area out of these tiles via

 GameObject.Instantiate( Resources.Load("prefabname"), ......) 

to load the prefabs, which is really slow...

What's the best approach here? Create clones of existing tiles via Instantiate instead of loading them via Resources.Load ?

I doubt this would be fast enough to create bigger levels, especially on mobile devices...

I've also seen someone (youtube tutorial) creating meshes via script and texturing them, which seems to be really fast. Is this the best way to do this?

I don't want to use an existing dungeon generator or something, much more fun figuring out everything myself. Just need a little push in the right direction :)

How do other people create tile based levels (via script)?

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 Kiwasi · Aug 08, 2014 at 07:42 AM 0
Share

Use Resources.Load once to get a reference. Instantiate from the reference.

If you are producing a lot of levels consider using an object pool ins$$anonymous$$d of instantiate.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by FullHeartGames · Jul 29, 2015 at 11:45 AM

I am too working on a Random tile-based dungeon game and just released a demo on the Asset store if you're interested!

If you are interested in purchasing this I could also supply some tile based movement script! Good luck!

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
0

Answer by wpdev · Jul 29, 2015 at 08:51 AM

I did it the following way: 1. cut all map on squares, each square is a prefab, which store all containing gameobjects data 2. each visible square dynamically loaded using Resources.Load 3. when prefab is loaded, it immediately getting from pool all its gameobject and setting its data.

So basically saying square prefab contains only gameobjects data like position inside square\scale\rotation but not gameobject itself. That's why each square is very lightweight and could be loaded very fast during runtime. When square become invisible it gets unloaded and all containing gameobjects return to pool. Consider splitting loading\unloading each square for different frames, for example you need to load 5 new squares and unload 5, then next 5 frames unloading one squre per frame and after loading new squares the same way.

Comment
Add comment · Show 2 · 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 FullHeartGames · Feb 20, 2016 at 07:42 PM 0
Share

Sounds cool do you have a demo to show off?!

avatar image Cherno FullHeartGames · Feb 20, 2016 at 08:40 PM 0
Share

The answer is more than half a year old.

Anyway, I'm surprised nobody here mentioned yet that using seperate GameObjects for each tile (let along for each floor, wall and ceiling) is very bad practice. What you do ins$$anonymous$$d is Generate the mesh for all tiles as one by code, or split it into chunks if the vertex count gets too high. Even a smallish 25x25 dungeon will produce 625 GameObjects, and this will proably already lead to performance problems.

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

25 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

Related Questions

Lightmapping and Diablo3-style big-tile levels 0 Answers

Tile game instatiation 1 Answer

How to seamlessly tile terrains 0 Answers

Procedurally Connected Mesh/3d Model Tiles? 1 Answer

My precedural Algorithm for Tidy TileMapper is not working! 3 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