BF 1942: Modding: first train made!

Ask questions, discuss ideas, get answers
exe
Posts: 60
Joined: Wed Feb 08, 2012 10:04 pm

Re: BF 1942: Modding: first train made!

Post by exe »

I figured most of the remaining BF1942 mod devs check this forum so I'll post the train files here.

I made a quick mini-mod of it so you can easily load it into 3dsmax. The locomotive model was made by smig a long time ago, you can dl his free models here: http://www.smig.name/

To keep the train on track I modified fo0k's idea a bit since the train would often derail on the (unrealistic) sharp Vanilla bends. What you see in the mod is about max speed without derailing, if you want more you have to create new wider curves or slow down. Some vehicles have problems crossing the rails, Sherman and PanzerIV go over it at any speed no problem but the T34 is really struggling when you drive very slow.

The most difficult thing was the coupling, I tried a lot of ideas with rocket engines but that usually ended in a disaster. Then I suddenly had a different very simple idea and it worked right away, I'm not very good at explaining stuff so check it out in the code/3dsmax. :)

One thing I have to mention though: There was also a problem that wagons would often unhitch when I started the train after a short stop. Vehicles go into a "sleep mode" when you leave them alone and because of that they ignored an important collision mesh (Train_Puller) which is why I couldn't pull them anymore. I fixed that by adding a rocket engine with 0 torque to keep them always "active". But Rocket engines stop when someone occupies the related PCO or brings the vehicle below critical damage so I had to create a sepperate PCO which cannot be entered. Overall maybe not the most elegant solution but it works.

If you have any questions ask away I'll try to help. :)

btw. you can unhitch the wagons with the up/down keys as train driver.

Download: https://drive.google.com/file/d/0ByT8vo ... sp=sharing

Edit: Train is placed on Stalingrad for testing
Last edited by exe on Wed Dec 04, 2013 4:50 pm, edited 1 time in total.
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: BF 1942: Modding: first train made!

Post by Apache Thunder »

You can probably fix issues with vehicles having trouble crossing the tracks by using the c_CGStaticObjects collision group. This group is unused in BF1942 so adding it to a few things won't have any impact on existing objects in BF1942 that you wouldn't want to be part of this group. Since it's not assigned to any object by default.


Add the track pieces to this group. Then add vehicles to the group that have trouble crossing it. (note that all child objects of the vehicle that have collision physics including the springs, must be added as well). This will allow the vehicles to pass through the tracks without interacting with the collision mesh of the tracks. You can probably tweak it so perhaps only the springs of the vehicle are added to the collision group if you can get the vehicle to pass the tracks without having the entire vehicle in the collision group. But this would depend on how far up the track is in relation to the terrain below it. If vehicles still get stuck you would then have to add the whole vehicle.


Another alternate idea is to add a second invisible object to each track has a ramp collision mesh covering it so that the vehicles can travel over it. Then add the train and all it's parts to the c_CGStaticObjects collision group (along with the new collision mesh ramp type objects) so that the train doesn't interact with the second copy of the tracks that the vehicles use to travel over.

As for folks who want to attach a control point to one of the train cars. It can be done, but be sure that the train car you put it on is not a PCO. I would have to assume it should be possible put rocket engines on things other then PCOs. In fact the whole train car in question could be made into the ControlPoint itself. (vehicle seats and the like could be attached to an invisible PCO with a dummy engine and would have the hold object command to bind that PCO to the train car so that the train car doesn't need to be a PCO)

Since unlike normal static objects, the game tracks their position correctly in multiplayer if they have mobile physics (though I don't know how normal statics behave in multiplayer with mobile physics and network info, I've only tested mobile control points).

The main thing is you can't allow the control point to be tied to something that is removed from the map at round end (like PCOs) or the game will CTD. Because it's not a PCO in this event, it's position won't reset at round end. so it's pretty much wherever someone left it at the next round. Only when the map is reloaded would it get sent back to where it started.

This train system you got working has many possibilities. I have a Mario Kart level from Mario Kart Double Dash ported into BF1942 and have always wanted to make the "cars" that traverse the track in the real game to function in BF1942 as well. Perhaps with this I could make that work. :D
ImageImageImage
I have cameras in your head!
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: BF 1942: Modding: first train made!

Post by fo0k »

Awesome, thanks for posting the info on this, exe. Will take a peek at this later!
exe
Posts: 60
Joined: Wed Feb 08, 2012 10:04 pm

Re: BF 1942: Modding: first train made!

Post by exe »

Apache Thunder wrote: Another alternate idea is to add a second invisible object to each track has a ramp collision mesh covering it so that the vehicles can travel over it. Then add the train and all it's parts to the c_CGStaticObjects collision group (along with the new collision mesh ramp type objects) so that the train doesn't interact with the second copy of the tracks that the vehicles use to travel over.
I actually tried that but I couldn't figure out how to add a second COL01 mesh to an object so I forgot about it. Adding it as sepperate object with the same coordinates in staticobjects.con should work though. Might test that now. :)

I forgot to mention that I included a slightly modified Stalingrad for testing the train.
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: BF 1942: Modding: first train made!

Post by Apache Thunder »

Here's my own spin on your idea. :D



:D
ImageImageImage
I have cameras in your head!
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: BF 1942: Modding: first train made!

Post by Vilespring »

I believe your new mario cart level with ambient cars needs a...
download link! :D

when I think about it, this idea can be used for levels with civilian cars wondering around, for something like a civilian game. (why? debugger could add tanks and make it interesting! :twisted: )
or, trains! :lol:

now, the train. IT IS FANTASTIC! It's better than I could have ever expected! I even did something that deserves a medal!!
I broke it.JPG
that's right, the mighty Vilespring derailed it! :lol:
now, it would be a very good idea to do what Apache said with the collision group and make vehicles not collide with the technical parts of the rail, because I was driving a willy on the tracks, and it went boom. :lol:

EDIT: wait, you cannot use the un-used collision group, because if it is added to all the vehicles to keep them from hitting the rails, the vehicles would go through each other. There would have to be a way to make the technical train only collide with the technical track.
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: BF 1942: Modding: first train made!

Post by Swaffy »

I have a weird idea. Sort of.

Make a tank that follows the rail road thing around the map. Could be a big tank, doesn't matter. Have a bot spawn in it and use the turret but the tank drives itself. It could make a nice game changer. Or it can be used to make a city "patrol" or something. Like a cop car or a military base tank patrol.

I think too much.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: BF 1942: Modding: first train made!

Post by Vilespring »

I kind of like an armored train idea. There needs to be switches to un-lock the full potential of this discovery in large maps. Also, individual cars need to be able to be detached from each other, not just the locomotive.
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
exe
Posts: 60
Joined: Wed Feb 08, 2012 10:04 pm

Re: BF 1942: Modding: first train made!

Post by exe »

That's a great idea Apache Thunder I like it. :)

@Vilespring: OMG my poor train, what did you do? :lol: Yes you can derail it if you really want it but under normal circumstances this shouldn't happen.

It's an easy task to make all wagons detachable, just use the relevant code from the locomotive on the wagons. I didn't do it because I imagine that players on public servers would just use it to mess with their team mates.
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: BF 1942: Modding: first train made!

Post by Vilespring »

exe wrote: @Vilespring: OMG my poor train, what did you do? :lol: Yes you can derail it if you really want it but under normal circumstances this shouldn't happen.
I was backing up, and there was a T34 tank sitting on the tracks I forgot about, I hit it, It got pushed to the side, went sideways (dafuq?) on a static rail car, then it pushed the box car off the tracks. I like the derail mechanics, the mass of the cars can be increased to decrease the chance of derailment, and, just ramming the train with a tank will derail it.
exe wrote: It's an easy task to make all wagons detachable, just use the relevant code from the locomotive on the wagons. I didn't do it because I imagine that players on public servers would just use it to mess with their team mates.
oh. I didn't think about that.

I think it would be a good idea to add a damage modifier code;

Code: Select all

ObjectTemplate.damageMod 1
and the train will be able to run over vehicles!
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
Post Reply