altreality Posted October 4, 2014 Share Posted October 4, 2014 I am wondering how good is the physics support for designing a train simulator in Babylon 5. It would probably involve applying multiple wheel forces to stabilize a locomotive and make it follow a track. Also if I am trying to render outdoor scenes like a train running through a vast green valley with many trees and hills in the distance, how can such scenes be handled in Babylon 5 ? Are there some tricks possible to give a great visual experience without slowing the game by much ? Quote Link to comment Share on other sites More sharing options...
joshcamas Posted October 5, 2014 Share Posted October 5, 2014 I'm not sure why you'd need to compute fancy physics to do such a thing! Look at the train demo on babylonjs.com to see what I mean. Distance trees wouldn't need to be 3D - they could be sprites: http://www.babylonjs.com/playground/#2IPMDX And to have hill meshes zooming past, you wouldn't need a millions meshes - you can have it so when one zooms by, it teleports in front of you, like a chain. Other that that, I can't help you. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 18, 2014 Share Posted October 18, 2014 Yay, Microsoft Train Sim... I love it! Welcome to the forum, Altreality! Have you used the MS Train Sim route editor? In there, you can see that some "far things" are actually flat planes with 2D pictures on them. Generally, in MSTS, your 'view' is always from the location of the train (except for the old yard cam hack which let you fly a camera anywhere). Having your view always being from the train... gives you an advantage when it comes to LOD tricks. And yes, if you want to try to honor all the fun physics found in MSTS, you are in for a physics challenge. But I am with you!!! I would absolutely LOVE a version of MSTS in WebGL, and would be a big fan of your project. Track files and rolling stock files are all in ASCII text, and could all be parsed with JS, so all those files from the original MSTS would not need rewriting. And, the incremental loading and tiled landscape that MSTS does... is also available in BJS. Yes, I am quite sure it can be done, and Babylon.js would be a perfectly fine framework to do it. That would be SO COOL!!! There are some Microsoft employees nearby here, too, and I bet you/we could get some help from "the Gods"... if you/we got stuck on something. What a great project it would be. Microsoft, if they were smart, would just plain write a Babylon.js webGL version of MSTS... FOR us. I would gladly donate substantial $$$ to the cause... because MSTS rocks! Sigh. So cool. I'll give the product development people at Microsoft... a phone call... and have them re-open MS Game Studios and have them get started on this. I can't wait! But "Babylon 5" was a TV show, not a webGL framework. Quote Link to comment Share on other sites More sharing options...
QuintusHegie Posted August 11, 2018 Share Posted August 11, 2018 (edited) On 10/4/2014 at 6:00 PM, altreality said: I am wondering how good is the physics support for designing a train simulator in Babylon 5. It would probably involve applying multiple wheel forces to stabilize a locomotive and make it follow a track. Also if I am trying to render outdoor scenes like a train running through a vast green valley with many trees and hills in the distance, how can such scenes be handled in Babylon 5 ? Are there some tricks possible to give a great visual experience without slowing the game by much ? Although an old post still good questions. Physics Physics calculations for train simulators can become quite advanced quickly, as many bodies will be connected to each other (the locomotive and each wagon) and the bogeys must be constrained to the rail path. Also the physics working on a train can become destructive very fast. That's why I found a very expensive study book (300 euro) on railroad engineering that almost takes a master's degree to understand how to place real world track that WOULDN'T derail the train in the first place. ? And that's why most train simulators 'cheat' and create their own simplified physics and train operation / track following code. And most train games are simply tile-based or only allow 45 and 90 degree turns etc. But I guess you don't want that much simplification ? If you train simulator doesn't need very strange things like "up side down loops", then you can reduce the complexity by projecting your train and track on 2D plane (X0Z). Straight track is easy. Straight lines ? Use (partial) circles for curves. Connect straight tracks to curves using an Euler curve/spiral segment. Super-elevation can be computed in some kind of post-process (after you placed the track) to counter any physics that would make the high speed train derail in a curve (e.g. go straight instead of take the curve). The "problem" with the standard bezier curves in train simulators is that they may look nice curves but are difficult to evenly interpolate (e.g. when your train needs to move equidistance). Outdoor scenes Whether for a browser based application or for desktop applications, large outdoor scenes may not be your friend in 3D. Unless it's a desert scene perhaps ? For large outdoor scenes you can indeed use sprites for trees. And you need instances (instead of clones). For non-sprites, like buildings, use LOD (Level of Detail) for your meshes. Be sure to 'freeze' the matrix for non-moving objects. That saves some computations. And then there's other optimizations like Octrees. These break down your world into segments. Based on the camera position and view, only parts of the world in front of your camera will be evaluated for rendering. Still, with those optimizations, I'm still struggling to get a good frame rate on low- and mid-end devices. But I believe it can be done on the powerful computers. ? Demo I've been breaking my head on the train mathematics, but your can see my results so far in my BabylonJS Model Train Simulator game here: https://quintushegie.com/gardentrains/ My game is not the 'realistic' Microsoft Train Simulator type, but you'll get the point... most computations and challenges remain the same. Q [Added] B.T.W. Jerome has made an example of a rollercoaster demo, which is also a nice starting point for objects following path. Check out his Roller Coaster demo on http://jerome.bousquie.fr/BJS/demos/ ) Edited August 12, 2018 by QuintusHegie Added rollercoaster demo from Jerome for inspiration Wingnut, jerome and NasimiAsl 3 Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 12, 2018 Share Posted August 12, 2018 w00t I never about all those before reading your post. GG. 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.