What's that? A new post after four months of pure deadness? You bet it is! I just seem to have lost motivation and time to maintain this blog, although it really shouldn't be too difficult, it just seems to be.
Anyways, the focus of this post is my new method of coupling railcars/locos together. Nothing on your end will change, you still push railcars together for them to couple, then space them out a bit and press E near their couplers to uncouple them. However behind the scenes is a different story, it used to be, on this base, that each unit would have one or two (so far all have had two) coupling position, and a rope would connect both units together relative to those points on the model, depending on which were closest to each other. This can be seen below.
25Ton Brakevan(left) and Percy(Right) |
As you can see, the Brakevan on the left, and Percy's rear on the right have coupling points close to their couplers/hooks, and they couple between them. Also, notice the height difference between the two, if Percy was strong enough, or a jolt powerful enough came thru the line of cars, it could lift a railcar off the tracks! The new way is handled instead, as shown below.
The coupler rope is now placed at the bottom of the bogeys! Why is this? Simple really, torque. Torque is defined as "a twisting force that tends to cause rotation", and that's exactly what it does wrong when it comes to train stability.
The couplers right now, are placed above the rails, and in GMod, with its map limits, we must have smaller and tighter curves to accommodate this limited amount of room. This it not a mappers fault, this is not Garry Newman's fault. This is the fact that Source Engine is, while still being updated, rather old, and can only support 15 bits in maps for values, causing a small 32749 x32749 amount of space to be available.
The rope here is only shown for visual reference, in use it wont show up. |
The coupler rope is now placed at the bottom of the bogeys! Why is this? Simple really, torque. Torque is defined as "a twisting force that tends to cause rotation", and that's exactly what it does wrong when it comes to train stability.
The couplers right now, are placed above the rails, and in GMod, with its map limits, we must have smaller and tighter curves to accommodate this limited amount of room. This it not a mappers fault, this is not Garry Newman's fault. This is the fact that Source Engine is, while still being updated, rather old, and can only support 15 bits in maps for values, causing a small 32749 x32749 amount of space to be available.
To visualize the torque caused by having the couplers above the rails, I've made a small illustration
If you have used my trains in GMod for any length of time, especially on Sunset_Gulch(Great map), then you'd know that the S curves and yards can be deadly at any speed. While speed does have a factor, speed doesn't cause railcars to be ripped off of the rails, torque does that. Imagine hauling 40 railcars with 3 engines, that's a lot of power on the front drawbar, and all that force, like electricity, wants to follow the path of least resistance, on straights, that's easy enough, just follow behind, but when you hit a Curve, or it's devil of a variant, the 'S' Curve, then things become hectic. As seen below...
The path of least resistance does not follow the curve, instead, it tries to cut corners, just like one would do on a small path to save half a second, a train will try to do the same. However it has one thing stopping it, the rails. But the couplers, that string that pulls everything with it, is above the rails, its low enough to not cause issues, but if you have enough power, and a tight enough curve, they will adhere to the least resistant path, and roll cars over the rails, this is the torque I am talking about. This is what causes railcars to derail inward on a curve, rather than outward.
With the coupling now below the rails, the railcars can no longer --given enough force-- roll over the rails. You would now need much more force for them to be pulled out of the rails, or meet one of the many Source Engine physics glitches that causes the cars to bounce out of the rails.
Reducing the torque on the railcars isn't the only thing this fixes, it also rectifies the issue of railcars that are long, and have some distance between the bogie(which the railcar body pivots around) and the coupler, to rip other cars off the tracks. This was most notable with the 73 foot railcars on the small and tight curves of yards, the railcars would pivot so hard that there would not be enough slack, and would pull other railcars together and off the rails.
Now, the railcars coupling points follow that pivot point, and thus there is no way for a railcar to turn enough to pull another off of the tracks.
This update also makes the coupling system more efficient, as well as function correctly. Railcars connect to one another then they collide, however this collide call is called on both railcars at the same time, there is no way of it only happening on one. This lead to a double coupling, where two ropes were spawned in the same places, and thus I had to surmise a system that would uncouple a railcar twice, and that only worked half the time. There is no longer any issue with this, because I added a simple check; if this railcar was spawned newer (ent:CreationID()) than the other one, it would connect, and thus the other one had to be spawned older, and would not run any code. One railcar is always going to be older than another, so this works well! And to think I was going to have some form of long overthought 'handshaking' process to deal with this.
The simplest solutions are the best ones.
Next up, will be my continued work on the J94, and some texture progress. As well as adding support for Diesel Mechanical locomotives.
Until next time on CBH.
Meow~