ChaseMoskal Posted June 27, 2016 Share Posted June 27, 2016 Hey folks! I'm new to the HTML5 Game Devs community, and am in the process of learning BabylonJS. I'm looking for advice on how I should simulate vehicular physics for tanks in an open source game project I've began with some old friends. "Nanoshooter" open source tank game on GitHub Issue specifically about the tank physics We're hoping to create a physical simulation for tank movement that is as simple and optimal as possible, because we want to be able to simulate as many tanks as we can get away with. We're not looking for realism or high accuracy — we're more interested in producing a zippy and capable feel to the tank movement, where the player can easily roll over obstacles instead of becoming stuck on them, making the player feel in control rather than frustrated at a finicky tank that gets stuck on rocks and things. I was hoping that somebody from this community might be able to point us in the right direction with some tips, pointers, and ideas about how we could accomplish physics based tank movement for our game. Overall, with this game project, we're hoping to build a fun tank game, but also contribute to this community and the BabylonJS ecosystem by creating an open source framework for building online multiplayer realtime action games on BabylonJS. Glad to have joined this community, Thanks! - Chase, and the Nanoshooter team. Quote Link to comment Share on other sites More sharing options...
ChaseMoskal Posted June 28, 2016 Author Share Posted June 28, 2016 I'm going to bump this thread, because I do believe that this thread sunk to the bottom of the first page before the moderator approved it, so I think it's fair. Quote Link to comment Share on other sites More sharing options...
jerome Posted June 28, 2016 Share Posted June 28, 2016 Could you say more ? How do you intend to design the ground ? a heightmap maybe ? Do you intend to set some extra obstacles as independent BJS objects on the ground ? etc ? do you intend to use one of BJS pluggable physics engine (oimo or cannon) or to make your own ? Quote Link to comment Share on other sites More sharing options...
RaananW Posted June 28, 2016 Share Posted June 28, 2016 Hi Chase, a tank is a heavy bulk of metal, that has good suspensions and low speed. It has some wheels (the tanks I know have 6 ), and a chain thing that circulates them. The chain would be the hardest part to simulate, IMHO. The rest is more than possible. You will need to choose your physics engine, of course after considering the ups and downs of both. To build a tank, I think Oimo's prismatic joints will be very helpful. cannon, however, has better support for different types of meshes. So, if you can live with basic primitives (sphere, box, cylinder), go with oimo. I showed once how to build a car with suspensions using oimo and babylon - http://www.babylonjs-playground.com/#SFELK#1 . I am in the middle of writing a blog post about it, fully explaining it. But the code is there. Quote Link to comment Share on other sites More sharing options...
ChaseMoskal Posted June 29, 2016 Author Share Posted June 29, 2016 23 hours ago, jerome said: Could you say more ? How do you intend to design the ground ? a heightmap maybe ? Do you intend to set some extra obstacles as independent BJS objects on the ground ? etc ? do you intend to use one of BJS pluggable physics engine (oimo or cannon) or to make your own ? We're hoping for the ground to be composed of hand-sculpted meshes, allowing for interesting possibilities like cliffs, bridges, caves, etc. We're looking to create a dynamic environment, including other physical obstacles that can be interacted with, run over, bumped into, etc. We're also preferring to use the BJS pluggable physics engine unless there are major drawbacks with the approach. Something that's caught my eye, is that I haven't noticed a mechanism to engage the physics engine under a web worker. Is there a way to run physics on a dedicated worker? Thanks for your input and questions. Quote Link to comment Share on other sites More sharing options...
ChaseMoskal Posted June 29, 2016 Author Share Posted June 29, 2016 7 hours ago, RaananW said: Hi Chase, a tank is a heavy bulk of metal, that has good suspensions and low speed. It has some wheels (the tanks I know have 6 ), and a chain thing that circulates them. The chain would be the hardest part to simulate, IMHO. The rest is more than possible. You will need to choose your physics engine, of course after considering the ups and downs of both. To build a tank, I think Oimo's prismatic joints will be very helpful. cannon, however, has better support for different types of meshes. So, if you can live with basic primitives (sphere, box, cylinder), go with oimo. I showed once how to build a car with suspensions using oimo and babylon - http://www.babylonjs-playground.com/#SFELK#1 . I am in the middle of writing a blog post about it, fully explaining it. But the code is there. Thanks for sharing your vehicle physics demo, I appreciate it! We're hoping to prioritize performance over physical accuracy. If Cannon can support physics impostors based on any convex mesh, we may want to pursue that, perhaps creating a simple situation where two trapezoidal impostors might form "skis" where the treads are. The challenge may then be to create the equivalent of a parking brake for the tank — if the driver stops moving while on a steep hill, the tank shouldn't slide down the hill. Does BabylonJS physics have a Dampening feature? Perhaps we want the tank to have really strong traction (friction) against the ground, which is only overcome by very powerful movement forces — and then the movement is disabled whenever the tank isn't directly against the ground, so that it doesn't ever go flying? As you can tell, I'm just shooting ideas around, and am not very sure of how this might be accomplished properly given the tools and features BabylonJS or its underlying physics engines. We want the tank to have a lot of horsepower and be capable of pushing obstacles around and hopefully rolling over things. With an extremely simple physical setup like described above, we may be forced to forgo this capability for the sake of performance (I'm imagining that for a proper "roll-over", we really would need highly dynamic and realistic treads that can conform to the surface profile of whatever is being rolled over, if you know what I mean). We're hoping to support scenes of 10 or more of these simple tanks rolling around. I'm not sure how we'll animate the treads rolling, but perhaps some solution that would involve scrolling the UV coordinates for those polygons in a specific way. Thanks again for your thoughts and advice. 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.