Author Topic: Current development projects: coding help welcome  (Read 18911 times)

0 Members and 1 Guest are viewing this topic.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Current development projects: coding help welcome
« on: October 07, 2011, 01:29:05 AM »
Here is a list of ongoing, planned and some past coding projects for Simutrans-Extended (i.e., those that have been completed since this list was first started). This post is intended to serve two purposes: (1) to enable discussion of the implementation of these projects; and (2) to give information to people willing to assist with the coding what they might get involved with. I shall update this post periodically with progress on the various projects. If anybody would like to assist with any of these projects, please post on this thread.

I give a brief description of all of the projects below. I have some specific ideas as to how to implement these features, but if anyone would like to help with implementing them, whoever assists might want to put forward an alternative implementation.

Projects marked with [*B] are projects that are balance critical (i.e., those that must be completed before paksets will properly balance, and are therefore considered a priority). Projects marked with [*S] are very simple projects that will not take a great deal of time, and might be suitable for a relatively inexperienced programmer, someone new to the Simutrans code, or somebody with very limited time.

A list of updates to this list with dates is shown at the bottom of this post, although this may be incomplete.

Usage based vehicle maintenance costs [*B]

Another suggestion by Moblet, the idea is that vehicles would cost more per kilometre to maintain the more kilometres that that they have accumulated to simulate the fact that vehicles wear out and become less reliable. It has been suggested that the increase not be linear, but rather follow a "sigmoid curve" (i.e., an S-shaped curve), increasing slowly initially, then increasing more quickly, before slowly flattening out to a cap specified in the .dat files. We need, I think, at least two parameters in the .dat files: the maximum maintenance cost for a vehicle, and the number of kilometres that the vehicle has to travel before reaching that maximum cost.

Vehicle overhauls [*B]

Just as ways need to be renewed from time to time, so do vehicles need to be overhauled. This would represent a recurring large capital cost that would have the effect of making the cost of maintaining vehicles non-constant over their life. The idea would be to simulate only major overhauls, i.e., those that vehicles have only two or three (or perhaps four or five for long-lived vehicles) in their lifetimes.

At its simplest, this could just be dealt with by two figures in the .dat files: an overhaul frequency (in kilometres, not time) and an overhaul cost. The overhaul cost would then automatically be debited after the specified number of kilometres had expired. It would probably need to be a bit more sophisticated than this, however, as players might want to defer an overhaul to wait for the vehicles to be replaced by something better (in which case, overhauling them would be wasteful). There must be some cost to deferring an overhaul, however, or else players would always defer overhauls, and an increased maintenance cost of vehicles overdue for overhauls would seem to be a sensible way of doing that. Also, at overhaul, the vehicles should update themselves to the latest available livery in the current scheme, or, if there are no available liveries in the current scheme, pick a scheme in which a livery is available, and update to that (this should be quite simple to do; I could add this part if that would be easier).

Similar GUI considerations apply to this as to the way renewals.

Convoy re-combination [*B]

Currently, the configuration of a convoy can be changed only in a depot manually by the player, when it is not in service. In reality, convoys (especially railway trains, especially before the late 20th century) frequently change their configuration when in service, for example by changing from a steam to an electric locomotive to travel over an electrified section of track. For reasons discussed here, allowing this to be done is of some importance for game balance.

Quite how to implement this will need careful consideration: it should not be too difficult for players to organise, yet it ought to be realistic. It will have to fit into the new signalling system realistically (perhaps by allowing call-on aspects). The most difficult implementational issues will be semi-automation and scheduling: how should a player control how this works and how much should be partially automated? How will a player control a semi-automated system; how will a semi-automated system work without easily getting stuck/deadlocked?

This could well work in conjunction with a system in which convoys must regularly visit depots for maintenance; a semi-automated system could perhaps then determine that a schedule requires a convoy at a particular time, and assemble one from vehicles waiting for use in the depot according to pre-set rules. This might end up being rather complicated, however, so consideration will need to be given to how and to what extent that this can be made workable.

Depot visits and availability [*B]

Currently, convoys visit a depot only when they are purchased new, when they are retired, when they are manually altered by the player or when the replacer function is used. The idea of requiring regular maintenance in depots (rather than just abstracting the concept as a maintenance charge) has not found favour in the past because this is thought to require too much micromanagement.

However, this needs to be reconsidered on two accounts. Firstly, from an economic perspective, if we are to use realistic maintenance costs (i.e., costs based on historically researched values), the maintenance cost itself will not then take account of the fact that, as well as costing money whilst being maintained, the vehicle also cannot be used to generate revenue during that time. The amount of time for which a vehicle needs to be maintained can vary with how well worn that it is, and can also vary greatly from vehicle to vehicle, as can the degree of decay in this value from new. How much time that a vehicle can be used for revenue earning purposes as opposed to being maintained is known in the transport industry as "availability", and is usually recorded as a percentage. Historical data are available for availability percentages for quite a large number of vehicles. Simulating availability is an important thing to do to achieve a realistic economic balance.

The second account on which the historical reluctance to have depot based maintenance simulated ought to be reconsidered is that there is a sufficiently straightforward yet sophisticated means of simulating this without the need to indulge in excessive micromanagement. Assuming that each vehicle has an availability percentage, the time spent in revenue earning service since the last visit to the depot can be measured (or perhaps the time spent estimated from the average speed and distance travelled), and the time spent in the depot calculated accordingly. For example, for a vehicle with a 90% availability rating that has spent 10 hours in revenue earning service, it would have to spend 1 hour in the depot being maintained once it visited the depot before being released to revenue service again. Maintenance could not be interrupted once it had started.

This mechanism means that players should be freed from the need to ensure that the vehicle is sent to the depot at any specific time, so long as the vehicle visits the depot at least once a year (for example) to prevent players never sending the vehicle to a depot at all. A depot visit could just be a part of the timetable, with a parameter that the depot is to be visited only once in every X times that the convoy reaches that point in its timetable, the convoy simply skipping that entry on other occasions.

This regular call to a depot will then make overhauls, replacements and upgrades much easier, as these can simply be performed on the convoy's next routine visit to the depot rather than (as is currently the case for replacements) convoys going to the depot all at once, which players report can cause considerable disruption and be difficult to manage.

Variation of costs and revenues over time [*B]

A significant economic factor affecting transport (and many other things besides) has been price instability: the increase in the cost of labour over time is the most significant example, but there are others. This has had profound impacts on transport over time: tram networks which had been profitable in the 1910s and 1920s became unprofitable in the 1930s because of the increase in labour costs, and this loss of profit was a great incentive in the switch to trolleybuses, which had much lower overheads, as there were no rails to maintain. Similarly, steam traction on railways became prohibitively expensive to run in the 1950s and 1960s as a result of this dynamic, whereas before the Second World War, it had been possible to run a highly profitable rail network using only steam traction. As a result of the increasing prominence of labour costs in all overheads, the tendency has been over the decades since the middle of the 20th century to buy more and more expensive and sophisticated equipment, which, by virtue of that sophistication, needs less labour to operate; previously, it would have been more economical to have used simpler and cheaper equipment and employed more staff.

Also, inflation itself is a worthwhile thing to simulate: it would be highly unfortunate if a transport company could build up a small fortune in the 1790s with a canal network, shut down in 1830, wait dormant with a treasure trove of cash in the bank accumulating interest until about 1960, and then start an enormous airline. Inflation gives players due incentive to put their capital to good use.

The best way of simulating these things, I think, is to use the existing .tab file system to have a set of time-based (percentage) factors for prices specified in a "prices.tab" file. Without a prices.tab file, prices would work as they do now: being fixed in amount throughout the game, and taken directly from the .dat files, adjusted for the meters per tile and bits per month settings as appropriate. A prices.tab file would contain a line for each type of item (for example, "monthly_canal_maintenance" or "per_km_vehicle_maintenance_diesel") together with comma separated pairs of years and percentage factors. At a percentage factor of 100, the base prices would prevail: at a factor of 200, twice the base price would prevail, and at a factor of 50, half the base price. These values would vary over time according to the dates specified, and would be tapered automatically between the specified points (so, for example, if the .dat file provided, "1750, 50, 1850, 200", the value in 1800 would be extrapolated as 100). There would need to be a new menu item (perhaps grouped with the lists) to show these price factors now, last year, 5 years ago and 10 years ago (or possibly at any arbitrary time between now and the game start date) so that players can see the effect of inflation. Each month, the inflation adjusted prices for each of the various types of price bearing items (goods, ways, vehicles, buildings, etc.) would be recalculated based on the most up-to-date value calculated from prices.tab.

Vehicle replacer enhancements

The current replacer has some unfortunate limitations. A number of things need to be done, I think, none of which are particularly complicated, but which I have not had time to do as yet. Some of these things would impact on depots, too.

Firstly, cascading does not work properly because it is not possible to order out of production vehicles in the replacer even though there might be such vehicles in one's depots somewhere. My idea of how to fix this was, in effect, to combine all the depots so that all stored vehicles available at any one depot of any player are also available at all other depots of that player, and also available for use by the replacer (and shown in the same way in the replacer window as in the depot window, with little white numbers next to the vehicles to show how many stored examples are available). There would then be no need to implement brain-bendingly complicated algorithms to try to work out to which depots that replacing convoys should be sent so as to take advantage of existing vehicles.

Secondly, replacing can cause too much disruption to people's networks as lots of convoys go back to the depot all at once. Two possibilities exist to deal with this. The first, and simplest, is the solution preferred by SDog - remove the requirement for convoys to visit depots at all to replace. This makes things simpler, but might be said to simplify things a bit too much, as buying new vehicles always requires a depot. The other way is to defer replacement of some convoys until others have finished their replacing, either by specifying a specific point in a convoy's schedule of where it should replace (although I anticipate this being tricky from a GUI perspective), or specifying a maximum number of convoys to be replaced at a time. Any of these solutions would be better than the present arrangement, however.

Thirdly, a small change: all convoys with the same vehicles as each other in any order need to be treated as the same, rather than requiring, as now, that the vehicles be in the same order. Finally, there is demand for a feature that allows replacing of all convoys on a line without regard to their composition.

Interaction between replacer and overhauls

If vehicle overhauls are implemented, it will often be the case that it is most economical for a player to replace vehicles just as they become due for overhaul, rather than either overhaul them or replace them sooner. A simple way of doing this would be to have a new replacer option, "replace instead of overhaul", which would mark the vehicles for replacing, but only actually replace them when they were due for overhaul. Careful consideration would have to be given as to how to deal with trains, where one would not necessarily want to replace the entire convoy just because one of the carriages needed an overhaul (and were replacing just one vehicle might not work because of coupling constraints). Various options (such as: replace when any one vehicle requires an overhaul, replace when all vehicles require overhauls and defer overhauls, or replace when the locomotive requires an overhaul) is the only satisfactory way of which I have yet thought of dealing with this, but suggestions are welcome.

Second-hand market in vehicles

Players should be able to buy and sell vehicles from each other. At its simplest, this would simply involve changing the existing "sell" option in the depot window to two options: (1) "put up for sale" and "scrap". "Put up for sale" would make the vehicle available for sale to all other players for either a pre-calculated price or a price specified by the seller. The vehicle would remain in the possession of the selling player until another player bought it, and the selling player could withdraw it from sale at any time (thought would have to be given as to how to list vehicles being offered for sale in the GUI: this will be easier when the depots are pooled, as suggested above). Vehicles sent for scrap would be disposed of straight away, and a small amount (a percentage of the vehicle's purchase price, default 5%) paid to the player. Players could buy second-hand vehicles from the depot or replacer windows by selecting a new option from the "buy/sell | upgrade" menu, "buy/sell secondhand" (alternatively, this menu might be redesigned a little), where all secondhand vehicles offered for sale by all other players would be displayed. They should be shown in whatever livery that they currently have, and the information should include the number of km that the vehicles have travelled, their current maintenance cost (having regard to their level of previous use, as described above) and the number of kilometres to and cost of their next overhaul.

Network optional insolvency [*S]

The current system of dealing with insolvency in Extended was designed with single player games in mind. Proper liquidation, as in Standard, is needed for network games. What would be helpful in this regard is if there could be a third option for the current "allow_bankruptcy" switch: if one sets "allow_bankruptcy=2", then "bankruptcy" (winding up/liquidation) is enabled only in network games, but not in single player games (where it is less useful).

Cost of capital

Currently, players start with a large lump sum of free money. This under-estimates the cost of capital. Players should start either with nothing or a very small lump sum, and have to/be able to take out long-term loans to invest. The exact implementation of this is not so important, and there are many workable ways of doing it. One idea is to have bonds in a similar fashion to Railroad Tycoon, where a company could issue a bond for a certain period of time (say 1 year, 2 years, 5 years and 10 years, with the longer bonds having a higher annual rate of interest) if the company's credit rating was sufficiently good (some consideration would need to be given to how to calibrate this: poorer credit ratings should result in higher interest rates, and, if sufficiently bad, no bond issuing at all - new players should start with a moderate credit rating, such that they are able to borrow, but at fairly high rates), and would have to repay it in a lump sum at the end of the period. Another possibility would be a simple bank-loan, repayable in instalments starting a month after the loan is taken out (or perhaps with a three month repayment holiday) - this might be easier for a player to budget for.

Some careful consideration would have to be given to the GUI for this, as there would be quite a bit of loan/bond specific information to display: the number of loans taken out/bonds issued, the dates first taken out, the dates of repayment, the rate of interest, a control for borrowing more, a control for repaying early (at a penalty, perhaps), and so forth. A new dialogue box would probably be needed, accessible by pressing a new button in the finances window. The cost of loan/bond repayments would need to be represented by a new graph in the finance window.

Another issue is how to set a credit limit for a newly formed company or one that has not traded for very long. One good idea is to make this in part dependant on the weighted (by net wealth) aggregate success (measured by profit as a proportion of assets per annum) of other existing transport companies that have existed for some time (if available). This would have several features: it would allow players entering multi-player games late to displace dominant players more easily (as they would have access to more capital if a dominant player were very large and very profitable), and would also replicate to an extent the railway and canal manias of years past. If recent insolvencies were also taken into account negatively (weighted again by net wealth), it would also emulate the converse. There should be a minimum, however, below which the amount of credit available to a starting player will not fall, which should also be the default when starting a new map without other players.

Takeovers, mergers, insolvent administration and solvent liquidation

Although I don't think that implementing a stock market is a good idea (Simutrans has a different focus to Railroad Tycoon), allowing a simplified form of takeovers and mergers is a good idea for multi-player games, I think.

A merger should simply be when two players mutually decide that they wish their transport companies to merge into one, controlled by both players (just as multiple players can simultaneously control a transport company now if they both use the same password, or the account is not password protected). If one player requests a merger with another player, and the other player accepts, then all the assets of both players should become owned by the player with the lowest player number, the higher number player should be reset to a neutral state, and either password used to access either of the two previous companies should be useable for the new company (or, alternatively, if it is not feasible to have two passwords for one company, all clients playing as both merging companies should be sent a game message showing a new password which will in future apply to the new, merged company).

A takeover should occur either by mutual agreement, in the same way as a merger (except that whichever player is taking over the other player retains its identity even if it has the higher player number, and there is no change of password), or when a company is in insolvent administration.

A company should be in insolvent administration for a fixed period set in simuconf.tab (default: one year) instead of being liquidated whenever it is insolvent ("bankrupt" in Simutrans-Standard terminology). Within that time, it can be taken over as a going concern by any player (who will take on all of its assets and liabilities), or liquidated at the end of the period. There should be multiple options for liquidation, selectable in simuconf.tab: full liquidation, in which all infrastructure simply disappears, but vehicles are placed on the secondhand market (see the feature description above) for a fixed period (default: 1 year), after which they will be withdrawn, presumed scrapped; mothballing liquidation, in which vehicles are placed on the secondhand market as before, but the infrastructure is replaced by mothballed equivalents (see the mothballing feature above - some consideration will need to be given to what to do with stations - have a system for mothballing them, perhaps; preserve them as they are, or remove them?); and nationalisation, where the infrastructure is taken over by the public player (vehicles again are sold on the secondhand market).

The idea of solvent liquidation has been proposed: this would allow players manually to liquidate all of the assets of their company instantly (perhaps mothballing all ways and placing all vehicles on the secondhand market and/or scrap them - consideration will have to be given to whether the player should be given a choice in this and, if so, how to exercise it) and retain the identity of the company and all of the cash in its bank account as well as the cash from selling assets. This should probably only be possible where the company is balance sheet solvent (i.e., has a net worth of greater than zero).


Private road traffic simulation

Note: This feature will need more careful consideration following investigation some years ago into the performance impact of this on larger maps: see here for a description of the problem and a discussion of the solutions.

This will be a particularly large (but also potentially satisfying) project. The idea is to have private cars shown in the game actually follow routes from their origin to their destination, such that congestion along particular routes can more easily be simulated, but without creating so much CPU load as to make the game unplayable. This was discussed here, and the description below is reproduced from that thread.

This idea is loosely based on the way in which the people who made Sim City 4 dealt with the problem of it being too computationally expensive to calculate lots and lots of routes through a relatively complicated network constantly: to have fixed private car routes from specific origins to specific destinations which are updated only periodically.

In the game as it currently stands, unless one turns assume_everywhere_connected_by_road on, the game will in any event calculate routes between each city and each other city, and also between each city and each industry and each attraction, but discard the actual route tiles once the average time per straight line tile for the journey is known. I had considered simply using these routes, but realised that this would not be effective for journeys inside cities, or where cities are close together, such that the distance between two cities is less than, equal to or not much more than distances within the cities.

What would be better would be to have fixed routes to a particular destination cities, attractions and industries stored in tiles individual tiles. Only one route to a particular city (including the city in which the tile is located), industry or attraction can start at any given tile. These routes are renewed periodically, and the particular part of the destination city at which the route ends is selected randomly. The rate of renewal would be set by a parameter in simuconf.tab. Whenever a private car journey is required from a particular start tile (passenger journeys - even in Standard - always originate at a particular building, not station), the system would perform a search of a predefined number of surrounding tiles (the radius being set by a simuconf.tab parameter). If a non-obsolete route is found to the destination city, industry or attraction, then that route would be used. If not, a new route would be calculated. If no route at all could be found, the destination would be marked as unreachable in the surrounding tiles so as to prevent multiple repeated failed searches consuming excessive computational power.

The cars would then all drive along the route to their destination. The number of cars would be based on a reworking of the existing "traffic level" simuconf.tab parameter, which would be reworked so as expressly to become a private car occupancy rate setting, and the number of car journeys adjusted accordingly. It would probably be better for the "traffic" graph in the city then to show only outgoing cars, so that players can more easily use it to tell what proportion of people from that city use the car to get to their destinations (making it comparable with the "transported" and "passengers" graph).

Congestion would be calculated differently to the present system: every road tile would record the time in the current and previous month that road vehicles have been stationery upon it. The congestion in a city would be calculated by adding up all of the values for road tiles within that city and normalising them, probably based partly on constants set in simuconf.tab.

Further, journey times would also henceforth be based on actual recorded journey times by the private cars completing their routes (each would store their journey start times, and would register their total journey time on completing their journeys). For cases in which no private cars have yet completed the particular journey, the time would be approximated in a similar fashion to the way in which it is approximated now. The actual routing mechanism (both for city cars and player vehicles) will take into account the congestion on each tile when calculating the best route. It will probably be possible to create an overlay map, much as in Sim City, showing congestion per road tile as various colours.

That way, congestion will be simulated as accurately as the power of contemporary computers allows: congestion measurements in cities will be based on actual traffic jams, and roads will become congested with actual cars based on their actual usage, simulated accurately. There will be incentive to alleviate congestion along specific routes by upgrading roads (the role of the public player being thus enhanced), and player vehicles will both contribute to and suffer from congestion in a realistic manner.

Waiting time limits and stop facilities

Currently, mail and goods can wait an unlimited amount of time at any stop. Passengers and goods with a non-zero speed bonus will terminate their journey early if they have to wait too long (which prevents infinite accumulations), but the amount of time that passengers will wait has no relationship to the type of stop: passengers will wait as long at an airport as at an unsheltered 'bus stop. Stop extension buildings are available in Pak128.Britain for different types of goods, but the differennces between, e.g. a coal bunker and a warehouse or cattle pen are merely cosmetic.

A good enhancement would be to allow stop and stop extension buildings to specify maximum waiting times for each category (i.e., passengers, mail, bulk goods, piece goods, etc.). This would allow the 'bus stop to be differentiated from the airport terminal. The overall stop would have the highest maxmimum waiting time of the individual tile with the highest maximum waiting time. The path finding system would be modified such that no passengers, mail or goods would be able to be routed over a stop where the expected waiting time exceeds the maximum waiting time. At the beginning of every month, every stop with a waiting time for any given convoy or line that exceeds the stop's maximum waiting time should display a warning message for the player whose stop it is. This would allow differentiation for goods: all basic goods stations, for example, might specify a zero waiting time for livestock, requiring livestock pens (which would have a non-zero waiting time for livestock) to be used in order to handle livestock at the station in question.

Furhter, stop extension buildings (e.g.  hotels, tea rooms, etc.) ought to be able to earn revenue for every passenger that waits in excess of a certain time. This should not be cumulative: i.e., only one wait based unit of revenue ought to be able to be earned per passenger per stop. This should be based on the tile that gives the highest revenue for which the wait time in question is eligible. This should be based on the actual wait time on departure, not the average waiting time for departures for that convoy or line.

Public player finances and taxation [*S]

It would rather add to the game if the public player had a limited budget and a means of raising finances. The best way of doing this is to apply the same credit limit (but not insolvency) rules to the public player as to other players, but allow it to raise money by taxation. Taxation would (1) take a certain proportion of players' profits (discussion is welcome on how exactly "profit" should be measured here); and (2) reduce the growth of all cities on the map proportionate to the rate of taxation levied.

The GUI should be fairly simple: there will need to be a new "tax" graph in the finance window showing (for private players) taxes paid and (for the public player) the tax revenues. There will also need to be somewhere to set the taxes: the player window would be the sensible place. The public player should be able to set the rate, and other players see the rate, but not set it.


Town growth based on local transport

Currently, towns grow based, in part, on the overall number of goods, mail and passengers transported in that town in proportion to that town's demand, as well as the proportion of electricity supplied to that demanded. The actual pattern of growth within a town is based on fixed rules.

What needs to happen in order to have realistic growth and to simulate the historically and economically significant phenomenon of commuter housing being built specifically along transport routes (Metro-Land being the most well known example) is for the places where cities build new buildings and the level to which buildings are built depending on the quality of transport in that specific immediate vicinity, rather than the town as a whole.

To do this, it be necessary to use the success percentages of passengers/mail/goods transported from and to city buildings and factories (this information was always present for factories, and is recorded for city buildings from 11.0 onwards) in two ways: for existing buildings, how far and fast that they upgrade to larger buildings should depend on these percentages, and for new buildings, the higher the percentages of neighbouring buildings, the greater the chance that a new building will be built on the location.

Different sorts of buildings should care about different statistics: residential buildings should principally respond to commuting success rates, as people tend to follow jobs, but also to a lesser extent to non-commuting success rates, as how easy that it is to access leisure (etc.) facilities is of importance to people. Industrial city buildings should respond mainly to the extent to which local industries (that is, actual industries that accept goods other than those which consume but do not produce, which should be deemed commercial, not industrial city buildings) are well supplied, and should prefer to grow near actual industries, but should also respond to a lesser extent to commuting success rates, as it is important that there are enough people to fill the jobs (this should be secondary, as people come to the jobs rather than industry to the people). Commercial city buildings should respond principally to the success rates of non-commuting trips ending in commercial buildings, as commerce needs customers, but should also respond, to a lesser extent, to commuting success rates and the success rates of local end-consumer industries (presumed to be shops) in receiving goods, to ensure that they are well supplied.

Park and ride and car parking

Currently, passengers can use private cars to make complete, but not partial journeys, and, whilst private cars are affected by congestion, there is no attempt to simulate another important economic limitation on private car use, scarcity of parking spaces.

In order to improve the realism of private car transport, it needs to be possible for passengers to make private car journeys from their origin to a station equipped with car parking facilities, and then continue their journey by player transport (aircraft, train, bus etc.). There also needs to be some simulation of car parking scarcity.

A way of implementing this is to start with the car parking scarcity feature: a destination building (i.e., an industry or a commercial or industrial city building) should have a limited number of car parking spaces available per month. When more cars have reached that building as a destination in that month than the building has internal car parking capacity, no more private cars should be able to make a direct route to that building until the next month. This simulates buildings' in-built car parks. This number should be set in the pakset for each building: larger or older buildings might well have no car parking space, whereas smaller or medium sized newer buildings (or buildings such as large factories) might have generous provision. Care will need to be taken to design a system to prevent private car journeys all being made at the beginning of the month when parking spaces are available - consideration will have to be given to some sort of offset allowing rolling resetting of car parking data rather than doing it at the beginning of each month. Consideration should also be given to a town-wide setting to allow street parking: this would give all buildings X number of extra parking spaces (where X is a figure that can be set in simuconf.tab) even when they have none built in, but would increase congestion in the town by a set factor, also set in simuconf.tab. This setting should be changeable in the same way as "allow city growth" (i.e., only by the public player in online multi-player games).

A new stop type, a car park (US English: "parking lot") would need to be defined. This would be a sub-class of the current "haltestelle_t" class (which deals with stations and stops). It would be able to be built on its own or as an extension to an existing stop/station. It would have a defined capacity, which would work in the same way as the capacity of individual buildings. Different car parks could be defined with different graphics and different capacities (from small areas of gravel to large multi-storey car parks). A car journey could then be made to the car park and passengers could continue the rest of their journey by foot or by connecting to another form of transport (such as 'bus, train or aircraft).

To the game's internal routing system, road connexions to car parks would be calculated from towns in the same way as they are from towns to other towns. This would give whether any given car park is reachable from any given town, and the journey time per straight line tile from origin to destination. When passengers search for a route, those with access to a private car would search not just local stops, but stops attached to or reachable from any car park connected to the town in which the passengers' journey starts.

Notification of vehicle upgrades [*S]

Currently, the only way of ascertaining whether it is possible to upgrade a vehicle is to go to the depot/replace window and select "upgrade" rather than "buy/sell". This makes it not entirely obvious when an upgrade is available.

It would be helpful if there were a system of notifying a player more easily when an upgrade is available: see the feature suggestion here.

Portals

Currently, players can only transport passengers, mail and goods within the map boundary. Even on extremely large maps, the distances achievable are nowhere near the distances common in international/intercontinental shipping and aviation, which renders of little or no use the vehicles and infrastructure dedicated to such forms of transport. It is not practicable within the computational resources that exist to-day or that will exist in the foreseeable future to expand the maximum map size by orders of magnitude whilst retaining the current level of detail of simulation.

A worthwhile way around this would be to create portals to international destinations on the map's edge. Special tiles, generated randomly at the start of the game (and perhaps added and/or deleted as the game progresses) would act as portals to international destinations. They would produce and demand goods, passengers and mail in varying quantities, and have a notional distance to the actual destination through the portal.

Portals would act as if they were a special sort of stop. The convoys would behave as if they were a stop by stopping at them, loading and unloading at them with their normal loading time, then moving to the next point on their schedule. However, the financial consequences of using a portal would be importantly different to those of using a normal stop. The revenue would be based on the notional distance from the portal tile to the distant destination plus the actual distance travelled based on the time that the convoy would take to complete the remainder of the route at its maximum speed (taking into account its current load, and perhaps with a limit on the speed of supersonic aircraft if the portal tile is on land rather than sea to reflect the fact that aircraft are only generally permitted to travel at supersonic speeds over the sea). A sum would be charged to represent the notional per kilometre cost of travelling that distance and also the notional fixed cost that would have been incurred had the vehicle been in use for the notional part of the journey. Further, a discount would be applied to the revenue to reflect the fact that it was earned more quickly than it would have been had the player had to wait for the convoy to complete its full trip to the notional destination (for example, if the trip to the portal takes 1/10th of the total time that would be taken from the ultimate origin through the portal to the notional destination, the revenue would be reduced by a factor of 10 to take account of the fact that the player can earn the revenue 10 times more quickly, and therefore 10 times more often).  The passengers/mail/goods loaded at a portal, when being unloaded at the subsequent stop, would also have the adjustments to the revenue, as would the vehicle's running costs when unloading at the first post-portal stop.

Note: Because of the very long (nominal) travelling times that would be involved with portals, this would necessitate changing all of the journey time data from 16-bit to 32-bit integers. This would then enable increasing the resolution of journey times from tenths of minutes to seconds.

Request stops for road vehicles and trams

Currently, all vehicles stop at every stop in their schedule even if there is nothing waiting for them there and nothing on board that needs to alight there.

It would be useful, for road vehicles and trams, at least, where request stops are commonplace, to allow a stop to be marked as a request stop in the schedule. A request stop would be one at which the vehicle stops only if, on entering the tile immediately before the stop, there is something on board that has that stop as its next transfer, or there is something waiting at the next stop that will board the vehicle in question. If neither of these conditions were true, the convoy would advance to the next stop in its schedule. This should not be available if the stop is a reversing stop. It should not be possible to specify a request stop as one with a minimum load or to wait for a certain time there.

Road stop improvements

Currently, road vehicles stopping at stops remain in the middle of the road and block traffic. Also, dead-end road stops can only accommodate one vehicle at once, whereas through road stops can accommodate two vehicles at once (one in each direction).

It would be sensible to have road vehicles stopping at through road stops to pull over to let other traffic past them. When stopping at a through stop, a road vehicle should enter a pulled over state (with the same graphical offset as for a vehicle being overtaken), and any other vehicles ought to be able to pass on the road unobstructed. Likewise, any vehicles that are waiting for a stop to be free ahead should pull over in the same manner. This reflects how 'buses and lorries actually behave in reality on wider roads (which are common in towns), and will reduce the congestion that can be caused by stopped 'buses and lorries in town centres. It will also reduce conflict between players in multi-player games.

As to dead-end road stops, it would be useful to allow these to have more capacity than they have at present: at the minimum, they should accommodate two vehicles (one in each "direction") at once, both able to enter and leave independently of each other, but, using similar graphical offsets as for pulling over, one might even consider allowing them to accommodate four road vehicles simultaneously. This would more accurately simulate 'bus terminals and loading bays in reality, and reduce the amount of space that players need to take with road stops in crowded towns.

Low bridges over roads and double decker trams/buses and tall ships/boats

At present, there is a setting in simuconf.tab that either allows or prohibits half-height bridges to be built over ways. Any vehicle can pass under such a bridge if it is built. It would be helpful to allow half-height bridges to be built over roads/waterways, but restrict the sorts of vehicles that may pass underneath them. Only single decker 'buses and short vans, for example, might pass under half-height road bridges, and only canal barges/narrowboats might pass under waterway half-height bridges. This would require a flag in each vehicle's .dat file indicating whether it may pass beneath a half-height bridge or not. Consideration will have to be given to what is the default option.

Better indication of which vehicle has problems finding a depot [*S]

At present, when a vehicle cannot for some reason find a depot, no indication is given as to which vehicle is having the difficulty. It would be most helpful if such an indication were to be given to assist players in locating problems.

See here for discussion of this feature.

Easier signal replacement [*S]

At present, when replacing a signal or roadsign, it is necessary to delete it and then add another. It might be easier if it were possible to replace a signal or road sign in a single step, by CTRL+clicking on the old sign/signal with the tool for the new signal selected: this should work in the same way as if the player had first bulldozed and then added the new sign/signal except that it should check the cost of both first and only demolish/remove if the player can afford both steps combined.


Completed projects

These are projects formerly listed on this thread that have now been completed. The descriptions are included here for reference only. Note that there may well have been substantial changes between the design for the features being specified and being implemented, so the descriptions below may not be an accurate description of how the feature was implemented.


Realistic correlation between town size, town population, mail and passenger generation [Incorporated in version 11.0 and later]
Currently, the relationship between the amount of space that towns and cities occupy on the map, their population size and the number of passengers and amount of mail that they generate is unclear and not grounded in reality.

It would be very helpful to recalibrate these things (preferably by re-coding so as to allow for these relationships to be set in configuration files) so that a town of X square kilometres in Simutrans has the same population and generates the same amount of mail and passengers as an equivalent town of X square kilometres in reality.

Serious consideration needs to be given to mail, as the volume of mail has changed over time other than in response to transportation conditions (for example, the introduction of the penny post, the invention of the telephone and the advent of e-mail), with the possibility of having time based demand factors explored.


Revenue based way tolls
[Incorporated in version 10.4 and later]

Standard has recently introduced cost-based way tolls (i.e., charges for using another player's way based either on a proportion of the running cost of the vehicles travelling over the way, a proportion of the cost of the maintenance of the way, or a combination of the both). I should like to add a third option, to emulate the way in which British canals and pre-1948 railways dealt with the issue, by sharing revenues. This is useful, as it will give more incentive for players to co-operate in the joint construction of canals, railways, etc. where each can have a share in the profits of operation.What I'd like to see is a "way_toll_profit_percent" or similar setting in simuconf.tab, and each ware packet on reaching its destination paying the proportion of its gross revenue set in the simuconf.tab setting. The tricky bit will be the calculation of the proportion of different players' lines over which the ware packet has passed on this particular journey leg: either a fixed array or a vector (perhaps a minivec) per ware packet in place of the current "accumulated_distance" parameter, giving the distance per player number since the ware packet boarded the convoy. This could then simply be totalled, proportions taken by dividing each of the player's figures by the total, and revenue apportioned according to the total (plus the percentage figure in simuconf.tab). Some testing would need to be undertaken to ensure that this does not use too much memory. Also, consideration would have to be given as to whether to book the revenues received from this as "revenue" or "way tolls" for accounting purposes.

Running powers [Incorporated in version 10.4 and later]

I am not convinced that the latest changes to Standard to make it easier for players to link their ways together (the new "make way public" tool combined with the "private way gate") are the best way of doing this, not least because, once ways are public, none other than the public player can edit them; the same goes for stations. What we need, I think, is a quite simple system of running powers: without running powers, players would not be able (1) to connect to other players' ways; (2) to stop at other players' stops; or (3) to run vehicles over other players' ways; with running powers, players would be able to do all three. Players would be able to grant and revoke running powers in relation to any other player at will, but, if a player's vehicle is on another player's way when a running power is revoked, it could either be (1) sent to a depot, or (2) be allowed to continue its journey but, once it leaves the other player's way, not return, and have all of the revoked player's stops deleted from its timetable. Some consideration would be needed as to how to implement the GUI for this feature: perhaps a new dialogue, or adding this to the existing "players" dialogue.

Stops/signals/road signs that can be built only underground or only above ground [Incorporated in version 10.12 and later]

It would be helpful for the purposes of developing underground railways were it possible to restrict certain station types to above ground/underground. This way, the cost of building underground can properly be modelled, as well as creating the right appearance for underground stations (as it looks absurd, for example, for underground stations to have overall roofs or flower beds).

The best way of doing this would be to add a flag to the .dat files of objects "allow_underground". If "allow_underground=0" is set, the stop/roadsign/signal cannot be built underground. If "allow_underground=1" is set (which should be the default), the stop/roadsign/signal can be built underground or overground. If "allow_underground=2" is set, the stop/roadsign/signal can be built only underground.

The GUI for this would need to follow the current pattern of dealing with things that can and cannot be built underground: in underground mode, for example, the menu buttons for station extensions are hidden. The same effect would be needed here: in overground mode, only stations/etc. that can be built overground should be shown; in full underground mode, only stations, etc. that can be built underground should be shown; and in sliced underground mode, all stations, etc. should be shown.


Saving player colours [Incorporated in version 10.4 and later]
Currently, player colours can be changed, but cannot be saved or propagated over the network. It would be very useful and satisfying, I think, if players were able to customise their colours in a way that will persist and affect all other players in a network game. This will simply involve loading/saving the primary and secondary colours for any given player, and transmitting those values over the network when they are changed manually by the players.


Way maintenance costs based on use [*B] [Incorporated in 12.x versions]

As suggested by Moblet some years ago now, in order to get paksets to balance properly, the cost of maintaining ways needs to vary with how much that they are used. I had thought of implementing a simple parameter, "cost_per_tonne" in the .dat files, but this might be too linear (the wear caused by a 20t vehicle is more than twice the wear caused by a 10t vehicle, apparently). The simple version would probably suffice for our purposes, although if anyone would like to try to implement a more sophisticated system, that would be good, too.

An alternative, which I am seriously considering, is to link this to renewal (see below). Instead of having a cost per tonne, have a number of tonnes between renewals. Each way tile would collect statistics (and display these in the information window) on (1) the date of first building; (2) the date of the last renewal (if any); (3) the number of tonnes since last renewal (or first building if there has been no renewal); (4) the number of tonnes until the next renewal is due; (5) the estimated date of the next renewal based on a simple calculation from the previous three data; and (6) the cost of next renewal. (Strictly, 4, 5 and 6 would not be stored in the tile, but would be calculated when required for display).

Way upgrading costs [*B]
[Incorporated in 12.x versions]

Currently, it costs the same to upgrade one way to another as to build a new way from scratch. Really, it should cost a fair bit less to upgrade one way to another. What I'd like to do is implement a parameter in simuconf.tab, "way_upgrade_percentage", which would be the percentage of the cost of building a new way that it costs to upgrade an old one. So, for example, if "way_upgrade_percentage=75" was set, upgrading an old way would cost 75% of what it costs to build a new way.

Bridge/tunnel upgrading costs [*B]
[Incorporated in 12.x versions]

Currently, bridges and tunnels and their ways are inseparable. To upgrade the road surface on a bridge or railway lines in a tunnel, one must replace the entire bridge or tunnel at full price. Clearly, this is silly. Ideally, there would be a complete separation of ways themselves from bridges, tunnels and elevated ways. However, that would require fundamental and very difficult changes in the code. An interim solution would be to have "way_only_cost" and "upgrade_group" parameters in each bridge, tunnel and elevated way's .dat file. For renewal (see below) or when upgrading to a bridge/tunnel with the same upgrade group, the "way_only_cost" would be used. When building new or upgrading to a bridge/tunnel in a different upgrade group, the full cost would apply. The default way_only_cost where none is specified would be 1/10th of the base cost for a bridge and 1/20th for a tunnel.

Way renewal [*B]
[Incorporated in 12.x versions]

Connected with the above ideas, and similarly based on a suggestion by Moblet, it should be necessary to renew ways periodically, perhaps after a certain tonnage based in the way's .dat files. Obviously, it would involve painful micromanagement if players manually had to replace every worn-out bit of road or track, so an automated replacer would be needed. The cost of renewing a way would be the upgrade cost, not the new build cost for the way.

An interesting question is what happens when technology has moved on since the way was first built. The way replacer should not renew a way with an obsolete type, so this renewal process would involve an upgrade process, too. At its simplest would be a straightforward formula, such as "if the original way is obsolete, find a non-obsolete way of the same type with the lowest cost of a weight and speed limit not lower than that of the way replaced", or something similar. If we wanted something more sophisticated (which would be good, but not essential), we could think about players being able to specify which ways should be replaced with which other ways, or even pre-emptively upgrade ways (in other words, tell Simutrans to upgrade a particular section of way to a particular type but to wait until the old way needs renewing before doing that).

Another thing to consider is the GUI for this: at its simplest, one could simply have textual information in the way information dialogue. However, it might be good to have, for example, a graphical display of overlaid tile colours to show how close that ways are to needing to be renewed and/or some financial information to show the estimated cost of way renewals in the coming, say, year.

Fully customisable cornering speed limits [*B]
[Incorporated in 12.x versions]

Currently, cornering speed limits are partly fixed in the code, and also partly relative to the cost of existing ways. The former makes them inflexible and the latter makes them prone to the well known cornering exploit of upgrading the way to a better type just on the corners to achieve a higher speed around corners on what is otherwise a cheaper type of way. This exploit would end once the linkage between the base speed of a way and the cornering speed is broken and replaced instead by a system based on the number of degrees turned in a set distance.

Land purchase costs [*B]
[Incorporated in 12.x versions]

Players can buy land, but the price of this is not always added to the cost of building ways and buildings, and the cost is fixed rather than varying depending on the likely value of the land. Ideally, there should be a fully sophisticated land value system based on the same system as used for local town growth (see below), but, in the interim, a simple system based on distinguishing town and country (and the various categories of town, and, for country, the altitude) should suffice. Land costs should consistently be deducted from players when building ways and buildings and credited when deleting ways and buildings. Similarly, wayleaves should be charged when building elevated ways, bridges and tunnels under/over land.

When realistic/local town growth is implemented, a more realistic system for calculating land value will be needed, which will make this more important yet.

Mothballing
[Incorporated in 12.x versions]

It should be possible to have a mothballed way type: one which is free to downgrade from its base way type, but cannot support vehicles. This actually requires only a very minor change to the code: if the build and maintenance cost of a way is zero, it should not be possible to build it except as a downgrade of an existing way. This would prevent an exploit that could otherwise apply, where a player would put down a free mothballed way, then upgrade it (at reduced cost compared to new building) to a usable way. It is intended that genuinely mothballed ways are cheaper to re-instate than it is to build a new way.

Public rights of way
[Incorporated in 12.x versions]

Currently, there is no concept of a public right of way: each way is either owned by a player, in which case that player controls access rights, or it is unowned, in which case all players have access, but any player may bulldoze the way or take it into private ownership, excluding other players. It would be most useful if there were a system of public rights of way, in which the way may be privately owned, built and maintained, but where players may not delete, downgrade or restrict access. Even more sophisticatedly, small diversions could be allowed by automatically checking whether the two disconnected ends of a public right of way that a player tries to bulldoze are connected by ways with at least as good a weight and speed limit as the current way within a certain limited number of tiles (set in simuconf.tab): see here for a discussion - that latter feature was suggested by Isidoro.


Canal and river navigation [Incorporated in 12.x versions]

Currently, canals and rivers are unlimited in capacity, as boats do not take notice of the presence of other boats when moving, making a theoretically infinite number of overlapping boats possible. It would be sensible to make canal navigation like road navigation, in which vessels travelling in the same direction cannot pass through each other, but must wait behind each other. This would more accurately simulate especially the narrower canals of the 18th and early 19th centuries.

Also, consideration should be given to the fact that canal boats would take a very long time to pass through locks; perhaps a "canal with locks" flag could be set on a waterway in the .dat file which would cause vehicles passing along it to pause for a predefined time on every height transition tile.


Railway signalling
[Incorporated in 12.x versions]


Once realistic braking distances are implemented [now completed], it would add much to the operational and economic realism of railways if the signalling could be made more realistic, specifically, with respect to the speed at which trains can travel in light of the drivers' state of knowledge of the aspect displayed by the next signal. In other words, there comes a speed (and it is not very fast) at which a driver cannot see a signal at danger ahead in time to stop for it. Railways have dealt with that by using warning signals ("distant" signals in British terminology, or "pre-signals" in the terminology of many other systems) to tell the driver of the state of the next signal. In modern times, multiple aspect signals have been developed, which combine the functions of a stop and distant signal: the signal will always give an indication of the aspect of the next signal (and possibly the signal after next) unless it is at danger itself. Here is some information on railway signalling practice.


Maximum distance to connecting industry [*B]
[Incorporated in 12.x versions]


At present, industries do not select their connexion partners based on distance. This means that, for example, a dairy in 1750 can connect to a farm thousands of kilometres away, which is entirely at odds with reality, and has been known to give rise in online games to a vast, highly profitable (and rather amusing) intercontinental milk trade. The simplest way of solving the problem is to allow each industry to have a maximum range for other industries to connect to it. Different industries in different eras would then be able to have ha
« Last Edit: February 14, 2017, 12:50:03 AM by jamespetts »
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Assistance sought for specific projects
« Reply #1 on: October 10, 2011, 12:55:14 AM »
I have updated this post to add a few additional features, and also to mark certain features as balance critical and others as simple.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline rsdworker

Re: Assistance sought for specific projects
« Reply #2 on: October 13, 2011, 12:09:47 PM »
looks good

Revenue based way tolls and Running powers sounds good - i like to test those features :)

and also Takeovers, mergers and insolvent administration sound good in single player - if there other players that player created networks so if one of them is bankupt and its should poof away not left behind

and also i like to test those new features

thanks
« Last Edit: October 13, 2011, 04:14:28 PM by rsdworker »

Offline Carl

Re: Current development projects: coding help welcome
« Reply #3 on: February 04, 2012, 03:03:33 PM »
I'm very keen to assist with the simpler projects on this list at some point. Sadly (as with so many things) my ambition outruns my ability, so I'm here to ask for some advice on how to make myself more useful.


Thus far I have familiarised myself with the basic concepts of C++ and am at a point where I can read and interpret a good portion of the Simutrans code at a basic schematic level. (Since I've had plenty of experience reading logical notation and formal semantic notation, this step wasn't too troubling.) But it's a big step from having a basic understanding of the language to being able to contribute to a huge project like Simutrans, and at the moment I feel incompetent to even address the "low-hanging fruit" items described in your post above -- even having digested Prissi's advice here and looked at the doxygen reports.


I'd greatly appreciate any advice on how I might efficiently develop my skills so as to become competent enough to contribute to these projects. Would the best way be to continue to study the Simutrans code and learn how it all works, or instead to spend time working on simpler projects in order to develop an understanding of the language?

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #4 on: February 04, 2012, 03:24:34 PM »
Carl,

your enthusiasm to assist is very much welcomed! Getting started with C++ can be a little tricky, as it is not the easiest language in the world, but I learned C++ specifically for Simutrans, and if I can do it, anyone can!

The best thing to do is to set up a Github branch of the code, and see if you can compile Simutrans-Experimental, then see if you can tinker aimlessly and make arbitrary changes that do what you intended.

Once you have done that, the next thing might be to find a small element of the GUI that you want to improve in some slight way, and see if you can work out how to do that (for example, see if you can work out how to widen the load/save dialogue so that both digits of the Experimental major version number are visible beneath the scrollbar).

Once you have learned how to compile the code and make minor changes that do what you want them to do, the rest will begin to fall into place.

If you're after any more specific help, don't hesitate to ask further!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Carl

Re: Current development projects: coding help welcome
« Reply #5 on: February 04, 2012, 03:35:32 PM »
Many thanks for your advice, James -- that's very helpful! I'm especially pleased to hear that you learned C++ specifically for Simutrans, because I was half-expecting someone to say that couldn't be done.


I've created a github fork, so I'll follow your advice on the GUI changes and check in again when I've achieved something useful!

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #6 on: February 04, 2012, 03:44:42 PM »
Excellent!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline omikron

Re: Current development projects: coding help welcome
« Reply #7 on: February 06, 2012, 03:51:49 PM »
Now that I have finally managed to compile simutrans standard, I thought I should try to do the same with experimental, but I fail, mainly because there are a lot of warnings and fatal errors while compiling - mostly due to 'converting' issues, but also because it can't find bzlib.h.

Do I have to take care that the directory from github is ina  special relation to the standard source directory for MSVC or have I done something else wrong?

omikron

Offline Carl

Re: Current development projects: coding help welcome
« Reply #8 on: February 06, 2012, 03:53:56 PM »
Have you added the location of bzlib.h to the "Library Directories" portion of the "VC++ Directories" tab in MSVC?

Offline omikron

Re: Current development projects: coding help welcome
« Reply #9 on: February 06, 2012, 06:24:52 PM »
Thanks, I've added that. In MSVC 2010, you need to do that for every single project, no longer over properties etc.

However, the warnings persist, having difficulties converting from 'const sint64' to 'uint32' with possible loss of data as well as a singed/unsigned mismatch

I'm sure there is an easy answer to this one, ,aybe someone can hint at it? I haven't done anything programming-related for ages!

omikron

Offline Combuijs

  • Web Team
  • Devotee
  • *
  • Posts: 1386
  • Total likes: 22
  • Helpful: 53
  • Maintainer of maps.simutrans.com
    • Combuijs
  • Languages: EN, NL
Re: Current development projects: coding help welcome
« Reply #10 on: February 06, 2012, 06:34:38 PM »
Anything to do with 64-bits versus 32-bits somewhere in the build options?
Bob Marley: No woman, no cry

Programmer: No user, no bugs



Offline Carl

Re: Current development projects: coding help welcome
« Reply #11 on: February 06, 2012, 06:42:06 PM »
However, the warnings persist, having difficulties converting from 'const sint64' to 'uint32' with possible loss of data as well as a singed/unsigned mismatch

The executable will compile successfully -- and run as expected -- despite the presence of these errors, I think.

Offline omikron

Re: Current development projects: coding help welcome
« Reply #12 on: February 06, 2012, 06:51:40 PM »
Indeed, thanks! My error. Now I can turn to my other duties :-)

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #13 on: February 07, 2012, 12:08:32 AM »
Quote
A man is smoking a cigarette and blowing smoke rings into the air.  His girlfriend becomes irritated with the smoke and says, “Can’t you see the warning on the cigarette pack?  Smoking is hazardous to your health!”

To which the man replies, “I am a programmer.  We don’t worry about warnings; we only worry about errors.”

(Source) ;-)
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline mopoona

Re: Current development projects: coding help welcome
« Reply #14 on: June 06, 2012, 12:15:06 PM »
Does usage based maintenance cost include speed-related costs as well?
Greetings from Düsseldorf

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #15 on: June 06, 2012, 02:38:51 PM »
I hadn't specifically planned to do so - do you think it economically important?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline mopoona

Re: Current development projects: coding help welcome
« Reply #16 on: June 06, 2012, 02:49:29 PM »
Hmm, it depends on the map, I think. If you play on a larger map, you might want to built high speed train routes for example. You will get more money with the speed bonus. To balance this we have to make the costs higher. But I find it illogical that high speed trains should cost more (each km) even when they don't use their potential maximum speed.

A slower vehicle consumes less energy, so I think it would make the game more realistic. But to keep the gameplay simple, you could do it like this:
You specify a "normal speed" for every waytype (or vehicle). Above that normal speed the km-costs rise up linear/to the square with some multiplier. This is just a quick thought how to do it.
Greetings from Düsseldorf

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #17 on: June 06, 2012, 10:42:43 PM »
I'm not sure that this is correct on a physical level, is it? A Ferrari going at 30mph will still do far fewer miles to the gallon than a Mini going 50km/h, even if the top speed of the Ferrari is twice as high as the top speed of the mini.

Also, increasing speed increases the amount of fuel used by unit of time, not necessarily by unit of distance, as each unit of distance is traversed in less time. There are variations in efficiency by speed (ordinary private cars are said to be at their most efficient at about 100km/h), but these strike me as potentially complicated to implement and probably more detail than is needed to get a good game balance.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline greenling

  • Lounger
  • *
  • Posts: 1729
  • Total likes: 2
  • Helpful: 15
  • Simutransarchology it my hobby!
  • Languages: DE,EN
Re: Current development projects: coding help welcome
« Reply #18 on: June 07, 2012, 01:02:07 PM »
Highspeedtrains are expensive!
The highspeedline from Köln to Frankfurt have at the beginning of building be plannning with 4millards Euro.
And as the Highspeedline be finish was with build have the highspeedline be cost 9millards euro!
Opening hours 20:00 - 23:00
(In Night from friday on saturday and saturday on sunday it possibly that i be keep longer in Forum.)
I am The Assistant from Pakfilearcheologist!
Working on a big Problem!

Offline TygerFish

Re: Current development projects: coding help welcome
« Reply #19 on: October 23, 2012, 05:56:08 AM »
I'm having some trouble compiling from source.  Downloaded from GitHub, opened Simutrans-Experimental.sln in VS2010.  Haven't written C++ in >10 years.


The comments by carlbaker/omikron helped me get rid of the header file not found errors -- fixed by downloading the bzip and zlib sources and adding their directories to the "Include Directories" under "VC++ directories" in the project properties.  (Adding to Library Directories actually didn't do anything for me.)


Now I'm getting a bunch of:
error C2664: 'gz[something]': cannot convert parameter 1 from 'FILE *' to 'gzFile'


Looking at the library code, it makes sense... is this not the right place to download zlib? [size=78%]http://www.zlib.net/[/size]

Offline Carl

Re: Current development projects: coding help welcome
« Reply #20 on: October 23, 2012, 07:20:00 AM »
I think the file you want to open for compiling is Simutrans-Experimental.vcxproj. (That's what always works for me, anyway). Do you have any more luck with that?

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #21 on: October 23, 2012, 09:33:51 AM »
Hello, and thank you for your interest in assisting! For Zlib, you need to follow the same instructions as for Standard, which are here; is that not what you have done?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline TygerFish

Re: Current development projects: coding help welcome
« Reply #22 on: October 23, 2012, 12:01:18 PM »
Hello, and thank you for your interest in assisting! For Zlib, you need to follow the same instructions as for Standard, which are here; is that not what you have done?

Ah, thanks for that!  I think I was missing libbz2.lib -- I'd found the OpenTTD package, which had all the other stuff except that.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #23 on: October 23, 2012, 10:13:07 PM »
Splendid!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Lefthand

  • Guest
Re: Current development projects: coding help welcome
« Reply #24 on: December 12, 2012, 07:45:15 AM »
Hi James,

yesterday I was thinking about the "way upgrading cost". I looked into the code and found that, only small changes needed to do this (in wegbauer.cc void wegbauer_t::baue_strasse() around line: 2152, and void wegbauer_t::baue_schiene() around line 2258), and perhaps add the setting to the GUI.

But I found an exploit with this idea. If one builds an unsurfaced road (2.5c per tile) and then upgrades it to the best road (~250c per tile) then he/she will get around 63c discount per tile with the 75% upgrade cost.
187,5+2,5 <-> 250.
I think this upgrade discount should diminish when upgrading to a much better road, but I can not figure out the numbers by myself.  And the discount must not be greater than the original cost of the old road. OR just set the discount to be the cost of the old road?

And I found that the cost of a road downgrade is equal to the cost of the better road. Is it correct, or it is a bug?
(And the cost estimate is very wrong when upgrading. It shows more, about 500c per tile than the actual cost).

Lefthand.

Offline paichtis

Re: Current development projects: coding help welcome
« Reply #25 on: December 12, 2012, 12:11:34 PM »
OR just set the discount to be the cost of the old road?
75% the cost of the old road perhaps ? (seems pretty reasonable this way)

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #26 on: December 12, 2012, 12:16:49 PM »
Thank you very much for your thoughts on this. I have had some thoughts about this myself recently, and come up with a slightly different means of achieving the same thing that avoids the exploit that you describe. Instead of having an upgrading cost, one might have a "forge cost", which is the additional cost of building any way of one particular sort (e.g., any type of road, any type of canal, etc.) on a tile where no way of that sort already exists. This cost would be added to the construction cost of the way itself. When upgrading/downgrading, only the construction cost of the way itself would be charged (except in the case of mothballing, which would be free). Further, building one way parallel to another way of the same type should attract a discounted forge cost (perhaps 1/2) to reflect the fact that, for example, building a double track railway does not cost the same as building two separate single track railways, but costs more than building one single track railway. (I am told by the Standard developers that checking for a parallel way of this sort should not be hard - I posted a thread about it somewhere). I should be interested in people's views on this system.

As for the cost of downgrading, you indeed appear to have found a bug - under the current system, the cost of downgrading should be the cost of the inferior way, not the cost of the superior way.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Lefthand

  • Guest
Re: Current development projects: coding help welcome
« Reply #27 on: December 12, 2012, 02:16:17 PM »
I don't really get this forge cost idea. Is it the "cost of the land"? Or another fix additinal cost when building new ways?

On the other hand, when building a new way, there is  a check in the code, if the land-tile is owned by the player (gr->obj_bei(0)->get_besitzer())
But it seems to be buggy too, because it substracts from the cost, not add to it. (When building, the cost will be negative... and added to the balance, so a negative cost hurting our balance, and a positive cost is good for us). I think we should check whether the landtile is NOT owned by the player. And the next line is checking the cost if it is below zero and set it to zero if true. I think this is wrong too, because the cost is always 0 when we check the land-tile ownership if I remember correctly), then we substract from it, then we set to zero.

By the way the cost will get overriden 5 line below: cost = -gr->neuen_weg_b.... :)

Lh.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #28 on: December 12, 2012, 11:22:44 PM »
The forge cost is not the cost of the land, per se, but an additional fixed cost when building new ways to simulate the additional cost of actually forging a way in a particular place. Building a new road requires much more work than upgrading one type to another. It is that extra work that is represented in the forge cost. The cost of the land can be dealt with separately.

On that subject, I have fixed the over-writing issue that you have found here - thank you for spotting that! The -= is correct, however, as the welt->get_settings().cst_buy_land itself returns a negative number. I pushed the fix to the 10.x branch.

There might be something to be said for reforming the cost of land generally and having that as an additional cost on top of other things for building, as well as having different cost for buying land in town and in the country, and different depending on the size of the town, as well, when the time variable prices system is implemented, having these inflating at different rates. This could be done at the same time as the forge cost. This could also include making it more expensive to tunnel under buildings than roads, a factor which greatly influenced the early London Underground network.

Edit: There is probably also something to be said for greatly increasing the cost of "demolishing" rivers, to represent the cost of putting them in an underground culvert.
« Last Edit: December 13, 2012, 01:45:17 AM by jamespetts »
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

RustyMachnik

  • Guest
Re: Current development projects: coding help welcome
« Reply #29 on: June 27, 2014, 07:16:38 AM »
A man is smoking a cigarette which he got from ecigfiend and blowing smoke rings into the air.  His girlfriend becomes irritated with the smoke and says, “Can’t you see the warning on the cigarette pack?  Smoking is hazardous to your health!”

To which the man replies, “I am a programmer.  We don’t worry about warnings; we only worry about errors.”


It was real good one..But still smoking is not good..But who cares about warning..
« Last Edit: June 28, 2014, 04:07:22 PM by RustyMachnik »

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #30 on: June 27, 2014, 09:49:16 PM »
Welcome to the forums! I do agree about smoking.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline AndrewTraviss

Re: Current development projects: coding help welcome
« Reply #31 on: June 13, 2016, 04:12:04 AM »
Hi, I only just discovered Simutrans and I've been looking for a good open source project to contribute to. With my love of transport simulations this seems like a great choice. It's been quite a long time since the list of projects was updated, but provided that it's up to date, I think that "Usage based vehicle maintenance costs" would be a great way to get my feet wet?

My C++ experience is practically zero, but I've been developing software in a professional capacity for over 10 years, so I'm pretty confident with my ability to ramp up.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #32 on: June 13, 2016, 10:34:17 AM »
Hello and welcome! Thank you for your interest in contributing to Simutrans-Experimental, a fork of Simutrans intended to provide extra depth and realism. It will be excellent to have more contributors.

Are you familiar with Github? The project repository is here. The relevant code is in the vehikel_besch_t::calc_running_cost function in vehikel_besch.cc, which is actually the first function in that file.

There is currently a calculation in there referring to an "obsolescence increase". This mechanism should be replaced with the new mechanism relating to usage based maintenance costs above.

There are a number of things to bear in mind when implementing this feature, as it is a balance critical feature. Firstly, it must be able to be calibrated per vehicle so as to allow pakset authors to calibrate this with some precision, so you will need to add some .dat file parameters (as well as removing the old ones for obsolescence, and dealing with existing .pak files that have what will be the deprecated obsolescence code). Secondly, you will need to set a sensible default for when the pakset author has not specified any usage based increase in the .dat files, which should be realistic. Thirdly, there needs to be a representation in the UI (the depot window and the convoy details window) that this is happening: the latter already shows the obsolescence increase. You will need to think carefully how to represent this to the player clearly without taking more than a very small amount of space in the already somewhat full UI. The existing UI uses the colour DARK_BLUE in places to indicate that vehicles are obsolete in the current system. You will need to remove this, and consider whether to use that colour to indicate something relating to this feature (but that is not an easy translation, as this feature is not binary in the way that the obsolescence feature is).

Fourthly, it is particularly important that this feature integrate closely with the forthcoming vehicle overhauls feature (also on the list, just underneath the increased maintenance costs item). When a vehicle is overhauled, its wear based maintenance costs should reset to something close to (but not necessarily identical to) their as new value. Those two features were always intended to work together. Edit This means that you will need to store kilometres travelled since the last overhaul somewhere (but not simply replace the existing total km travelled odometer).

To give an idea of what I am doing at present, my current work is on railway signalling (I am about to amend the list to show that I am working on that), after which I will be concentrating on a number of the remaining balance critical features, including a feature-set not listed at the time of writing (albeit I am about to add it) but the necessity for which is discussed here) relating to being able to modify convoys automatically other than in depots to be able to achieve railway locomotive changes and the like, which it turns out is a balance critical feature, and also is closely related to signalling, so makes sense to follow on directly from that project. The intention is to aim for a next release in which all of the balance critical features are implemented so that they can be thoroughly tested and that pakset balancing can then get underway in earnest.

As to C++ programming, I do not know what other languages that you have used, but if you are familiar with Java, for example, the main thing to watch out for in C++ is manual memory management. If you are familiar with C, you should know all about that in any event. I should add that I am entirely self taught and have never worked in programming professionally, so you will have a head start on me in any event.

Thank you again for your interest in Simutrans-Experimental - do let me know if you have any further queries or get stuck. (For more detailed discussion of the implementation of this feature, I suggest that you start a new thread: I prefer these discussions to be in public where possible so that others can add things that neither of us have thought of and also so that others can learn from it).

Edit: Incidentally, I now recall that I had thought at one stage that it might be worthwhile to have a system in which convoys have to visit a depot regularly for maintenance. That system would work by not requiring the convoy to visit the depot at any particular time, allowing players to add depot visits to a schedule for convenience, subject only to a long-stop maximum time to prevent players from not sending their convoys to depots at all, but for the time spent in the depot being maintained to be proportionate to the amount of time that the vehicle has spent out of the depot running (or perhaps the distance that it has travelled) using an availability percentage figure, which is set in the .dat files, and which varies depending on how well used that the vehicle is in the same way as the maintenance costs will vary depending on total distance travelled. This is important because it reflects the real life concept of vehicle availability, which is balance critical because has a very significant impact on capital asset utilisation. Indeed, I will re-amend the list now to add this on that account.
« Last Edit: June 13, 2016, 10:57:56 AM by jamespetts »
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline AndrewTraviss

Re: Current development projects: coding help welcome
« Reply #33 on: June 13, 2016, 11:06:26 AM »
Thanks for the quick primer on the relevant code.

I haven't really worked with a manually-managed language before, but I'm at least aware of the concerns that come along with it, and I have access to fellow developers that can help me figure my way through it.

And yeah, I can see that this ties into several other mechanics in various ways. I hope you don't mind if I offer some thoughts on how this will all fit together (I'm also a game designer, as it happens). I'll create a separate thread on the topic with my thoughts.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15553
  • Total likes: 383
  • Helpful: 172
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Current development projects: coding help welcome
« Reply #34 on: June 13, 2016, 11:14:17 AM »
Thanks for the quick primer on the relevant code.

I haven't really worked with a manually-managed language before, but I'm at least aware of the concerns that come along with it, and I have access to fellow developers that can help me figure my way through it.

And yeah, I can see that this ties into several other mechanics in various ways. I hope you don't mind if I offer some thoughts on how this will all fit together (I'm also a game designer, as it happens). I'll create a separate thread on the topic with my thoughts.

Excellent - I shall look forward to your thoughts! Please note that I have added a section above on "Depot visits and availability" that you may want to read before posting the other thread.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.