User Tools

Site Tools


dev:proposals:largetracks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
dev:proposals:largetracks [2021-10-07 21:50]
56independent Add my idea
dev:proposals:largetracks [2022-08-22 05:02]
blockhead no to 15: addendum: rr online
Line 37: Line 37:
 ====== Opinions and Ideas ====== ====== Opinions and Ideas ======
 There will be several ideas and opinons regarding this. They are listed here, at this section: There will be several ideas and opinons regarding this. They are listed here, at this section:
-  * I think that this might work if a different mod is made. That way, server admins can choose between small or large track. This may also work as a setting, which defaults to the regular tracks, to prevent destroying infastructure on existing servers. ~56independent 
  
 +===== 56independent's Opinion =====
 +What i believe is a good option is putting both regular and large track segments in the mod, giving the choice between large track segments and regular tracks. This ensures backwards compatibility with existing rail networks whilst allowing large track segments on new line.
  
 +I also believe that simple junctions should also have their own segments. Building a t-junction is currently a lot of work, and i believe that a single-block spawner would make sense. You should choose between gaps, like 1-void for railyards, 2-void, and 3-void, as well as driving direction, whether it is the same on both sides or different.
  
 +<del>Also, 2-void is for those who like making a pain for themselves and hate ornaments in the centre of track, such as pillars and signal poles</del>
 +===== Blockhead's Ideas =====
 +Sorry about this wall of text, this probably isn't going to get much visibility, but I've been doing a lot of thinking over an extended period and I felt the need to dump it all out.
 +
 +==== Set track ====
 +This idea bears a lot of similarity to orwell's idea as explained above, but I would like to explore some areas.
 +
 +Model railways are pretty comparable to advtrains in a lot of ways. They are both played with for fun, and they both still have sharper curves than most real railways. There are a variety of manufacturers of model railway track for different scales and gauges. These come in pieces that can be snapped together. We could take inspiration from the product catalogues of some of those manufacturers and build our own 'advtrains set track'.
 +
 +This would be quite model-heavy, probably even more so than the current line-up. It would also let us fix the sleepers that sit under the crossings so that they do not overlap. We could also build double slip switches easily (the current space constraints make that quite hard, even if a node was mode for it, and I have a prototype...).
 +
 +An an example of a poor implementation of this kind of system can be found in the Traincraft/Trains in Motion mods for Minecraft. All track blocks start and end on straight, so there are no diagonals like advtrains. The tracks in this mod are as follows:
 +  * Different lengths of straight track.
 +  * Sharp, Medium and Wide 90 degree curves.
 +  * Turnout to two parallel tracks which continue for a long time - can't recall if both left and right-hand turnouts are available. Yards have to be built by chaining many of these and using a lot of space. Also the frog has a huuge gap.
 +
 +Note in particular no diagonals, only wibbly-wobbly - the workaround is you can use their trains on minecart tracks and those have the usual zig-zag that works to travel in a straight line on a 45 degree angle. No diamond crossings whatsoever which means no realistic junctions whatsoever - not even a two-track T-junction is possible.
 +
 +All in all we can only say that the Traincraft system, as directly copied, would be a feature downgrade. A successful //set track// implementation must therefore include everything we already expect from advtrains or more.
 +
 +The set track system would fit into the nodedb format without issue, but the adjacent track node finding code would have to change to accommodate custom adjacent directions per registered node. It still may be worth exploring if it's worth changing the nodedb format - with migration code of course. For example, if the nodedb also recorded the connections that a track node has. This may make pathfinding quicker to compute by removing adjacency calculations; on the other hand, a correct implementation needs to make sure the node's connections are always correctly encoded and updated in the nodedb to match that node's definition.
 +
 +==== Custom curvature ====
 +I want to stress that I don't see this type of system as realistic for the Minetest engine but it's worth exploring it anyway and discussing the challenges with it.
 +
 +Another route would be to take ideas from the  [[https://www.youtube.com/watch?v=hWRu3CUxbzA|Rails Modpack]] for Medieval Engineers, which has custom curvature within limitations of minimum radius and is physics-based.
 +
 +I'm not sure how the medieval engineers engine and this mod work together to store the rail information, but it almost certainly wouldn't be compatible with the nodedb format.
 +
 +Inside the Minetest engine the height at each end of each track segment would have to be an integer, which is quite different to Medieval Engineers' small voxel terrain. I do not think we would realistically be able to support curvature on the horizontal plane and slope at the same time in a track segment with this system.
 +
 +I'm also not how we could put these segments into the Minetest engine with some combination of nodes and/or entities. Nodes can only show a static simple shape, so they would work for straight tracks and predefined slope tracks. We would probably have to use invisible nodes that manage a series of entities. Each entity would be a sleeper or a small section of track or perhaps both in one model file.
 +
 +We have to be careful with entities because (1) they have a serious performance penalty with the current Minetest engine and get_objects_inside_radius (2) if we do it wrong and the entity-track doesn't show the tracks the train is travelling on, players are going to get really really confused. Well, aside from when they already are because the terrain loading often can't keep up on a loaded server so the advtrains track nodes don't show up either. We can all attest that the blocks load before the entities though, given how if you teleport to a railway station you first see the blocks then the trains load, or similarly if you teleport to an animal farm the animals come after the nodes.
 +
 +Visual correctness: The custom curvature system also presents major problems to visual correctness given the features we expect from advtrains of diamond crossings, turnouts and the potential for double slip switches. If we allowed freely placing intersecting curved sections, we would end up with a jumble of sleepers and track that looks like it's going to derail any train that goes over it. I know that in real life diamond crossings almost never cross at exactly 90 degrees, with the exception of trams; the angle between tracks varies quite a lot at different crossings. Intersecting custom curves may also be tricky to check for collision - I will admit I'm not an expert on how collision is currently done in advtrains (for example, I can't answer the question: Will two trains that are too close but moving through unloaded mapblocks actually collide, or only when their Lua entities actually exist?)
 +
 +To preserve visual correctness, we would realistically have to include a static set of all of these components - diamond crossings, turnouts and double slip switches - similar to what we have, also similar to the set track approach. Then at the end of custom curved track sections, the track would have to be aligned at the right angle so that it goes into the component. The track placer would enforce this of course. 
 +
 +===== doxydoxy’s Proposal =====
 +I have explored the possibilities of larger track segments that align to the voxel grid, i. e. the “set track” approach.
 +
 +The currently available 16 angles are fine, they align to the grid every 2m, and are compatible with ''moreblocks'' table saw shapes.
 +But the voxel grid is quite restrictive for the possible curve radii.
 +
 +I have drawn 26.57° and 45° curves in Inkscape, and scaled them up in various sizes, to see which radii fit well on the voxel grid.
 +Of course, no radius fits without some stretching.
 +But stretching is possible well enough even with quadratic bezier curves, so it should not be an issue if the result //looks// fine.
 +
 +I have chosen radii of 5.5m, 14.5m, 18.5m, and 35.5m.
 +(The half metre is caused by straight tracks ending on centers of node edges.)
 +I have drawn turnouts with the 18.5m radius, diamond crossings, and an additional set of “tram tracks”, which use only 5.12m radius and 45° angles.
 +
 +I have also added sleepers to all track segments, and tried to avoid overlapping sleepers as far as possible.
 +Turnouts and crossings use parallel sleepers, aligned to the “more major” axis.
 +Many diamond crossovers and similar track layouts are possible with only parallel sleepers.
 +
 +Because curves now consume more than one node, it is more difficult to do small lateral movements within one track.
 +Two adjacent curves move at least 3m laterally, if this is too much, the lateral movement must be propagated until a single curve is needed anyway.
 +
 +Therefore I found it necessary to add off-center diamond crossings (to avoid the need for lateral adjustments when 26.57° tracks meet), and dedicated S curve tracks.
 +Compared to plain curves and turnouts, the amount of additional nodes is small.
 +
 +{{:dev:core:doxydoxy_smooth_tracks_sketches.png}}
 +
 +The result of my work is now available as {{:dev:core:doxydoxy_smooth_tracks_sketches.zip|Inkscape SVG file}}.
 +To implement these track segments, more than 100 individual meshes need to be created.
 +I think someone should write a script collection to create these meshes.
 +Like this:
 +
 +  - An XSLT or Python script to convert an Inkscape drawing to a numeric description of rails, sleepers, switch blades, frogs, guard rails, and slide chairs. This should probably be divided further.
 +    - Assign roles (rail, switch blade, ...) to individual SVG elements.
 +    - Stitch rail elements together to get a continuous run (switch blade → rail → frog → rail).
 +    - Calculate positions of switch blades in diverged state.
 +    - Calculate positions of slide chairs.
 +  - A Blender Python script to create a mesh from the numeric description.
 +    * Be careful about UV mapping, so all track nodes can use the same texture. (A human could not do this >100 times without mistakes.)
 +    * Make sure to use different materials (texture slots) for rails and sleepers. This will very likely be useful at some time.
 +
 +The script approach allows to change the level of detail later, without discarding a lot of work.
 +For example, someone may think that guard rails and frogs are useless, or that slide chairs are important.
 +
 +==== 56i's Opinion ====
 +Do the tram tracks come without sleepers? I feel that tram tracks should be metal rails driven straight into the ground, as you can see in below reference image (of points at St Peter's Square in Manchester, and some straight sections just around).
 +
 +  * [[https://i.imgur.com/6G1nPU8.png|1]]
 +  * [[https://i.imgur.com/7hJS5zv.png|2]]
 +  * [[https://i.imgur.com/bEEdo1h.png|3]]
 +  * [[https://i.imgur.com/bEEdo1h.png|4]]
 +
 +What i think is a good idea is versions of these rails without sleepers and those with sleepers, for tram systems and ballastless track.
 +
 +==== 15 Degree Track - BreadBox64====
 +I agree with the set state concept, but was wondering what everyone's opinion on 15-degree track is? I think that having 0, 15, 30, 45, 60, and 75 degree track pieces would help make curves look more consistent and allow certain alignments that would look weird otherwise. Considering the scale of these changes, I think integrating 15-degree track would make sense.
 +
 +
 +
 +It gets a no from me due to combinatorial explosion. Adding two more angles of track doesn't just add straight track segments, it adds basic turnouts, y-turnouts and 3-way turnouts at that angle. It also adds diamond crossings that cross each other at that angle. The crossings are a particularly bad problem. According to my calculations there are 28 possible shapes with our current system (though some are omitted due to being too shallow of an angle, so we have more like 20). Angles wouldn't be a problem with a large track segment. But with a 15 degree system, there are 66 different combinations. Diagram:
 +{{:dev:proposals:crossing_combinatorial_explosion.png?200|}}
 +
 +This would increase the amount of time needed to manually make them, making more obvious we should have an algorithm that generates the track shapes. But even if they're made by algorithm, each one adds to the media file size of advtrains, for shapes that maybe nobody will ever see. Finally, it's a block game, not a train simulator: I think we should be content to even have the 30 degree system, since carts don't even really have a true 45 degree system. If you want a good game with voxel terrain and a good track system, try something like Railroads Online, not Minetest.
 +--Blockhead 2022-08-22 02:47 (UTC)
dev/proposals/largetracks.txt · Last modified: 2023-01-17 14:46 by evictionbot