Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (290)
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 1021 times)
0 Members and 1 Guest are viewing this topic.
Offline BlindMan

Senior Newbie





« Posted 2005-10-10 23: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,

now,
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
« League of Dukes »

JGO Kernel


Medals: 39
Projects: 12


Game Engineer


« Reply #1 - Posted 2005-10-24 18: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  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (65 views)
2013-05-17 21:29:12

alaslipknot (74 views)
2013-05-16 21:24:48

gouessej (105 views)
2013-05-16 00:53:38

gouessej (102 views)
2013-05-16 00:17:58

theagentd (111 views)
2013-05-15 15:01:13

theagentd (102 views)
2013-05-15 15:00:54

StreetDoggy (146 views)
2013-05-14 15:56:26

kutucuk (169 views)
2013-05-12 17:10:36

kutucuk (168 views)
2013-05-12 15:36:09

UnluckyDevil (177 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.122 seconds with 20 queries.