Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
PROGRAMS
Users launch ORTS with ORTS.exe - all it does is verify dependancies are installed.
This program
appears in Visual Studio as Launcher. Once dependancies are checked, ORTS.EXE
executes MENU.EXE.
MENU.EXE presents a menu for selection of the mini-route, route, and activity. It
also meant in
the future to provide settings for details levels, performance etc. Once a route
is selected
it executes RUN.EXE
The simulator engine contains all the elements for an operational route including
representation
of signal conditions, switch track alignment, rolling stock location and movement,
track paths,
AI logic, physics calculations, essentially everything except the 3d representation
of the objects.
It is intended that the simulator engine could run in separate thread, or even on a
separate computer.
There can be multiple viewers looking at the simulator - ie straight down activity
editor type views,
or full 3D viewers, or perhaps in the future Tower operator's panels etc. The 3D
viewer is
responsible for loading and rendering all the shape files in the
scene. It also handles movement of wheels and other animations embedded in the
shape files.
Main - contains the openning dialog boxes to select a route and launch the
sim
Simulator - contains the simulation processes, including physics, ai etc
3DViewer - contains the code for rendering the Simulator data in 3D on a
users computer
MSTS - contains code for reading and processing MSTS files
Physics - contains rolling stock classes - these files contain only
simulation behaviour - no rendering classes are included
Common - classes common to the others
SCALAR UNITS
- meters are assumed for coordinates
- other scalers must have units appended, ie MpS, N, KG, MpS2 etc to avoid mistakes
- R = radians
See also the info in Coordinates.cs on the coordinate spaces used in ORTS
COMMENTING STYLE
I place a lot of value on having a paragraph or two at the top of each file
explaining what it contains,
how the classes are used, and a few details about the internals. I find this more
useful than embedded
comments in the code so if you have to take shortcuts in commenting, try to at
least provide the file header
comment block.
ERROR HANDLING
ROLES PROPOSED
1 - engineer - in future, number cycles through engineers on train
- arrows move - right - headout, left - head in
- home end, page down, page up - must be stopped while on the ground
2,3,4 - railfans
6 - brakeman1
7 - brakeman2
ctrl left right, moves from car to car
pgdn, on the ground
pgup, on the train , nearest car
home, front of train
end, back of train
5 - passenger
up down, home, end - move along train
- railfan
- pgup - home, end, up, down
- pgdn - on the ground
SIMULATOR
VIEWER
TIME
----
double Program.RealTime
- global static variable representing number of seconds the program has been
running
double Simulator.ClockTime
- class variable representing the number of seconds since 00:00:00 on the day of
the activity, this
clock stops when the game is paused, and runs fast when the game is sped up.
When various objects are updated, they are passed an elapsed time consisting of one
of the following:
struct ElapsedTime
float RealSeconds;
float ClockSeconds;
This represents the elapsed time since that function was last called in both real
time and clock time
units. Functions interacting with the player generally want to use real time, ie
camera motion doesn't
stop when the game is stopped. Functions related to animating game elements, ie
wheels turning, use
clock time.
At a certain point it doesn't make sense to propagate both types of time. For
example, the simulator
classes ( ai, signals etc ) have no concept of real time and work only in clock
time. To avoid errors,
they recieve a float elapsedClockSeconds parameter to eliminate any possibility of
error.
Also there are other classes that receive only a float elapsedRealSeconds
parameter.
Most floating point variables in Open Rails are stored as float's including elapsed
time. But notice
that to avoid accumulated errors, ClockTime and RealTime are doubles. Keep that in
mind if you have
to create variables that store one of these values.
The times always represent the target time of the frame currently being prepared
and rendered.
TRAINCARS
---------
Custom parsers.
Don't even need a parser.