Announcement

Collapse
No announcement yet.

[OPEN-SOURCE] Machinery Modelling Toolkit

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    I see..

    Is that in the T26 the part in the event graph where you use the oncomponenthit on both the idler and sprocket?
    Then I just add the same for all the other roadwheels right?

    Comment


      and the Break and Make static lock event I still need to do

      Comment


        Hi there, I know this is off topic, but I was wondering what is the exact formula you use to calculate MuFriction in your MMT project.

        Comment


          Originally posted by Mr Mobble View Post
          Hi there, I know this is off topic, but I was wondering what is the exact formula you use to calculate MuFriction in your MMT project.
          Final coefficient of friction is calculated from friction ellipse. Ellipse itself is defined by two parameters Mu X and Mu Y as two radii of the ellipse. In runtime, we take direction that wheels are moving at and fetch friction coefficient from ellipse (using ellipse equation):
          https://github.com/BoredEngineer/MMT...brary.cpp#L226
          Youtube Channel

          Comment


            Hey man! I've been trying to set up my own lightweight(read: inferior) version of a tracked vehicle and your comments and code has been very insightful.

            However, one thing I can't properly get a grip on is how to calculate load on the engine and how it affects RPM, and how torque comes into play in all this.
            Could you give me a bit of guidance on how you do it or where in your code I can find info on this?

            Comment


              Hii How can I implement Braking for the Tank?
              Grab Turret Plugin on Marketplace
              Universe is laughing at you especially when you are touching yourself.

              Comment


                Originally posted by BringTheSmiles View Post
                Hey man! I've been trying to set up my own lightweight(read: inferior) version of a tracked vehicle and your comments and code has been very insightful.

                However, one thing I can't properly get a grip on is how to calculate load on the engine and how it affects RPM, and how torque comes into play in all this.
                Could you give me a bit of guidance on how you do it or where in your code I can find info on this?
                Sorry for late reply, forum doesn't notify subscribers if it's your first post on forums.

                The closest example you can check for this is "modular driver train", which can be hard to follow as it's goal is modularity rather than readability.
                Torque is a rotational force, so basically engine produces some torque that is transferred to sprocket through a driver train (clutch, gear box, differential, final drive and etc.), as torque passes by various parts of drive train it changes but eventually it gets to sprocket. Sprocket pulls the track and friction force between track and ground produces "traction" force which on one side pushes vehicle forward but at the same time pushes the track into opposite direction. This "opposite" force is what is called "Normalized Reaction Force" on friction components in MMT. This reaction force pulls on sprocket (through tracks), which produces "negative" torque that is transferred back to the engine through a drive train, which slows down the engine.
                In real life, all these processes happen simultaneously, but in code we can integrate all involved forces from the engine to the ground contact and then back.
                Basically there are 3 things which need to be taken into account in drive train: angular velocity (w), torque (T), moment of inertia (I). They are connected and different drive train parts effect them differently. Their connection goes through these formulas:
                a = T / I
                w = w0 + a * dt
                "a" is angular acceleration, "dt" is delta time and "w0" is angular velocity on previous integration step (frame)
                What it means is that the higher is moment of inertia (rotational equivalent of mass) the more torque you need to rotate an object. Own moment of inertia is a constant for all parts of the drive train, as it depends only on shape and mass distribution of the object. So in theory, for a very simple drive train (engine -> axle -> sprocket) we could just sum up moments of inertia and that would be a final moment of inertia that engine has to deal with. In practice, such drive train might not work at all without some external help, as engine needs to be rotating already to produce torque. Let's add a starter engine then, so you have something that can get drive train into motion to a point where your main combustion engine can start producing torque. Electrical starters are great because they can produce full amount of torque with a zero RPM (unlike most of combustion engines). The heavier the drive train the more time it will take for the starter to get it rotating at some desired RPM. On top of that, if sprocket has track attached to it (or instead of sprocket we have a wheel) and said track is in contact with the ground then starter needs to produce enough torque and long enough to get the whole system into movement. Either way we need some way to accelerate just the main engine without touching the rest of the drive train, and this is why we can add a clutch, which basically splits drive train into independent parts when clutch is not locked.

                [At this point I might be talking about things which you didn't asked] The whole deal with drive train requires quite lengthy explanation as there is a minimal set of devices you need to simulate (or imitate) to make a working vehicles - engine, clutch, gear box (optional), differential or final drive. Each of these parts change torque, angular velocity and "visible" moment of inertia in their own way. So the actual load on the engine, depends on individual state of each drive train part as it matters if clutch is locked and engine now needs to spin all parts together or just its own axle and pistons when clutch is open. The gears (in gear box or differential) change effective moment of inertia quadratically: http://www.racer.nl/tech/effinertia.htm
                Some discussion on this we had on gamedev.net: https://www.gamedev.net/forums/topic...nt-of-inertia/

                The simplest example of drive train I know of is in this classical article:
                http://www.asawicki.info/Mirror/Car%...r%20Games.html
                Try implementing it and see if you get it. It might be better to go over specific question if you have those. I sadly don't have any links to some good overview articles or videos as I've read/watched a bunch of them just from search results. This guy has really good videos on engineering of real cars and you can find explanations for gear boxes, differentials and other parts:
                https://www.youtube.com/watch?v=bgGgH0j0KQE
                Last edited by BoredEngineer; 02-12-2018, 11:31 AM.
                Youtube Channel

                Comment


                  Originally posted by Freedom911 View Post
                  Hii How can I implement Braking for the Tank?
                  For which tank? All example tanks have braking but in different examples its done differently.
                  Youtube Channel

                  Comment


                    Hey BoredEngineer! Incredible work this,and I find myself drawn to this project rather than trying to wrap my head around writing my own PhysX MovementComponents because of the utter lack of information on how to go about doing that, specifically for tracked vehicles. Seems several teams have done it, but maybe I am just too daft to figure out how to. Regardless, with some testing MMT seems to hold up well enough in network environments, but how do you think it would hold up with tens of vehicles being simulated (thinking racing game or such, just for fun)? Would that be overkill?
                    Last edited by Fabelwesen; 02-12-2018, 04:25 PM.

                    Comment


                      Originally posted by Fabelwesen View Post
                      Hey BoredEngineer! Incredible work this,and I find myself drawn to this project rather than trying to wrap my head around writing my own PhysX MovementComponents because of the utter lack of information on how to go about doing that, specifically for tracked vehicles. Seems several teams have done it, but maybe I am just too daft to figure out how to. Regardless, with some testing MMT seems to hold up well enough in network environments, but how do you think it would hold up with tens of vehicles being simulated (thinking racing game or such, just for fun)? Would that be overkill?
                      I haven’t done anything in MMT in regards to multiplayer support. In simplest case, where each client simulates their own vehicle, performance should be fine. If you want to do it on the server, regardless of replication details, then couple of things could be improved. Like packing multiple components into a single component and looking at ways to multi thread calculations. Currently the bottleneck on tanks for example, is in amount of components being used. Last time I’ve run performance test, whole physics update multiple time per frame, took roughly the same amount of time that UE4 spends updating transforms of components - which is a lot imho.
                      In feature versions I want to re-engineer how components are setup. Was working on that already but stopped due to multiple reasons. Like suspension is already split into two classes, a UObject with all Code an component class that wraps it, so one can make a component with array of suspension stacks instead of having one component per each suspension. Need to do the same for friction component.
                      Last edited by BoredEngineer; 02-12-2018, 08:10 PM.
                      Youtube Channel

                      Comment


                        Originally posted by BoredEngineer View Post
                        I haven’t done anything in MMT in regards to multiplayer support. In simplest case, where each client simulates their own vehicle, performance should be fine. If you want to do it on the server, regardless of replication details, then couple of things could be improved. Like packing multiple components into a single component and looking at ways to multi thread calculations. Currently the bottleneck on tanks for example, is in amount of components being used. Last time I’ve run performance test, whole physics update multiple time per frame, took roughly the same amount of time that UE4 spends updating transforms of components - which is a lot imho.
                        In feature versions I want to re-engineer how components are setup. Was working on that already but stopped due to multiple reasons. Like suspension is already split into two classes, a UObject with all Code an component class that wraps it, so one can make a component with array of suspension stacks instead of having one component per each suspension. Need to do the same for friction component.
                        Makes sense yes. I guess that, in theory, it'd be possible to leave the clients to their own devices and just have the server check if they are in an invalid location or moving too fast perhaps? I got bored as well, so I started building a version of A_TrackedVehicle in C++ to both learn how you do things and to see what I could do with it since I seem to think better in raw code when the blocks get huge and full of math.

                        Out of curiosity, since you're evident quite bright when it comes to these things, have you muddled at all with the PhysX implementation? Frankly I prefer the way you do things due to simplicity and UE's vehicle physics are "interesting".

                        Comment


                          Originally posted by BoredEngineer View Post

                          For which tank? All example tanks have braking but in different examples its done differently.
                          Sorry for late reply .I am using the M113 blueprint tank.So I was going through one of the post where you mentioned that you can't get too many tanks in scene because of performance drop.I also looked for some optimization techniques mentioned in that post which were great. But In my case I am planning for 50+ tanks in single scene. If I cant get realistic tank movement because of performance issue I would be happy to explore other options like hover tanks(which I think is great).Will they will be more efficient in terms of performance for example hovercraft movement calculation wold be faster than tank movement?

                          This is one of my old time favorite game where the robot and tank hovers.Mind the volume
                          https://youtu.be/S9YWgPgbSF0?t=4m52s
                          Grab Turret Plugin on Marketplace
                          Universe is laughing at you especially when you are touching yourself.

                          Comment


                            Originally posted by Fabelwesen View Post

                            Makes sense yes. I guess that, in theory, it'd be possible to leave the clients to their own devices and just have the server check if they are in an invalid location or moving too fast perhaps? I got bored as well, so I started building a version of A_TrackedVehicle in C++ to both learn how you do things and to see what I could do with it since I seem to think better in raw code when the blocks get huge and full of math.

                            Out of curiosity, since you're evident quite bright when it comes to these things, have you muddled at all with the PhysX implementation? Frankly I prefer the way you do things due to simplicity and UE's vehicle physics are "interesting".
                            A_TrackedVehicle is an old implementation which is inferior in most ways to T-26 example. I've brought it into MMT from an older project. The only benefit it have is that everything packed into a single BP but it lucks modularity of the new version together with some bugfixes and features like more adequate suspension.

                            I haven't used PhysX implementation but recommend looking into it if your goal is performance. It has some quirks but as source code is available you can mod it to your needs. Performance wise it's really great, I've heard people having like 20 tanks roaming around without significant performance impact.
                            Youtube Channel

                            Comment


                              Originally posted by Freedom911 View Post

                              Sorry for late reply .I am using the M113 blueprint tank.So I was going through one of the post where you mentioned that you can't get too many tanks in scene because of performance drop.I also looked for some optimization techniques mentioned in that post which were great. But In my case I am planning for 50+ tanks in single scene. If I cant get realistic tank movement because of performance issue I would be happy to explore other options like hover tanks(which I think is great).Will they will be more efficient in terms of performance for example hovercraft movement calculation wold be faster than tank movement?

                              This is one of my old time favorite game where the robot and tank hovers.Mind the volume
                              https://youtu.be/S9YWgPgbSF0?t=4m52s
                              It will be as efficient as you design them, there are many ways how hovecraft can be made. Overall, yes it will be more perfomant as you need less components and many things can be faked with a simpler math. One of the tricks with older games is to have a "flat" level, then you don't even need any suspension or hovering as vehicle can just sit at some height from the ground.
                              Youtube Channel

                              Comment


                                Originally posted by BoredEngineer View Post
                                A_TrackedVehicle is an old implementation which is inferior in most ways to T-26 example. I've brought it into MMT from an older project. The only benefit it have is that everything packed into a single BP but it lucks modularity of the new version together with some bugfixes and features like more adequate suspension.

                                I haven't used PhysX implementation but recommend looking into it if your goal is performance. It has some quirks but as source code is available you can mod it to your needs. Performance wise it's really great, I've heard people having like 20 tanks roaming around without significant performance impact.
                                I gathered, yes, but I felt it was easier to get a good look at everything in one place, so to say, and pretty quickly converted before looking at the other stuff in detail. I have it working as a C++ implementation now with some changes on my own and so far so good x). But it's just for the curiosity value right now of course.

                                Thanks for the recommendation RE PhysX. I've found a plethora of vehicle resources, but nothing at all for tanks in regards to their implementation. I've looked at the tank snippet from their own (PhysX) SDK but it didn't get me very far. Because of this I can't help but wonder if you are referring to any specific source code being available? Am not asking you to do all the work for me, it may simply be that all the queries I've put into google and elsewhere have not provided the right results :x. I guess my real issue is figuring out how to marry the PhysX example and UE's vehicle system in a logical manner. I had a play with the UE plugin that lion03 (on GitHub) made, but it doesn't utilize the PhysX implementation at all, rather making a 4W vehicle with some very slight changes and the result isn't really that great, comparatively.
                                Last edited by Fabelwesen; 02-14-2018, 09:33 AM.

                                Comment

                                Working...
                                X