LV3 Posted October 5, 2017 Share Posted October 5, 2017 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? Quote Link to comment Share on other sites More sharing options...
JohnK Posted October 5, 2017 Share Posted October 5, 2017 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. Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 5, 2017 Share Posted October 5, 2017 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. Arte 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.