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
1
Question by Mikael-H · Nov 03, 2013 at 07:02 PM · proceduralbuildinguser generated content

How to build walls like in eg the Sims?

I need to let the user to be able to build walls similar to the system in the Sims. I also want the user to be able to place doors and windows AND be able to modify his/her creations .

Just building walls isn't that big of a deal as I could just create a mesh for every wall built but what if the user wants to place a window in the wall? And what if the user wants to delete a segment of an existing wall? Do I somehow edit the mesh or should there be prefabs that are inatanced for every wall segment (say 1 meter length of wall) that can then be exchanged to a prefab with a window in it?

And if I go the route with having prefabs for "wall segments" then I end up with a lot of gameobjects in the scene, possibly generating a lot of overhead. I'm afraid that if I go ahead and implement a system that fills my requirements of being editable then I might end up sith something that has way too many gameobjects in a scene and is therefore unusable...

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
2
Best Answer

Answer by Cains · Nov 04, 2013 at 07:03 AM

You're right about generating a lot of overhead if every wall segment is an individual GameObject, I tried this route at first with my game and I didn't scale up very much before the FPS shot to unbearable slowness. My experience is in 2D where the only thing I'd have to change are textures and not the actual model which is much simpler, but I can give some ideas.

One option I can think of is to treat each wall segment as an individual GameObject, and when one is created it checks if there are walls next to it. If there are, it'll delete the two GameObjects and create a new single GameObject with a mesh modified to extend the original wall segment to be two wall segments.

The other option, which I think would be a little more complex, would be to treat an entire level as a bunch of giant cubes (chunks) like a Minecraft-style procedural generation made up of cubes. An individual wall segment would be one of these smaller cubes. Each of these small cubes could hold a number of vertices and triangles which you could manipulate to create the object in that smaller cube's position.

Comment
Add comment · Show 4 · 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 Mikael-H · Nov 04, 2013 at 09:32 AM 0
Share

Thanks a lot for answering, you may have saved me a lot of time with your warning regarding overhead :) do you have an idea of the approximate number of objects you could have before experiencing a drop in fps?

also sorry I can't upvote you yet too low rep...

avatar image Cains · Nov 04, 2013 at 02:45 PM 0
Share

I can't say for sure, really because it depends on many things such as how much script is running per frame for each GameObject in its Update() function. I can tell you that if you get into hundreds of thousands of GameObjects, just their empty Update() functions will bog a high-end machine down to unplayable FPS. Thousands of GameObjects seem to work well for me, and I've never experimented with tens of thousands.

In your case to get an actual answer for your limits you'll have to do benchmarks. Just the fact that my game was 2D with flat quads and yours is 3D would probably create a big difference in performance.

And no problem, happy to help someone dodge a problem that forced me to re-code and re-think my whole game.

avatar image Mikael-H · Nov 04, 2013 at 08:16 PM 0
Share

Ahh ok then at least I have sort of a ball park figure. It just might work with less than 10k objects especially if I modify according to your first suggestion by "attaching" new geometry to existing game objects. I'll see if someone else has any other suggestions as well otherwise I'll accept your answer in a few days.

avatar image Mikael-H · Nov 09, 2013 at 01:56 PM 0
Share

I implemented a simple system for building walls in the editor for now. I figured then I can make sure a level doesn't have too many gameobjects myself. Works pretty nice and the terrain is destructible. The hard part will be to "merge" gameobjects but I'll get to that when it actually is a performance issue for me. So I'll accept your answer as it helped me out!

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

16 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

Related Questions

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

Unity Wall placement help 0 Answers

Determine whether or not model is "inside out" 2 Answers

snapping objects at runtime 2 Answers

Combining meshes (different materials) together for rotation/translation 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