How Route Editor Uses Memory
by Jim Steven, MCSE,
Senior Microsoft Windows Application Developer

Overview

The Route Editor uses Object Linking and Embedding (OLE32) to place objects in the map. This is the same interface you would use to drop an Excel table into MS Word or an Excel Chart into an Excel spreadsheet. The OLE concept was designed to work with a small number of embedded items within a single master document.

The route editor takes this to the extreme. I have some tiles that show the item counts above 3000, so there are more than that many embedded items on my map.

Each time you click an item's properties page, you use a bit of memory to call OLE32AUTH.DLL and in time, that heap memory is used up. The editor starts acting funny. You'll see the whole screen flash when you do things in the editor, or the object list will suddenly stop dropping down.

If you scroll the screen around and jump from tile to tile, the OLE system loads the new tile objects. (That's the delay you experience in a large map when trying to scroll around and it seems to hang for a bit).

If you run out of heap memory but still have program memory, the information being saved may corrupt.

The biggest problem with the Route Editor is that it relies on Object Linking and Embedding and most home users don't have proper hardware to support it. The OLE technology was designed to allow a word processor to display a pie chart in the document. So it was never intended to handle a complex list of items. A route map is a single document with thousands of embedded items. So it's like opening a word processor and pasting in several dozen documents from each program on your computer.

I've not experienced most of the issues our users have had with the program because as a developer I understand the technology know it takes a lot of RAM. I would not run the editor with less than 512 MB of system RAM and I would not run the game on a system with less than 300 MB of system RAM after Windows has started up. I've completed 200+ routes in nine months and lost only one.

My current route shows 1500+ objects per tile (320 tiles total) so that map has over 300,000 shapes on it. I'm maintaining a 12-18 FPS rate in the dense areas and typically see 40-50 FPS elsewhere.

I have many programs on my home systems that cost more than $1,000 each. Using things like AutoCAD and Adobe Photoshop made Train Simulator a simple product to master. Product marketing should have positioned the software differently. At $50 you attract people who may not understand spending fifteen grand for a home computer and need more guidance than users who are familiar with high-end systems.