Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (526)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
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 1438 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,

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

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  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (73 views)
2014-11-26 15:22:04

toopeicgaming1999 (62 views)
2014-11-26 15:20:36

toopeicgaming1999 (15 views)
2014-11-26 15:20:08

SHC (29 views)
2014-11-25 12:00:59

SHC (27 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (27 views)
2014-11-24 19:59:16

trollwarrior1 (40 views)
2014-11-22 12:13:56

xFryIx (78 views)
2014-11-13 12:34:49

digdugdiggy (56 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org 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‑gaming.org
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!