Page 1 of 3

My Train Mod

PostPosted: Fri Jan 16, 2015 07:53
by jordan4ibanez
I'll rewrite this eventually
https://github.com/jordan4ibanez/trains




Original Mod Post:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
[b]Test it[/b] - Do not build anything across the 0 node on the x or z I am currently fixing that
Check up on this regularly, I update this a lot (Revision 0020 currently)
[url=https://www.dropbox.com/s/4o9vjxzsns24dxg/trains0020.tar.gz?dl=0]tar.gz[/url]
[url=https://www.dropbox.com/s/optvh3umijeiyxw/trains0020.zip?dl=0].zip[/url]

I am currently creating a multi entity train mod, here is a video of the current state:
http://youtu.be/B5PP8k8KcIo

The main focus of this mod is so that you can haul a lot of stuff across great distances, transport things and generally have a great time. All of the trains and cars will be able to hook together and will work as one singular entity. There will also be weight to the cars and torque to the train, so you will be forced to hook together engines to pull the cars.

I am going to have:
Planned Things

-Steam trains with and without a tender
-Minecarts
-Storage cars


Possible Things
-Water stations that automatically refill your water
-Coal stations which automatically refill your tender
-Mining bore car which attaches to the front of the train
-Passanger cars
-Liquid cars
-Flatbed cars for storing vehicles from other mods if there are any
-A crane
-A caboose


I'm still working on bugs (ie serialization, or if only one part of the train spawns, which will force load chunks) and making the cars more modular, maybe I'll even work it into an API (unlikely though).
This will take quite a long time to get done, so if anyone can create meshes that would be awesome!

Re: My Train Mod

PostPosted: Fri Jan 16, 2015 09:39
by TriBlade9
This is quite an awesome mod! I can't wait to see how it turns out. That pink engine looks amazing. :P
How exactly did you get the entities to act as one and calculate the rotation correctly?

Re: My Train Mod

PostPosted: Fri Jan 16, 2015 10:10
by rubenwardy
Awesome. Will that be like the Minecraft train mod?

https://www.youtube.com/watch?v=DaLOASx7Lrc

It's nice that you're back.

Re: My Train Mod

PostPosted: Fri Jan 16, 2015 12:14
by cHyper
+1 good work ...

Re: My Train Mod

PostPosted: Fri Jan 16, 2015 12:28
by ExeterDad
Oh I sure hope you keep this up! I just showed my kids the video. They are SUPER excited about this!
Hell... I'm excited!

Re: My Train Mod

PostPosted: Fri Jan 16, 2015 13:40
by maikerumine
+1 Very nice work!!!

Re: My Train Mod

PostPosted: Fri Jan 16, 2015 18:02
by jordan4ibanez
TriBlade9 wrote:This is quite an awesome mod! I can't wait to see how it turns out. That pink engine looks amazing. :P
How exactly did you get the entities to act as one and calculate the rotation correctly?

Tables and IDs! And for rotation see the code below.

rubenwardy wrote:Awesome. Will that be like the Minecraft train mod?

https://www.youtube.com/watch?v=DaLOASx7Lrc

It's nice that you're back.

Yes. That was the inspiration for it actually. I wanted to do this mod a few years back but I was too inexperienced. The main difference between that mod and mine is that:
1.) ALL engines and wheels will be animated based on speed
2.) Due to the way mine works, there won't be issues with the way train's models not facing the correct direction due to the way that the direction is calculated

This is the calculations, it positions the engine in between the two trucks and sets the yaw based on them. This will work whether the train is going backwards or forwards.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
--pos
local pos1  = train_table[self.id][1].object:getpos()
local pos2  = train_table[self.id][2].object:getpos()
local cpos  = self.object:getpos()
local pos   = {x=(pos2.x+pos1.x)/2, y=cpos.y, z=(pos2.z+pos1.z)/2}
self.object:setpos(pos)
--yaw
local vec = {x=pos2.x-pos1.x, y=0, z=pos2.z-pos1.z}
local yaw = math.atan(vec.z/vec.x)+math.pi/2
if pos2.x < pos1.x then
   yaw = yaw + math.pi
end
self.object:setyaw(yaw)


And thank you! With my new diet and increased knowledge I'll be able to pump out some truly incredible mods, but don't quote me. :P

cHyper wrote:+1 good work ...

Thank you!

ExeterDad wrote:Oh I sure hope you keep this up! I just showed my kids the video. They are SUPER excited about this!
Hell... I'm excited!

Just wait until the train is complete and pulls a few cars, then you'll be truly excited, haha.

maikerumine wrote:+1 Very nice work!!!

Thank you!

Re: My Train Mod

PostPosted: Fri Jan 16, 2015 19:19
by addi
wow! just missing words to describe how amazing this is.

Re: My Train Mod

PostPosted: Sat Jan 17, 2015 03:14
by jordan4ibanez
addi wrote:wow! just missing words to describe how amazing this is.

Thank you!

Also, here is a new video:
http://youtu.be/bqPDE2Xdgbs

The added features are:
-Trucks keep an even distance from each other
-Trucks force load a 5x5 area so that they can be autonomous
-Everything looks a little better

Re: My Train Mod

PostPosted: Sat Jan 17, 2015 03:33
by TriBlade9
jordan4ibanez wrote:
addi wrote:wow! just missing words to describe how amazing this is.

Thank you!

Also, here is a new video:
http://youtu.be/bqPDE2Xdgbs

The added features are:
-Trucks keep an even distance from each other
-Trucks force load a 5x5 area so that they can be autonomous
-Everything looks a little better

Wow! You're making a lot of progress fast.
However, the turning doesn't look quite as nice as the last one.

Re: My Train Mod

PostPosted: Sat Jan 17, 2015 03:49
by jordan4ibanez
TriBlade9 wrote:
jordan4ibanez wrote:
addi wrote:wow! just missing words to describe how amazing this is.

Thank you!

Also, here is a new video:
http://youtu.be/bqPDE2Xdgbs

The added features are:
-Trucks keep an even distance from each other
-Trucks force load a 5x5 area so that they can be autonomous
-Everything looks a little better

Wow! You're making a lot of progress fast.
However, the turning doesn't look quite as nice as the last one.

That's because I didn't add additional space to the trucks to fit the model, lets see if I can post a quick video of it adjusted in a bit

Re: My Train Mod

PostPosted: Sat Jan 17, 2015 04:02
by ExeterDad
This is gonna be awesome! *jumping up and down*

Re: My Train Mod

PostPosted: Sat Jan 17, 2015 04:39
by jordan4ibanez
The distance between trucks is now adjustable so here's a video of smoother turning:
http://youtu.be/LFyndP3OIL8

Re: My Train Mod

PostPosted: Sat Jan 17, 2015 08:07
by Krock
jordan4ibanez wrote:The distance between trucks is now adjustable so here's a video of smoother turning:
http://youtu.be/LFyndP3OIL8

Whoa, that's great! I hope you can use a better texture soon.
Also change the object params, so it collides with other objects :)

Re: My Train Mod

PostPosted: Sat Jan 17, 2015 15:24
by Nathan.S
Great work, this looks amazing.
Two questions, is the code on github or available to download at all, and are you planing on setting up switches?

Re: My Train Mod

PostPosted: Sat Jan 17, 2015 22:39
by jordan4ibanez
Nathan.S wrote:Great work, this looks amazing.
Two questions, is the code on github or available to download at all, and are you planing on setting up switches?

Thank you very much!
Not yet, this code is way to young to be usable or even testable. When I work out all the bugs I will put it up for download.

Also, here's a new video:
http://youtu.be/B5PP8k8KcIo

Re: My Train Mod

PostPosted: Sun Jan 18, 2015 02:31
by TG-MyinaWD
Now this will go great for New York :D also great amazing bygone awesome.

Might be an very useful if had passenger cart Fit players. maybe 10 or even 25. depending how many seats. Also I see in the near Future an "The Poler Express" map.

Re: My Train Mod

PostPosted: Sun Jan 18, 2015 02:52
by Lukester
This mod looks amazing. I can't wait until its 100% complete. Keep up the good work. :)

Re: My Train Mod

PostPosted: Sun Jan 18, 2015 03:39
by ExeterDad
Yeah! What he said ^^

Re: My Train Mod

PostPosted: Sun Jan 18, 2015 20:12
by philipbenr
+1 I am loving this. I hope that this does get far enough to be useable very soon.

Re: My Train Mod

PostPosted: Sun Jan 18, 2015 20:33
by jordan4ibanez
Test it - Do not build anything across the 0 node on the x or z I am currently fixing that
Also this is just currently a mine cart
.tar.gz
.zip

EDIT
Alright, it's ready to be tested

Re: My Train Mod

PostPosted: Sun Jan 18, 2015 21:55
by Lukester
I tested it and it needs a lot of work before being released to the public. Keep up the good work though. Heres the vid https://www.youtube.com/watch?v=t2Et3p0 ... e=youtu.be

Re: My Train Mod

PostPosted: Sun Jan 18, 2015 22:06
by jordan4ibanez
Lukester wrote:I tested it and it needs a lot of work before being released to the public. Keep up the good work though. Heres the vid https://www.youtube.com/watch?v=t2Et3p0 ... e=youtu.be

Did the file you downloaded say 0015 or 0016?

Re: My Train Mod

PostPosted: Sun Jan 18, 2015 23:20
by jordan4ibanez
Hey guys, here's a new video of the current state of the new code:
http://youtu.be/6li-79p5hlA

Re: My Train Mod

PostPosted: Sun Jan 18, 2015 23:38
by ExeterDad
jordan4ibanez wrote:Hey guys, here's a new video of the current state of the new code:
http://youtu.be/6li-79p5hlA

Thanks for the vid! Yeah... those buggers can move!
Question. As development moves on, do you think it will be possible for train cars to follow behind the engine? If so... it will be epic. It's certain my kids will have me making models of their favorite trains. We go rail fanning all the time. They are huge enthusiasts.

They have hundreds, maybe even a thousand or more bucks invested in their HO scale train sets. You may be saving me a ton of cash! LOL

Re: My Train Mod

PostPosted: Sun Jan 18, 2015 23:47
by jordan4ibanez
ExeterDad wrote:
jordan4ibanez wrote:Hey guys, here's a new video of the current state of the new code:
http://youtu.be/6li-79p5hlA

Thanks for the vid! Yeah... those buggers can move!
Question. As development moves on, do you think it will be possible for train cars to follow behind the engine? If so... it will be epic. It's certain my kids will have me making models of their favorite trains. We go rail fanning all the time. They are huge enthusiasts.

They have hundreds, maybe even a thousand or more bucks invested in their HO scale train sets. You may be saving me a ton of cash! LOL


Yes actually, that was the main part of the original idea. :)

Re: My Train Mod

PostPosted: Mon Jan 19, 2015 00:32
by ExeterDad
jordan4ibanez wrote:Yes actually, that was the main part of the original idea. :)

*headslap* Yep... right there in first post. Disregard the brain fart please.
:P

Re: My Train Mod

PostPosted: Mon Jan 19, 2015 05:40
by jordan4ibanez
ExeterDad wrote:
jordan4ibanez wrote:Yes actually, that was the main part of the original idea. :)

*headslap* Yep... right there in first post. Disregard the brain fart please.
:P

Lol :p

Re: My Train Mod

PostPosted: Mon Jan 19, 2015 05:41
by jordan4ibanez
Here's the newest code, now all entities spawn, and the speed is set to max, so whoops lol. :p You can edit it in the .init
You need at least a 7 straight of track for it to move :)
tar.gz
.zip

Re: My Train Mod

PostPosted: Mon Jan 19, 2015 06:32
by jordan4ibanez
Here's a new video guys!
http://youtu.be/AU_6PdEjQ4Y