Train physics

Blitz3D Forums/Blitz3D Programming/Train physics

Picklesworth(Posted 2004) [#1]
As I side project to take a break from apoe (I'm into a busywork part), I've been working off of my old dominoes idea. I've come up with a crazy model train puzzle game. The conceptual part is already complete (and it seems very good) and I may talk about it later. For now I'll just say that it is very deep and I can see how to do it.

Now, the first thing that came to my mind is physics. The game is going to be built in a way that tracks can go very high and in crazily loopy trails, but also with a nice physics engine so that trains derail and move properly (and bridges can break in a nice way). So, do you know how to create good train physics using tokamak physics, newton physics, or your own code? I can see with tokamak that the wheel would be a convex hull, but I don't know exactly how well it would react to a train, and if it would derail properly or not.





PS: Oh, I had the adams family in mind for a special mode when I created this :D


Jeroen(Posted 2004) [#2]
I would use joints to cobine each wagon to form a train. Please explain more about your concept, how you control stuff, etc, because then I can get a picture of what you exactly want


Picklesworth(Posted 2004) [#3]
Basically, the trains move at some speed according to signs, you control switches and can override speed if wanted. The puzzles are normally to make a train line that can get cargo from one place to another for a while according to certain time limitations, cargo carrying limits, etc. There may also be many trains at once, probably crossing over the same main line, in which case you would have to get perfect timing to make it work right.

The part I'm confused about for the physics isn't connecting the wagons, but the wheels and engine. How can I get the engine to move using its wheels or some faked method? And then how can I get the wagons to have wheels that hold onto the track sufficiently?


Rook Zimbabwe(Posted 2004) [#4]
Rollercoaster then???

Actually it sounds interesting like a combination of rollercoaster and train... MEGAbullet Trainz et. al.

OK keeping in mind that I am a noob that you have helped.

you are going to need some sort of physics engine to handle gravity + momentum

What about maglev. The rail is like a T and the train could have a bottom like a C to hold the T (you know curl under it and stuff) that way when it went upside down... like in a loop it would hold on and you wouldn't need wheels.

as far as making it go... I have no idea. what makes the game ace cars go is usually +/- Y (I think its Y I haven't looked at my FPS code in a month while I spend time learning arrays!) and usually mousesteering to get the rotation so the object is always pointing straight... if you just had speed and no steering but let the track do the steering then???

You could have little alpha0 entitys and tell the train to steer for the next closest entity once it reaches an entity...

Lame suggestion but I am trying to think about how the designers of race car games get the drivers in the other cars to stay on the track.

Didn't someone ask about that (Race Cars) a little while ago???

-Rook


Mark Judd(Posted 2004) [#5]
Mr. P.

Take a look at my Loco Commotion game - if this is anything like what you are thinking of i'd be happy to e-mail you the source although it is coded in another type of BASIC :)

The original Loco Commotion was bundled with another programming language (on the demo disk) and later was ripped by an eastern european developer who published it through Take Two.

I did get a mention when PC-Gamer reviewed the rip off game though - although they couldn't go as far as saying the idea was stolen - the thieves even kept the same name !

I had thought of re-doing the game in Blitz, but i like your ideas better (i.e. breakable bridges, etc).

Let me know if i can help at all.

cheers

Funky Frank


Barnabius(Posted 2004) [#6]
Hmmm... do I see a friendly face from a long time ago here? Loco Commotion was quite nice game and I still play it from time to time.

Are you still planning to continue with Black 5, Mark? It'll be great to see it done in Blitz.

Barney


Mark Judd(Posted 2004) [#7]
Hi Barney - Black 5 is not dead, its just that there are only so many hours in a day, and M$ pretty much came along at the wrong time for me - never say never for a Blitz version though.
Blokart is occupying 100% of my time at the moment, always better to go with a paying job ....
Do you still speak to Vern ?

Mr Picklesworth - I should clarify, Loco Commotion uses only maths to control the trains, collision, etc and not any physics dll's.

Funky Frank


Picklesworth(Posted 2004) [#8]
Maths are fine with me, as long as the train goes in a realistic way. Everything in the game is probably going to be purposefully unrealistic except for the trains.

Thanks for the maglev idea, rook, I think I'll try that for one of the things you can get.

As for the wheels, I think I know how to totally slack off like no man has done before (though I intend to try more methods than just this). Here's a hint, the decision was affected by the maglev suggestion. I am not going to have a physics object wheel, it will just be an impulse holding the train up and pushing it from many places to simulate a wheel.

I'm still gonna try other stuff though, because that above idea is bound to screw up.

By the way, don't you love it when you can trick the player into doing the thinking for the computer so you don't have to code it? I'm planning to do that sort of thing for finding if a puzzle is complete :D