Jump to content

Tips for managing complex scenes


LV3
 Share

Recommended Posts

Hello, I recently started exploring Babylon.js. After a couple days of beginner tutorials I've noticed that I end up with quite a bit of code boilerplate-ish code to construct a relatively simple scene (camera, skybox, light, a couple objects with materials, some collisions/physics/ray casting). If I continue on my current path and need a scene with lots of objects and interactions, it will become unmanageable. I'm curious how those more experienced with the framework handle complex scenes, so please share kindly your methods/suggestions.

Also, are there any good tutorials/examples for organizing and managing a complex babylon.js scene or strategies for chunking code cleanly?

Link to comment
Share on other sites

Hi and welcome to the forum. As a disorganised writer of code I am probably the last person you want answering this question.  However even I end up  sectioning scripts into separate files and putting related files into different folders. Perhaps looking at how Babylon.js is itself organised may help https://github.com/BabylonJS/Babylon.js/tree/master/src . OK these are typescript modules and you may or may not want to use typescript but the same concept can be applied to Javascript coding.

Link to comment
Share on other sites

I have a feeling this could be an interesting discussion :)

Personally, I like object-oriented coding, using Typescript. I also think that using the es6 import paradigm to orginize and build your code lets you orginize your dependencies much better. 

I like the way angular (the new one) set their directory structure and public APIs - https://github.com/angular/angular , but this is an overkill for most smaller projects. You can, however, learn from them on how to integrate testing frameworks and how to define your modules, if you have any. 

There are many ways to write code, many different paradigms. You should find the one suits you the best and make sure you stick to it.

Document your code, for your own good. Coming back to code you wrote a few months ago just to fix something is much easier if you remind yourself what you actually did.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...