Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  train signal box simulation advice  (Read 2334 times)
0 Members and 1 Guest are viewing this topic.
Offline BlindMan

Senior Newbie

« Posted 2005-10-10 21:37:43 »

hiya all, just singed up to this place  Tongue

I'm developing a train simulation game of a small train network,
It will be from a birds eye view, and the main aim features will be to stop and start the train with the signals, as if you worked in the signal box, and also using the normal signal box controls, be able to shunt a train from one track to another,

1. I'm just wondering I need a good data structure to store each of the few trains (and the various different types of carriages and carts the pull), any ideas on what data structure I use

2.  any ideas on whether i could map the track to a 2d array, that i could then show on screen mapping it to a grid? or would their be a better way in your opinion to display the simulation (tracks and train) on the screen from a birds-eye-view

3.  anyone know of any java train simulations/games, that have been made before that i could have a look at the code, to see in which way other people have gone??

thanks any help is very much appreciated indeed
Offline Eli Delventhal

JGO Kernel

Medals: 42
Projects: 11
Exp: 10 years

Game Engineer

« Reply #1 - Posted 2005-10-24 16:34:55 »

1) Just make your own extension of Object, perhaps a "Car" class. This would contain variables for x/y position, width/height, etc. All of the global ones. Then make its subclasses: FreightCar which could have carrying capacity and stores an Object inside it, Locomotive which would have a speed and would be required to drag other carts, etc. If you were really ambitious you could have real physics, giving every cart a mass, the track friction, and then moving everything using the locomotive's force.

2) Yes, a grid sounds like it is probably the best solution. I envision something like the Brio train sets, where you gave certain pieces you can place to do what you want, like a curved track, and straight track, etc. But if you wanted real robustness you could have Pen tool that let you draw the track (a series of lines), then have the train move with the slope of the line it is currently connected to.

It all depends on how much time you want to spend, but a grid seems like the easiest solution.

See my work:
OTC Software
Pages: [1]
  ignore  |  Print  

EgonOlsen (78 views)
2018-06-10 19:43:48

EgonOlsen (58 views)
2018-06-10 19:43:44

EgonOlsen (78 views)
2018-06-10 19:43:20

DesertCoockie (260 views)
2018-05-13 18:23:11

nelsongames (158 views)
2018-04-24 18:15:36

nelsongames (157 views)
2018-04-24 18:14:32

ivj94 (898 views)
2018-03-24 14:47:39

ivj94 (162 views)
2018-03-24 14:46:31

ivj94 (811 views)
2018-03-24 14:43:53

Solater (175 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!