Posts Tagged ‘Software’

Transition curves and superelevated track created using the Object Bender tool, and Cross-City South v2.0 progress update

Posted by Anthony_B on September 5, 2010 at 07:30

Railsimroutes LogoI’ve been doing some more work on Cross-City South v2.0 during the past couple of weeks or so, and I’ve been making good use of odakyufan’s new Object Bender tool, where incidentally, the code was so well written and the functionality comprehensive enough, that Object Bender has been made into an official openBVE tool. Please see the new Object Bender section on the official openBVE homepage for more information: Developing for openBVE: Object Bender.

The output from the tool is such, that I’ve decided to replace all the curved track objects used in the Cross-City South route with new objects generated by Object Bender (from a set of “template” objects which form the intial segment in each type of track – please see here for an example of what I mean), and later I’ll do the same with Watford Junction to Rugby, too. I had already manually created a full range of suitable UK style track objects incorporating cant, as well as objects to be used in transition curves, however these objects had one rail lowered and the other raised in height, to suit the cant model used in older versions of openBVE (therefore enabling the wheels to be visibly touching the rails at all times in earlier versions). openBVE v1.2.7.3 features an improved superelevation model however, where one rail is raised above the other (which remains at the same level), so the existing objects were no longer so suitable.

I had started to make some progress in manually modifying my existing objects, however Object Bender has now saved me many days of work, possibly weeks, thereby preserving my sanity and enabling me to easily generate a much more comprehensive range of superelevated track and transition curve objects to create some very nice results, even better than what I’ve shown in Watford Junction to Rugby for a long time now. The slight downside is that the generated objects have a larger filesize compared to the objects I’d entirely hand-written, however Object Bender’s command line arguments also let me automate and recreate many hundreds of track objects, from a handful of source objects, with great ease via shell scripts. This benefit is simply too good to pass up – if I decide that I want to improve or alter my depiction of track in future, all I have to do is edit the handful of template objects and I can recreate the entire library of track objects with just a double-click. An example batch file for Windows users, based on the one which I’ve written for myself, can be found below, along with a sample shell script for Linux users too.

Here’s a selection of screenshots to demonstrate what nice results can be gained quickly, thanks to Object Bender and a little object building skill:

Screenshot Screenshot Screenshot Screenshot Screenshot
Birmingham Cross-City South v2.0 with superelevated track and transition curves, created via
odakyufan’s Object Bender tool. Also note the embankment (dike) with curved cable trough
in the last screenshot, with the vegetation handled via Object Bender’s /a command-line
argument (please see the Object Bender documention for a tutorial).

One problem I have encountered during the latest Cross-City South superlevated track upgrade so far, is how to accomodate pointwork (switches) on superelevated curves. There are examples of this at Longbridge, between Northfield and Kings Norton, and just after Kings Norton, too. On Watford Junction to Rugby, I took the easy option and handled such situations by transitioning back to uncanted track on either side of points (only with the visual representation of the track – the cant applied via the .Curve command remained constant throughout the points). With Cross-City South v2.0, I’ve decided to gradually alter the height of the other tracks leading towards and away from crossovers connecting superelevated tracks instead, while also rotating the point objects around the Z-axis. This way, the crossover itself is superelevated to the same degree as the tracks being crossed between, which looks better visually, and I presume it’s also more prototypically accurate. Here’s an example between Northfield and Kings Norton, with some new custom pointwork objects I’ve been working on for this location (amongst others):

Screenshot Screenshot Screenshot
Birmingham Cross-City South v2.0 with superelevated track and custom-built crossovers.
Note the clamp-lock point machines, too.
Note: For those of you familiar with the real Cross-City South, please be aware that these screenshots depict the line prior to the recent track renewals on the real-life route. I’ll work on the renewed track (plus such changes as the upgraded 70mph / 112km/h sections beteween Redditch and Northfield), once I’ve sorted out a few more remaining tasks along the route, such as realigning overhead wire objects due to altered curve radii, improving the stations, and finishing the remaining scenery objects which need to be updated with new textures, 3D trees and vegetation.

Object Bender has most definitely made route building easier and more enjoyable for me, however one problem which needed to be solved, was that when a track object is superelevated, the terminating height of the ballast shoulders on either side of the sleepers is also altered. In a route, and depending upon the design of the track objects, this can lead to gaps appearing between tracks running side-by-side, and between the ballast portion of the track objects and dikes (i.e. the embankment beneath the track):

Depending on the design of track objects, gaps can appear
between the ballast shoulder and dike, or a parallel track,
when superelevation is applied via Object Bender.

I’ve solved this problem, by expanding the ballast shoulder in the track object to include two faces at increasing angles, such that at the maximum level of visible cant I’ll ever apply in my routes (160mm in my case), no gaps appear and the cable trough isn’t obscured, while I can continue to use only one template object for creating the full range of curved track pieces, at differing degrees of superelevation, via Object Bender. The ballast portions of the dike objects are also extended. This solution does lead to more faces being rendered, but hopefully it’s not too much of an issue, performance wise. Here’s a screenshot:

Extended ballast shoulders in both the track and dike objects,
to remove visible gaps when cant is applied via Object Bender.

Screenshot Screenshot
Screenshot Screenshot
On the left, are the original objects, and on the right, the new versions. Note the custom vertex normals
applied to the ballast shoulders in the last screenshot, to help remove the angled appearance
which might otherwise be visible with certain lighting parameters.

Object Bender supports some markup which can be applied to template objects before they’re processed, for example, to determine the desired texture coordinate shifting in generated segments (please see the Object Bender documention on the openBVE homepage for more information – I think the tutorial is clear enough that I don’t need to explain it further). I was originally going to suggest expanding the supported markup a little, so that Object Bender could be instructed to leave the X and/or Y coordinates of any vertex as it is in the original template object, which would for example, solve the ballast shoulder issue above in an easier way for the object creator. However, I quite like the appearance of the solution I came up with, so I don’t think such a change to Object Bender is too important, but might be nice to have, nevertheless.

Lastly, for more advanced users, or beginners feeling more adventurous, here’s a sample batch file for Windows users, and a bash script for Linux users, which you can adapt and expand if you want to automatically create a range of curved objects using Object Bender’s command line interface, rather than the GUI. There is a simple example of a suitable batch file included in the Object Bender documention, however rather more can be done with batch files/shell scripts. These following example scripts use variables to reduce the amount of duplicated text that you might otherwise need to type, and they also create a logfile which you can read, which is handy if you’re generating a large number of objects, to more easily check for any errors which might have occured during a lengthy object bending batch process.

For the Windows batch file, you need to give it a .bat extension. The text highlighted in red (including the less/greater than characters), should be replaced by any paths or filenames which are appropriate for your purposes. Where <Your_File_To_Append> is concerned, this object file could contain fishplates for example, or overhead wires, which are appended to the object generated in the previous line (please see here for more information). You can see fishplates added to my curved wooden sleeper based track objects in the above Cross-City South v2.0 screenshots – this is how they were appended to the files generated via Object Bender.

Sample batch file using Object Bender to automate curved object creation (Windows users):

@echo off

rem Set variables (paths and extension for all files)
set objectbender_path=<Path_To_Folder_Containing_ObjectBender>\
set exe=ObjectBender.exe
set obj_source=<Path_To_Your_Source_Object_Folder>\
set obj_final=<Path_To_Your_Route_Object_Folder>\

rem Clear the screen and ask user for confirmation
echo Proceed with object creation? This will overwrite any existing files.
echo Press Ctrl+C to cancel, or any other key to proceed . . .
pause > nul

echo Processing files and creating log. Please wait . . .

rem Create a new log file with time stamp
echo ___________________________________ > %objectbender_path%objectbender_log.txt
echo New log [%date% at %time%] >> %objectbender_path%objectbender_log.txt
echo. >> %objectbender_path%objectbender_log.txt

rem Use Object Bender to create finished objects from templates

rem 500m right curve
%objectbender_path%%exe% %obj_source%<Your_Source_File> %obj_final%<Your_500m_Right_Track_Object> /n=5 /s=5 /b=25 /r=500 /g=1435 /u=80 /v=80 >> %objectbender_path%objectbender_log.txt
%objectbender_path%%exe% %obj_source%<Your_File_To_Append> %obj_final%<Your_500m_Right_Track_Object> /a /n=1 /s=25 /b=25 /r=500 /g=1435 /u=80 /v=80 >> %objectbender_path%objectbender_log.txt

rem 600m right curve
%objectbender_path%%exe% %obj_source%<Your_Source_File> %obj_final%<Your_600m_Right_Track_Object> /n=5 /s=5 /b=25 /r=600 /g=1435 /u=80 /v=80 >> %objectbender_path%objectbender_log.txt
%objectbender_path%%exe% %obj_source%<Your_File_To_Append> %obj_final%<Your_600m_Right_Track_Object> /a /n=1 /s=25 /b=25 /r=600 /g=1435 /u=80 /v=80 >> %objectbender_path%objectbender_log.txt

rem 700m right curve, etc. . .

Linux users can adapt the following shell script to make use of Object Bender for automating the creation of multiple files. Your script should be given a .sh file extension, and be made executable (for example: chmod +x The script can be executed from the Terminal prompt by typing, for example: ./ Don’t forget that Object Bender requires Mono to be installed, too.

Important note: Object Bender determines whether a command line argument is a pathname, or another command line argument, based upon whether or not the argument string begins with a ‘/’ character. In Unix based operating systems, this character is the directory separator character, so if you supply a path which begins with ‘/’ (such as /home/username/etc), it will be interpreted as a command line argument which is other than a pathname, and the tool won’t work as expected. You can get around this by supplying relative pathnames (i.e. ../yourfolder/etc), or by using the following modified version of the tool, in which I’ve altered the program to intepret the ‘-‘ character as a non-path command line argument instead (the recompiled executable is temporarily available here, with source code modifications here as well (also requires the official Object Bender source code from the openBVE homepage). The following script assumes the modified executable is being used:
Sample shell script using Object Bender to automate curved object creation (Linux users):


# Set variables (paths and extension for all files)

# Clear the screen and ask user for confirmation
echo "Proceed with object creation? This will overwrite any existing files."
read -s -n 1 -p "Press Ctrl+C to cancel, or any other key to continue . . ."
echo "Processing files and creating log. Please wait . . ."

# Create a new log file with time stamp
echo _____________________________________ > $objectbender_path/objectbender_log
echo New log [$(date)] >> $objectbender_path/objectbender_log
echo >> $objectbender_path/objectbender_log

# Use Object Bender to create finished objects from templates

# 500m right curve
mono $objectbender_path/$exe $obj_source/<Your_Source_File> $obj_final/<Your_500m_Right_Track_Object> -n=5 -s=5 -b=25 -r=500 -g=1435 -u=80 -v=80 >> $objectbender_path/objectbender_log
mono $objectbender_path/$exe $obj_source/<Your_File_To_Append> $obj_final/<Your_500m_Right_Track_Object> -a -n=1 -s=25 -b=25 -r=500 -g=1435 -u=80 -v=80 >> $objectbender_path/objectbender_log

# 600m right curve
mono $objectbender_path/$exe $obj_source/<Your_Source_File> $obj_final/<Your_600m_Right_Track_Object> -n=5 -s=5 -b=25 -r=600 -g=1435 -u=80 -v=80 >> $objectbender_path/objectbender_log
mono $objectbender_path/$exe $obj_source/<Your_File_To_Append> $obj_final/<Your_600m_Right_Track_Object> -a -n=1 -s=25 -b=25 -r=600 -g=1435 -u=80 -v=80 >> $objectbender_path/objectbender_log

# 700m right curve, etc. . .

exit 0

If you need any help with using Object Bender or writing scripts to automate curved object creation, please feel free to ask. 🙂

Updated openBVE developer tools and openBVE v1.2.6.1, upcoming Network West Midlands updates, upcoming Taipei Metro route for openBVE, and server upgrade

Posted by Anthony_B on April 7, 2010 at 06:00

openBVE v1.2.6.1 and updated openBVE developer tools

openBVE LogoopenBVE v1.2.6.1 has been released, which includes a bugfix relating to the Options.UnitOfSpeed command, which could for example, involve an incorrect speed limit being determined when the Route.Limit command is used. Please » download the latest release « if this issue affects you.

Also, when I posted my last blog entry, I forgot to mention that the » openBVE Route Viewer « has been updated. When your route is loaded, you can now simply type in a distance via the main number keys (not the numberpad keys), and hit Enter — the camera will then be moved directly to the location you just entered. This is an immensely useful time-saver.

openBVE RouteViewer v1.2.6.0 with Jump to Track Position feature--click to enlarge

openBVE Route Viewer screenshot — click to enlarge

Also, when you pass a CSV format route or object file as a command line parameter to either Route Viewer or Object Viewer, the tools will now auto-detect whether the CSV file is a route or an object, and load the appropriate tool automatically. Please see the Tools section within the » Developing for openBVE « pages for more information. For developers who haven’t used the command line for opening routes or objects before, it can be done as follows (obviously replace the path and file names according to your own setup):

RouteViewer.exe “<YourDrive>:\YourPath\FileName.ext”
Horizontal Rule

Network West Midlands openBVE updates

Information IconThe » Network West Midlands « (NWM) team have announced some promising updates for the first 2010 release of the route network, which should make some good use of openBVE’s capabilities and features. We can look forward to such delights as random moving traffic on overbridges, moving passing trains similar to what I’ve demonstrated in one of my early YouTube videos, various points of interest, multiple eras, random routing/weather conditions/other features thanks to openBVE’s » $Include directives «, 3D signals, trees and lamp posts similar to those I’ve shown previously, along with the addition of catenary based on my own high detailed Cross-City South OHLE objects throughout the routes, where a very nice job has been done with their implementation. Some excellent new track textures have also been prepared for the route.

Screenshot Screenshot
openBVE / Network West Midlands screenshots — click to visit the NWM news page

Please visit the » NWM website « for more information and screenshots.

Horizontal Rule

Upcoming Taipei Metro route for openBVE

Information IconI noticed some new screenshots of the Taipei Metro Xinbeitou Branch Line, being developed for openBVE by » BVETRT «, and I wanted to mention them as I think they look superb. There’s richly coloured scenery, the detailing of the stations and near-track areas looks fantastic, and the railway infrastructure is very well modelled and convincing. Also take a look at this » YouTube video « of the line as well.

Screenshot Screenshot
Taipei Metro Xinbeitou Branch Line for openBVE — click to read developer’s blog entry
Horizontal Rule

Server upgrade

Railsimroutes LogoLastly, my webhost kindly migrated Railsimroutes to a new, high performance shared server recently, and they also installed the Nginx reverse proxy webserver in conjunction with Apache, which I’ve noticed has increased the responsiveness of the site along with page loading times. The migration went smoothly, but if anyone has had any issues with the site during the last three weeks, please let me know.

High resolution openBVE screenshots and updates

Posted by Anthony_B on October 12, 2009 at 07:39

Thankfully I have more time available now, so I should be able to pick up where I left off and resume development for openBVE. I recently upgraded my computer, and I’m rather pleased with how openBVE and various routes including my own are running on the new system, so I want to share a few more screenshots of how openBVE, Cross-City South v1.4 and Watford Junction to Rugby can run on higher-end hardware, as well as to show some progress being made. I’m working on adjusting the dawn lighting to produce some nice visuals on Cross-City South v1.4, and I’m also experimenting with some higher resolution catenary textures particularly suited to openBVE’s smooth transparency mode, as well as adding some 3D trees to Watford Junction to Rugby to see how the extra detail is handled. Here are some WUXGA 1920×1200 resolution screenshots from openBVE v1.2.2, with full 16xQ anti-aliasing, 16x anisotropic filtering, and with smooth transparency enabled; there aren’t many animated objects visible in these scenes however, so framerates on equivalent hardware (see below) will be a bit lower in the final releases. Some other openBVE add-ons are presented, as well as my own:

openBVE v1.2.2 and X-City South v1.4--click to enlarge openBVE v1.2.2 and X-City South v1.4--click to enlarge openBVE v1.2.2 and X-City South v1.4--click to enlarge
openBVE v1.2.2 and X-City South v1.4--click to enlarge openBVE v1.2.2 and X-City South v1.4--click to enlarge openBVE v1.2.2 and X-City South v1.4--click to enlarge
» openBVE v1.2.2 «, and Birmingham Cross-City South v1.4 with new class 323 and 3D cab (1920×1200)
(London Midland Class 153 externals by » Steve Thomas «)

Horizontal Rule

openBVE v1.2.2 and Watford Junction to Rugby--click to enlarge openBVE v1.2.2 and Watford Junction to Rugby--click to enlarge openBVE v1.2.2 and Watford Junction to Rugby--click to enlarge
openBVE v1.2.2, and Watford Junction to Rugby with 2D and 3D trees (1920×1200)

Horizontal Rule

Amongst the features planned for openBVE 2, are thunder and lightning effects. Early on during the openBVE project I demonstrated rainfall effects and thunder using openBVE 1’s capabilities; while it’s possible to create these effects within a route, I think it would be better to have these effects handled by openBVE rather than the route developer, along with lightning. This is another feature which I’m very much looking forward to, but I wanted to see what kinds of effects could be created anyway, so I did a few experiments. The following screenshots show how I envisage lightning might look on a route like Watford Junction to Rugby in future; the textures require a little refinement as this is just a test, but you get the idea (in full motion, the lightning strikes flicker and the effect looks better):

openBVE v1.2.2 and Watford Junction to Rugby--click to enlarge openBVE v1.2.2 and Watford Junction to Rugby--click to enlarge openBVE v1.2.2 and Watford Junction to Rugby--click to enlarge
openBVE v1.2.2, and Watford Junction to Rugby lightning experiment (1920×1200)
Horizontal Rule

Another openBVE project, the excellent » Chashinai Railway « network, was updated again a few days ago; the 1000 and 2000 series trains now have new plugins catering for ATS-SN as well as ATS-P in the case of the 1000 series train (don’t forget to read the train operation manuals on the website before driving with these safety systems), and both feature photo-realistic 2D/panel2.cfg based cabs with fully working ammeters and slightly dirty windscreens. The rivers found on these routes also demonstrate a good way of implementing moving water, and the new passenger textures, and photo-realistic trees and scenery textures enhance the routes as well. Here are some high resolution screenshots of the routes and 1000/2000 series trains; note the fully working ammeters in the in-cab screenshots (requires » openBVE v1.2.2 «):

openBVE v1.2.2 and Chashinai Railways--click to enlarge openBVE v1.2.2 and Chashinai Railways--click to enlarge openBVE v1.2.2 and Chashinai Railways--click to enlarge
openBVE v1.2.2 and Chashinai Railways--click to enlarge openBVE v1.2.2 and Chashinai Railways--click to enlarge openBVE v1.2.2 and Chashinai Railways--click to enlarge
openBVE v1.2.2, Chashinai Railway (» odakyufan «), and 1000/2000 series trains with working ammeters (1920×1200)
Horizontal Rule

Also, here are a few high resolution screenshots of the recently released » Saijou Line « for openBVE as well, which include various animated objects, night lighting and great atmosphere:

openBVE v1.2.2 and Saijou Line--click to enlarge openBVE v1.2.2 and Saijou Line--click to enlarge openBVE v1.2.2 and Saijou Line--click to enlarge
openBVE v1.2.2 and Saijou Line--click to enlarge openBVE v1.2.2 and Saijou Line--click to enlarge openBVE v1.2.2 and Saijou Line--click to enlarge
openBVE v1.2.2 and the Saijou Line (» «) (1920×1200)
Horizontal Rule

Watford Junction to Rugby, Performance, and *BVE

All of these screenshots were captured on a system with a Core 2 Quad Q9650 CPU (3 GHz), 2GB DDR2-1066 RAM and a GeForce GTX 260 graphics card, running on a motherboard equipped with the P45 Express chipset, and as you can see, even Watford Junction to Rugby runs nicely here, never dropping below about 40 fps in the external view with the class 87 and a 600m drawing distance (achievable with 2 CPU cores in use rather than 4). It will likely run even better with openBVE 2’s renderer, allowing those with slower computers to enjoy some higher framerates too. It’s also important to note, out of openBVE, BVE 2, BVE 4, and the latest pre-release version of BVE 5 (after the route has been converted to it’s new formats), that at the moment, openBVE remains the only simulator that is capable of loading and/or handling Watford Junction to Rugby with the high level of detail and object count it currently has, and openBVE handles the route on a slower Athlon64 X2 4200+ system with a Radeon HD 2600 Pro as well. Incidentally, I can’t assess whether Cross-City South v1.4 would be suitable for BVE 5 yet, as the route is very unfinished and there’s still a lot left to add; of course you’d certainly lose all the dynamic scenery and animation effects, along with the 323’s 3D cab, exterior and passenger views after such a conversion–hence I can say that my priority will remain openBVE. Naturally with Watford Junction to Rugby, I want to focus on openBVE primarily as well, and as the project is taking a long time to complete, BVE 2 and 4 compatibility and detail reduction will now be a lower priority, and I’ll only start on this task after all the openBVE features are finalised and the project is otherwise completed.

Lastly, I’ve been used to using openBVE with a 17″, 5:4 aspect ratio TFT monitor at a resolution of 1280×1024, but now I’ve seen openBVE running on a 24″ TFT with a 16:10 aspect ratio, routes and trains can look magnificent, and I’m highly impressed by the additional immersion which is offered, especially with the 323’s 3D cab. The higher resolution also makes arranging and working with a text editor and openBVE’s development tools much more enjoyable, and it’s also better for working with something like a C# IDE for example, or image editing software. More updates will follow soon.

Upgrade to WordPress 2.8

Posted by Anthony_B on June 20, 2009 at 00:18

I’ve just upgraded from WordPress v2.7.1 to v2.8. Well, actually I backed up the database contents, deleted the previous WordPress installation and MySQL database, and took the opportunity to start again with a fresh installation and then imported the backed up data. As far as I’m aware everything is working fine, but please let me know if you have any problems.