[OPEN-SOURCE] Machinery Modelling Toolkit

Nice work with the flying!

(Dealman, I just stared at the signature for about 5 seconds before I got it :slight_smile:

Totally doable :slight_smile:
For this you need to make changes in this graph:

First I would disable GetThrottleInputForAutoHandling function as it will interfere with your custom steering logic. What it does is controls when reverse gear should be enabled, how torque from the engine should be divided between tracks when you do normal/neutral turn and when to shift gear box. You can add similar logic later if needed.

What you need to provide into system are values for these variables:
Wheel Forward Coefficient
Wheel Right Coefficient
Wheel Left Coefficient

“Wheel” is a bit confusing but I don’t remember anymore why I called it like that :smiley: Anyway, this is how these variables are used in UpdateThrottle() function:


It was build for keyboard so I had to capture somehow input of pressing both forward and left/right at the same time. This is how it looks:
Turning right by pressing only “Right” input:
Traked_Vehicles_Turning_Righ_Without_Forward.JPG
Turning right by pressing “Right and Forward” at the same time:
Traked_Vehicles_Turning_Righ_With_Forward.JPG
Rendered numbers are values of TrackTorqueTransferRight and TrackTorqueTransferLeft which are calculated out of “Wheel xxx Coefficient” in UpdateThrottle() function mentioned earlier.
Maximum absolute total TrackTorqueTransfer you can have is 2, so for example combinations of -1,1] [0,2] -2,0] are all valid. They just say how much engine torque is transferred to each tracks and total coefficient of 2 is 100% of engine torque.

Taking into account explanation above I would implement it in a following way:
Add two AxisInput for each stick. Set values from sticks in such a way that if only one stick is pressed than you multiple its axis value by 2 and don’t multiply if both sticks are pressed. Feed result into Wheel Right Coefficient and Wheel Left Coefficient (you don’t need
Wheel Forward Coefficient in such setup).

This should handle throttle. Unfortunately there are some issue with my model and turning using engine at higher speed is just won’t work as tracks have a lot of inertia. At higher speeds you have to use brakes for steering. There are two input variables for brakes: BrakeRatioRight and BrakeRatioLeft. Both are in range of 0…1. Maybe you could map those to some “buttons” on gamepad. This type of steering is very sensitive, it was hard to control it from keyboard so I’ve used a PID controller to apply brakes. Look into UpdateSteeringBrakes() function for more details.

Thank you!

Update

Meanwhile I’ve pushed another update:

Added Debug Float Graph element for PSS Visual Debugger component. This new element allows to plot graph of a specific variable in real-time, this makes it much easier to debug as it’s not only easier to read current value (debugging using DrawDebugString in subtepping can make text un-readable when values overlap) but see if you have some sudden change in values:

To add one of such graphs you need to send an interface message to a pawn, this is how it is done from typical MMT component:

I use Wrap Box in UMG to place graphs on the screen. You can’t really control order or placement but all graphs from multiple components of the same pawn can be automatically displayed.

Another update - fixed Flying Aerosled getting stuck in the air when trying to fly upside-down.

This update is already at GitHub repo and executable was updated too.

Cheers for a very descriptive response, I totally overlooked A_TrackedVehicle :rolleyes: Will fiddle with it a bit today and if the results are good I may return here in case others are curious about it as well. Again, amazing work.

Thank you! If there any issues with implementing it, just post here and we will figure it out. Part of the plan is to re-build tracked vehicles using components, instead of monolithic single class as it’s made right now. But I’m still not sure how to “componentize” steering controllers in such a way that they can be re-usable.

Update

Added a basic landscape of 8 by 8 kilometers. A bit more interesting for airplanes and there are two “landing strips” to land on.

The rest of the vehicles are there too, in case someone wants to drive over the larger level.

Latest source is on GitHub: https://github.com//MMT_Content
and latest executable is here: Dropbox - File Deleted - Simplify your life

Managed to get it to work, very early implementation of it though. I made it so if you lower throttle on for example the left side - it will apply a bit of braking power to help the steering. Works nicely at lower speeds, at higher speeds not so much - so I need to multiply the braking power depending on speed.

Also looking at implementing placeholder sound since I can easily get the RPM and all that stuff. Very nice job making sure all variables are easily accessible! Dunno if the UE4 Marketplace accept plugins - but if it does, this is would be well worth buying.

Have you done any multiplayer replication testing with this?

You could try using PID controller for that. If I remember correctly, I’ve set it up in such a way that it measures rate of turn, if it’s tuning too slow more brake will be applied. Needs tweaking as well.

I want to keep this open source, what could be placed on marketplace is visual parts for these kind of machines. Something like collection of machine guns, tracks, tires and wheel, steering wheels, suspension meshes and etc. like lego blocks. 3D models don’t age as quickly as code and don’t require the same level of maintenance.

I haven’t touched replication even a bit, this will require replication with physics and will differ from project to project.

Fair enough, here’s the very early implementation of driving it with a 360 pad;

[video]https://streamable.com/g2ug[/video]

A little bit iffy piffy, but will look into how you’re doing it via the PID controller and see if I can replicate a similar behaviour. The sound’s pretty trash, but I just smashed something together in 5 minutes so there’s at least something. Was thinking about maybe throwing some simple prototype together whereas one player control the tank and another handles the gun. Always been a fan of multi-crewed vehicles. :rolleyes:

Would need to look into what would be the best way to replicate the movement though.

This is awesome! The sound adds really a lot to perception. Did you hooked it into RPM?
I didn’t do anything for the sounds yet, perhaps I could add events that could be used to trigger sounds. For example when suspension gets compressed to limit or velocity of spring compression.

Another thing which can be done for controls is steering mechanism similar to what Panters had during WW2. Driver has a single gas pedal but two separate gear boxes for each track and separate brakes. This allows a lot of different combination in respect to turn radius and speed.

For multiplayer. If you are looking at building a coop type of gameplay and you don’t expect people to cheat then you can build it as client authority. It’s much simpler and smoother setup then server authority.

The sound’s pretty bad, and yeah I just hooked it up to the RPM - it changes the pitch accordingly. Some events of such would be very nice indeed, I was thinking about adding events for gear shifting as it sounds rather odd when the RPM jumps straight back to 1400. I also noticed that the RPM doesn’t really increase until you’ve got some speed going.

Thumbsticks work great as-is except for poor turning at higher speeds, but the braking method does work. Pretty fun for just being placeholder stuff.

The co-op stuff would just be for testing purposes and sort of a proof of concept I guess, so cheating shouldn’t be a worry. I was pondering as to how I would replicate its movement so it moves around nicely on the other client(s) screen. Will do some testing at a later stage, gotta refine the controls a bit and model a new hull and a turret for it. :slight_smile:

The engine on M113 has a minimal RPM of 1400. On real machine they have automatic gear box, so no clutch and etc. From this perspective what I have is a bit of a weird setup. Right now engine doesn’t receive torque from the wheel and engine curve starts from 1400 instead of 0. I need to look into this in greater detail and assemble proper drive train, with features likes braking using engine or getting it stalled.

Client authority replication should work then. From what I understood it works just fine, the issue is that people can cheat with such setups so majority of games opt for server authority.

I know the general logic behind client/server authority to prevent cheating, what I was referring to would be the optimal way to replicate its movement. If I should just replicate for example the velocity of it and such, or replicate its current amount of torque and all that stuff. Would need to do some testing to find out what’s optimal as I have no clue.

I think the current way of doing it is pretty darn good, it’s just that the RPM doesn’t increase until you’ve reached around 10km/h which is a bit odd. As you’d start to move forward, but the audio of the engine wouldn’t increase. That kind of stuff is way out of my league, though.

Ohh, sorry, have no clue either, just sharing what I know about it, which is not much.

This happens because engine itself is not simulated. With a proper simulation there would be some minimal idle RPM and gas, which are enough to produce some torque to compensate engine own friction. What I’ve tried to do, is to add extra node in the engine torque curve like this:
2364d34098303144fde65c1c52b4cc65ca8a051d.jpeg
then RPM start to go up pretty much as soon as tracks get some speed but this effects steering - you need engine torque to steer tracks.

Perhaps for the sound you could tie both RPM and Gas pedal somehow. I don’t think that only tweaking torque curve without doing changes in other part of machine would work.

whoop… you are featured on the spotlight page in the Epic Launcher!

Great work :wink:

thank you !

Thank you, guys!

I’ve got a new update ready but there is issue with packaging. Several static meshes are not being packaged which makes Fokker DrI physics glitch out. Meshes that are not packaged are engine, ailerons and elevators. Already posted bug-report on answer-hub:

Have zero clue what is going on. This is started when I’ve switched to 4.11.1 and added larger landscape for the airplanes level.

Update

  • Added new actor Atmosphere Manager. Role of this actor is to provide data regarding air density at different altitudes and wind direction/magnitude. Right now only variable air density is implemented. As an input you can provide air density at sea level and curve coefficient which describes how air density changed with altitude. Default curve is a simple approximation of the Earth atmosphere.
  • AirDrag3D and WingAirfoil components can be switched into using Variable Air Density. For this to work they expect their owner to implement AtmosphereQuery interface. For now only Fokker DrI supports this feature.
  • Fixed bug where Debug Float Graph wasn’t rendered correctly if Min and values where not symmetrical by magnitude.

Know issues:
following assets are not being packaged
SM_Fok_Engine.uasset
SM_Fok_ElevatorRight.uasset
SM_Fok_ElevatorLeft.uasset
SM_Fok_AileronRight.uasset
SM_Fok_AileronLeft.uasset
but everything works correctly in editor.

Hello ive downloaded a zip archive from git hub and paste the plugins folder to my project and now when i try run my project some window pop up and telling me -"Plugin "MMT’ Failed to load because module ‘MMT’ does not appear to be compatible with the current version of the engine. The plugin may need to be recompiled’ Im using 4.10.4 version of the engine and ive tried to recompile it in Visual Studio 2013 but i really dont know how to do this.
How can i get this to run?

Make sure you download a 4.10 version of plugin, it’s stored in the separate branch. To switch branch, click on “master” on the repo page.
Ohh and after you copy proper version, right click on your project file in explorer and regenerate visual studio project. This is for c++ project, right?