Archive for September, 2022

Simutrans 25th Anniversary #7: The Simutrans trailer

The new trailer for Simutrans is here! Watch it now!

Schedule of the Simutrans 25th Anniversary Posts
We are getting close to the end of the events of the 25th Anniversary. But before the final event, we will be having a last interview with a very special guest. In two weeks, it will be time for Simutrans OTRP developer, “himeshi”, to answer some questions!


Simutrans 25th Anniversary #6: An interview with James Petts, the Ex-Father

One of the greatest honours an open-source project can have is to generate enough interest so that other people consider making their own versions of it. Simutrans, being a successful open source project, is no exception, and the greatest of those versions is Simutrans Extended (formerly Simutrans Experimental). Today, we will take a closer look at this fantastic fork with the help of his creator, James Petts.

First of all, introduce yourself. Who are you? Where do you live? What did you study? Where are you working or have worked on the past?

I am James Petts, and I live in London. My education and professional life are in the law.

How does a man of law end up doing software development in his spare time?

As with many open source developers, I started work on what eventually became the Extended fork of Simutrans because I wanted to see features in the game that were not present. I remember playing Simutrans in around 2007, shortly after the British railway vehicles had first become available as an addon for Pak128. I enjoyed it, but found that there were certain things that were not quite right for what I wanted.

I remember making some feature requests on the forum, but the developers were not interested in implementing them, so I thought that I could implement them myself. This was in around 2008. They were initially written as patches for Simutrans, intended to be part of the main codebase, but they were not integrated, so I eventually just made my own fork. I think that I had a different idea as to what made a good game than the developers of of the original Simutrans; but also, I imagine that, as I was only just learning C++, the coding quality of my patches at the time was not what it should have been.

Once I had started adding features, I realised that there were more and more that were desirable, and I ended up spending more time developing the game than actually playing it; and the more complex features that were added, the more bugs that needed to be fixed and the more pakset work needed to implement the features.

Has Simutrans been your only experience with open source software development, or have you ever contributed to any other open source project?

Simutrans has indeed been my only experience with open source software. I have briefly contemplated contributing to other things, but I only have the one lifetime to live, and open source development is extremely time consuming.

And what do you devote your life to when not working and doing Simutrans development?

When not working or developing Simutrans, I enjoy photography, baking and railway modelling. The latter has entailed me having a sizeable shed built in my garden for several model railway layouts, and I am also a member of the Model Railway Club in London. As may be anticipated, there is some overlap between Simutrans and railway modelling.

James’ model railway.

How did you know Simutrans? What was your first contribution?

I cannot remember exactly how I came across it now. I think that I was searching for transport based games to play in around 2007, and found Simutrans and thought it interesting; I think that I had considered Open TTD, but this was at a time when only the executable was available, and one already had to have Transport Tycoon Deluxe to play it; had the original Transport Tycoon, but not the Deluxe version, hence could not play Open TTD at the time. Simutrans, however, was available in a full version, so I think that I downloaded that. As to my first contribution; I am afraid that this is now lost to the mists of time and fading memory. This would have been sometime in late 2008, and I think that I wanted to implement something like comfort or journey time based routing, both of which are now long-standing Extended features.

When did you announce that you were making a Simutrans fork?

Initially, I just intended to produce a patch for Simutrans with the various features. This would have been in late 2008. The features were all in one large patch (literally, a .patch file for SVN), which was not the best way of doing it, and I was introduced to Github at around this time by another contributor, I think, so I created a “Simutrans-Experimental” branch on Github I think in around 2009 and added all of my features to this. Initially, the idea was still for the features to be merged into the main Simutrans trunk, but it became apparent after a while that some of my development goals, especially the targetting a higher level of economic realism at the cost of higher complexity, were not consistent with the development goals of the principal Simutrans developers, who tended to favour simplicity and a more synthetic economy, and so gradually the patch became a fork, although some Simutrans-Experimental features were merged into the original version (“Simutrans-Standard”) eventually. However, the “Simutrans-Experimental” name stuck until 2017, when, after discussions with others, I thought that it was time to make it clear that what I was working on was in fact its own game and a distinct fork, rather than just a development/beta branch. Nonetheless, I did not really want to divide the Simutrans community, as both Extended and Standard have a lot in common, and fans and developers of both have more to gain by co-operation than competition. I am very pleased that all of the Simutrans community still shares one single international forum and, latterly, Discord server.

On January 21 2009, James announced that he was working on an experimental version.

What are the core features that differentiate Simutrans Extended from Simutrans Standard?

The core Extended features, I think, are (1) the time based routing; (2) the passenger generation model; (3) passenger and mail classes; (4) the more realistic vehicle physics; and (5) private car transport. These are the features that fundamentally alter how players build networks. The time based routing means that players need to build networks that are time efficient rather than merely having sufficient capacity. It matters when people get to their destinations rather than just whether they get there. If their journey is too long, they may not travel at all, thanks to the passenger generation model. It is not enough to have a single one way circular ‘bus route that covers the whole town – players must build a complex ‘bus network consisting of multiple point-to-point lines that get people where they want to go quickly. If people can get to where they are going more quickly by driving their own car or by walking, they will. If people can get to where they want to go more quickly using a rival transport company’s services, they will. People can interchange between distant stations/stops by walking between them, and can walk long distances to player stops – but would sooner travel from a nearer stop if the transport services take them where they want to go within a reasonable time. It is no longer the dominant strategy to use the most powerful locomotive on every train – balancing power and tractive effort means that different locomotives work better for heavy freight, short distance commuter trains and long distance express passenger trains. Different classes mean that wealthier passengers or mail senders can pay a premium for a faster or (in the case of passengers) more comfortable journey, allowing different modes of transport between the same points (e.g., aircraft, train and coach) to co-exist at different price points. Other significant features that have a real impact on player network design are infrastructure wear and renewal, public rights of way (which links with the private car routing
feature), automatic road connexions to industries and realistic railway signalling. Also worth mentioning, although having less of a direct impact on player network design, is the improved UI (largely as a result of efforts by Ranran in the last two years or so), with lots of very clear and engaging visual presentation of often complex data, and the multi-threading which allows even very large games to work (relatively) smoothly.

What is the biggest challenge you faced when working on Simutrans Extended?

This is not an easy question to answer, as there have been many challenges. From a technical perspective, probably the greatest
challenge was the multi-threading work in 2016-2017. Multi-threading is one of the most technically challenging aspects of computer programming: essentially, one has to manage multiple completely independent bits of the program (“threads”) all working at the same time and potentially reading and writing the same information, and try to stop it all from conflicting with itself and making things go terribly wrong. I had no experience of writing multi-threading code before this, so this was definitely a steep learning curve. It has made a real difference to the performance of the game on larger maps, however, so it is worth it.
Another very challenging thing has been debugging loss of synchronisation errors for the game in its online mode: essentially,
different instances of the game running on several different computers must all do absolutely precisely the same thing or else the everybody will immediately disconnect. Any tiny difference between what one computer does and what another does with respect to the simulation code will cause the whole online game to fail completely. Debugging this sort of problem is much harder than finding normal bugs, because one has to work out exactly where two completely separate computers running the same code can end up diverging. There have been occasions when it has taken six months to find and fix a single bug of this type. I am very grateful for all of the people who have helped with this process over the years. One of the biggest challenges coming up, I think, is doing the full costs balancing. We currently have an interim balance produced by Dr. Supergood a few years ago, which has made the costings make much more sense than they did before, but when we cone to do the final cost
balancing, that will be a lot of work. I have been researching in anticipation of this balancing project for over 11 years; I am just awaiting the balance critical features on which I am currently working before launching into that.

Talking about upcoming challenges, what are the next goals for Simutrans Extended?

The current work on Simutrans-Extended is focussed on the 15.x branch. The focus of this intended major version is implementing all the features necessary for balancing the costs. This is a complex task: the amount of fuel that vehicles use must change depending on how hard that they are being worked; vehicles must need to be maintained regularly and thus not be available for service all the time, but for this to work automatically and seamlessly to avoid the need for constant player supervision; vehicles must be able to be overhauled periodically, at substantial cost, and this also must be partly automated to avoid the need for micromanagement; maintenance costs need to depend on how long that it has been since the last overhaul; overhaul costs need to depend on how many overhauls that the vehicle has already had; staff costs need to depend on what sort of and how many vehicles are in a train or similar (e.g., a train with continuous brakes needs only one guard even if there should be multiple brake carriages); costs need to vary with time according to inflation, and different costs need to vary to different extents with time (the cost of staff, for example, needs to increase at a different rate to the cost of coal, and the cost of oil at a different rate again, and so forth); vehicles need to require refuelling stops; it needs to be possible to lay over vehicles temporarily so as to avoid the need to expend staff cost on them for a low frequency service; and it needs to be possible to break up and re-combine multi-vehicle consists (“convoys” in the Simutrans way of describing things) dynamically.

This is all a very large project; coding work on this commenced in 2018, but stalled shortly thereafter because of the need to resolve some of those very difficult loss of network synchronisation bugs described in the previous answer, and I have only recently been able to recommence this work, having been focussing more on my model railway during the pandemic. Fortunately, we now have an excellent UI developer in the form of Ranran, who is likely to make it much easier to add the UI for these features, and greatly increase the quality of the UI that we get from what it would have been had I done the work myself. This will probably be the largest single set of features added at once, so this is likely to take a long time not just to code but also to test – and then an equally large amount of time to update the pakset (Pak128.Britain-Ex) to balance according to these new features. However, this will hopefully very much be worth it: we currently have only an interim balance, and, to a large extent, the game is the balance.

Although there are substantial additional features in Extended, and the game plays very differently to Standard in terms of network design, the game still plays in much the same way as Standard (and much the same way as Transport Tycoon before it, and myriads of other transport based games, such as the more modern Transport Fever): there always comes a time, assuming that the player should design a successful network, when the player has more money than he or she can spend, and only truly catastrophically bad decisions can bankrupt the player; beyond that point, players are limited by time rather than by money. This is obviously not how any real commercial company ever works (with the possible exception of Apple or Google, but that is another matter), so we need gameplay in which money is always an issue to a significant extent even for players with larger and generally successful networks. By simulating entropy and inflation, as well as some other dynamics, it should be possible for the game to get much closer to a reality based economic balance using reality based figures, although we cannot be sure of how this will work until we actually try it, and there may be need for further adjustment. To my knowledge, no other game has ever tried to simulate transport economics to this depth before.

RanRan’s work has helped to improve greatly the UI for Simutrans Extended

Regarding other transport based games, Simutrans is usually compared with OpenTTD (because both are open source). But while OpenTTD is a huge success, Simutrans has gone pretty much under the radar in comparison – and even more Simutrans Extended. Why do you think players prefer OpenTTD over Simutrans?

It is difficult to know for sure the reason for others’ preferences as that needs more information than I have available to me; I can only guess and the guesses could easily be wrong. Perhaps it has something to do with OpenTTD having what I and many would regard as a more robust open source licence (the GPL, I believe, compared to the Artistic Licence of Simutrans). Perhaps it has something to do with the fact that OpenTTD is more closely connected with a classic well-known commercial game, Transport Tycoon. Perhaps it is because, in its early years, Simutrans seemed to be focussed on the German-speaking market, wheras OpenTTD was focussed more on the English speaking market (note that Simutrans has a higher level of interest in Germany and Japan). It might simply be that OpenTTD acquired a critical mass early on and that that lead into positive feedback.

Compared to Simutrans-Extended in particular, it might be that Simutrans-Extended is more niche and in-depth, whereas OpenTTD is more accessible to casual players. It would certainly be good to broaden the audience for Simutrans and Simutrans-Extended; those who do play it do seem to get a great deal of enjoyment from doing so, but I do not know how many people that there are who are interested in a game that has the singular focus on economic realism that Simutrans-Extended by design has.

Simutrans (Standard) reached its peak in April 2012, when the game was downloaded more than 100.000 times on SourceForge. Since then its popularity has declined slowly but surely. Has this decline affected Simutrans Extended too?

I am not entirely sure as I do not keep download statistics. Certainly, forum activity seems to have peaked in 2012; the early 2010s were a time of rapid development in Simutrans-Extended (or “Simutrans-Experimental” as it was then), but it was less stable at the time. 2012 was the year that the Bridgewater-Brunel server first started, with the large semi-persistent online games that have become the hallmark of Simutrans-Extended play. At the time, the codebase was less stable, and the games were prone to interruptions through bugs that needed fixing, including some of the most difficult bugs to fix, loss of synchronisation bugs, which sometimes took 4-6 months to fix a single bug, during which time the server was unavailable. In more recent times, the game has been much more stable and the hours that people play online have greatly increased. Only to-day, I notice that somebody has started a new Simutrans-Extended server. I am not sure of the total numbers playing Simutrans-Extended now compared to 10 years ago, but, for those who do play, I am quite sure that the experience is significantly better, and suspect that, as a result, people play for longer now than they did then.

Indeed, the playerbase of Simutrans Extended, although smaller than Standard, seems to be also more active. Which do you think are the reasons behind Simutrans Extended players sustained interest?

It is always difficult to answer these questions as I can never really be sure about what motivates other people. One thing that I have seen mentioned on the forums and in the Discord servers by Extended players, many of whom spend many hours nurturing large and highly complex networks in the Bridgewater-Brunel server (and others servers that have been run from time to time) is that there are no other transport games that quite have the depth of Simutrans-Extended. Another factor may well be the servers themselves; I am not aware of any other transport game that has a large, semi-persistent online server and that by itself – the ability to build a successful network in a persistent and stable world lasting over one real life year in which others are striving to do the same thing – may well make the game satisfying in a way that other games are not. I know that Standard also has online servers, but, from what I gather, they tend to use smaller maps and have time passing more quickly, so may not generate the level of personal satisfaction that comes with carefully nurturing a large network gradually evolving over a long time. Also, Extended’s features, especially relating to passenger transport (things such as walking between stops and time based routing), makes it easier both to co-operate and compete in a realistic way with other players, which I suspect makes the world feel more immersive for players.

More generally, one of the reasons that Extended diverged from Standard in the first place was that Extended was intended to have features that added depth and realism at the expense of additional complexity, whereas Standard focussed on accessibility to newer players and simplicity at the expense of depth and realism; that by itself would probably tend to generate fewer, more dedicated players for Extended as compared with Standard.

The Bridgewater-Brunel server is the most popular server of Simutrans Extended.

Is there anything you think current Simutrans Extended is in great need of improving?

Yes – there are lots of plans for improvement. I have written in a previous answer about many of the things that I am working on for version 15.x, such as vehicle maintenance and inflation that are needed to improve the balance. However, after that, the next major thing that needs improving is town growth. Currently, town growth works largely in the same way as Standard with some minor modifications over the years: the whole town grows evenly (and, due to a quirk in the way in which town boundaries are currently set in Extended, in a square) depending on the rates of fulfilment of mail, freight and passengers in the town as a whole. In reality, towns were shaped – literally – by their transport: they were small, compact units before public transport, with high densities in the centres but no suburbs. Commuter railways allowed high and middle wealth residents to live in suburbs centred around stations (termed “Metroland” by the Metropolitan Railway in London – this company also bought land near the stations to sell or rent for a profit once the lines had opened, a practice also common in Japan, I believe), while lower wealth residents still lived near the centre. Then, trams and later motor ‘buses allowed lower wealth residents to live farther away from their workplace. Finally, the mass adoption of the private car resulted in evenly sprawling suburbs for people of all levels of wealth around city centres that had very little in the way of residential buildings.

So, after 15.x, the next major project will be a total overhaul of the town growth system so as to make growth based on local, rather than whole town, transport, for towns to compete with one another for residents (the population increase over time being not dependant on the quality of transport in towns, but rather the best towns attracting the
most residents), towns to be able to shrink as well as grow, buildings to be able to become abandoned, overcrowded or be re-purposed as times change, players to be able to buy buildings in towns and rent them out or later sell them, the occupancy rates and market rent depending on the desirability which will be heavily influenced by transport, towns that grow so as to touch other towns will become metropolitan areas with the consumed former towns becoming boroughs, the overall rate of population growth should be in line with historical figures and towns should finally cease to be square.

Simutrans Extended has changed a lot through the years. When you look at it today, what makes you think?

Simutrans-Extended has indeed changed over the years, and hopefully will continue to do so. In the early years, its original name of “Simutrans-Experimental” was apt, as there were many features that had not been fully implemented in the pakset or fully tested. I think that it is only with the regular use of the Bridgewater-Brunel server from perhaps about 2012/2013 onwards that Simutrans-Extended began to mature. It was always intended to be a realistic and detailed economic simulation, but earlier versions had a lot of anomalies that were only shown up with testing over time and which often required quite sophisticated new features to remedy. That process is continuing as a large number of the currently planned features arise out of testing showing up anomalies, but Simutrans-Extended is certainly more mature and stable now than it was 10 years ago.

If you were to start Simutrans Extended today, would you make anything different?

There is a lot that one can learn from hindsight. If I were to start afresh, I should have rewritten the railway signalling code rather than adapted the existing code for multiple types of signalling, as it has proved to be difficult to debug and maintain. I should not have used an arbitrary number for comfort, but instead had a field for the maximum comfortable journey time (and comfort is likely to change to this in the future). There are many things that started out being done one way that have long since changed to being done another way, and in many cases I cannot recall what the original way of doing things was, where, if I were starting afresh, I should just go straight to doing things the current way. When I started working on Simutrans-Experimental, as then it was, I was just learning C++ specifically in order to work on Simutrans. I have learnt much about coding since then and about modern C++, and if I were starting afresh now, I should like to think that the code that I wrote would be more modular and robust.

Video by James Petts demonstrating how signals work for Simutrans Extended

How is your relationship with Simutrans (Standard) developers?

I think that when what became Simutrans-Extended first started back in 2008, there was perhaps a degree of tension with the Standard developers: I may have given the impression by coding new features that I was expressing dissatisfaction with their work or with their game design choices. My own coding skills were not the best at the time, having learnt C++ specifically to add features to Simutrans and having no professional background in coding, so one of the reasons that some of the features that I wrote in the early days were not added was that the coding quality was not to the standard of Standard. Also, I think that, in my eagerness to promote the new features, I may inadvertently have given the impression that I was trying to take credit for things which were largely based on others’ hard work. Also, I think that forking a codebase can be seen as a somewhat hostile thing to do in some ways.

However, I did not wish to cause any tensions, and I think that the other developers are reasonable people too. I did work to ensure that I gave proper credit to the existing developers for the excellent work that they had done, without which Simutrans-Extended would never have been possible, and to acknowledge that there is nothing inherently wrong with the play style and game design choices in Simutrans-Standard: it is just that different people’s preferences differ, and my preference (and, as it turns out, the preference of a number of other people who play Simutrans-Extended avidly) is for a higher degree of realism and complexity than the preference of those who tend to prefer Simutrans-Standard, which has its own loyal following.

After the brief initial tensions and for most of Simutrans-Extended (and its predecessor’s) 14 year lifespan, the relationship with the Standard developers has generally been good: they have often been very helpful in responding to my questions about how the code works, or even proposing solutions to problems specific to the Simutrans-Extended code (and in some cases have even written fixes for Simutrans-Extended, which is very much appreciated). In turn, Simutrans-Standard has over the years adopted a few features that started life in Simutrans-Extended and that are compatible with the somewhat different design philosophy of Standard, so there is a definite symbiosis. Perhaps most importantly, although there are two forks of the game and many players play only one or the other, there remains one single community: both the International Simutrans Forum and the more recent Simutrans Discord channels are common to both Standard and Extended and the same people interact freely and happily with each other in those channels. This has, I think, been very mutually beneficial for both variants of the game, and we are very lucky in the Simutrans community that we seem to be far less prone to the sort of aggressive and abusive behaviours that for reasons that remain obscure seem so common in online communities dedicated to many other forms of computer games.

Although you did neither start nor were involved in pak128.britain, you choose this pakset to be sort of the default pakset for Simutrans Extended, where new features are implemented first. Why did you choose pak128.britain?

Being from the UK, I had a particular interest in British vehicles and buildings; but, also, and probably more importantly, Pak128.Britain was a new pakset at just around the time that I was forking Simutrans-Extended, and it was being made open source, so there was the opportunity to adapt the sources for the Extended fork, as well as have the pakset be developed in part with Extended in mind (the original Standard maintainers actually added buffet cars and multiple liveries before these features were included in Extended). The only other open source pakset at the time was Pak.64, and I found the graphics too low resolution for my liking; Pak.128 had not been open sourced at this time.

How is the process of creating graphics for pak128.Britain-ex?

The system for creating graphics for Pak128.Britain-Ex was inherited from the original Pak128.Britain. It uses Blender to create simple 3d objects, which are then rendered automatically (with a pre-set lighting orb, intended to represent lighting on a typical British cloudy day) into the requisite 4 or 8 images as the case may be. This was all set up in circa 2006, I believe, by Kieron Green, the original progenitor of Pak128.Britain. It does actually make creating realistic looking graphics (within the confines of a 128×128 pixel set) much easier than they would be if one were pixel painting, not least because a single 3d model will automatically produce all the directional renders. This process has allowed us to create a very large number of graphics over the years to have a very large number of subtly different vehicles, which is one of the hallmarks of the pakset.

What is your favourite pakset? (Excluding pak128.Britain(-Ex))

A challenging question! I think probably the Japanese Pak.256. This is another pakset that has an Extended version: it has excellent high resolution graphics and is evidently curated with much meticulous attention to detail. Simutrans is more popular in Japan than anywhere else in the world so far as publicly available sources show (there is even an annual in-person Simutrans conference in Japan, or at least was before the pandemic), so I am always very interested in the Japanese Simutrans scene.

The Japanese Pak256-Ex is the highest definition pakset ever done

Thank you so much for the interview! Is there anything more you would like to say to Simutrans players?

Simutrans-Extended has been a long journey; there have been very many achievements along the way, but also some frustrations. My own development of Simutrans-Extended is not as intense as once it was as I have other hobbies to compete for my time, as well as a busy professional life, but I still enjoy working on Simutrans when I have the time, and we have some other very dedicated coders such as Ranran who have been doing some excellent work in the last few years. I very much hope that people will continue to enjoy playing Simutrans-Extended for years to come.


Schedule of the Simutrans 25th Anniversary Posts
I hope you have enjoyed this first interview to a non-Standard Simutrans developer. We will keep exploring the boundaries of Simutrans with the final interview next month. But before of that, the next event in two weeks will feature the most exciting creation made to commemorate the Simutrans anniversary so far. Stay tuned!