User Tools

Site Tools


dev:proposals:door_indexes

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
dev:proposals:door_indexes [2023-01-17 14:44]
evictionbot Evict 56independent
— (current)
Line 1: Line 1:
-====== Door Indexes ====== 
-Add a system of choosing which doors to open on a train. 
  
-===== Situation and problems ===== 
-Currently, all doors change on a train when given a command to change door state, but this may not be the intended behaviour in a short station. 
- 
-For a real-life example of needing to choose doors, take the [[https://youtu.be/_WosYRVYMEM?t=135|DLR]], where some stations are too short to accommodate the full length of the train. To open doors on carriages not aligned to the platform would be very dangerous as bleary-eyed commuters with their eyes on their phone would fall onto the track and may: 
- 
-  - Suffer serious injury by contact to track surface 
-  - Be electrocuted by contact with the third rail  
-  - By killed by a passing trains 
-  - File a lawsuit for any of the reasons above. 
- 
-===== Solution ===== 
-The problem above is very serious and could lead to a lawsuit causing a Minetest server to be taken down for not caring for its players. As such, 56i proposes door indexes. A simple addition to an ATC command can help prevent needless death. 
- 
-When writing a door command, optionally an index can be added, which has two units: Carriages (C) or metres (D). The index and unit go side by side. 
- 
-Take for example the command ''OL20D''. This instructs the train to open the Left doors until index 20 in metres. This means, in other words, all doors on the train open left until 20 m down the train, where the doors are not changed from their current state. 
- 
-Keeping a door command on its own (''OL'') acts upon the entire train, ensuring backwards compatibility. 
- 
-The carriage index is similar to the distance index, but acts upon carriage numbers, opening doors until a specific carriage down the train. 
- 
-===== Station Tracks ===== 
-Station tracks are tightly linked to this proposal. Station tracks often control the doors, and it is prudent to modify them. 
- 
-Station tracks issue an ATC command to open the doors, but check the number of platform nodes opposite of the track direction and use that as the distance index to act upon. The command is ''OCOxyD'' for the opening doors part, where x is the side and y is the number of platform nodes.  
- 
-===== Possible Implementation ===== 
-Here is one possible algorithm for the door index: 
- 
-  - Begin at the front of the train 
-  - Repeat this: 
-    - Measure the length of a model and add it to variable x 
-    - If x surpasses the door index, stop counting 
-    - Measure the amount of times this happened in y 
-  - Open doors until y carriage index 
- 
-This relies on a carriage index algorithm existing, but this should be relatively simple to implement by copying some code and writing some others, given that trains need to count their carriages for the ''train_length()'' LuaATC command. 
- 
-==== 2022-08-07t16:49+0000, orwell ==== 
- 
-Advtrains has the functions and tools required to implement the position lookups you describe. The main issue (and also the reason why we don't have doors opening on both sides) is how the door opening/closing animation actually works. 
- 
-3D models can include animations that are indexed by "animation keyframes". The current models have 4 separate animations: 
-  * Open left doors (with right doors closed) 
-  * Open right doors (with left doors closed) 
-  * Close left doors (with right doors closed) 
-  * Close right doors (with left doors closed) 
- 
-To implement your proposal, we would need more animation definitions for all the individual doors opening and closing. In the best case, we combine this with both-sides door opening. If someone can come up with a good way to solve this (e.g. an animation auto-generator, separate object for the doors etc.) then this makes sense. 
- 
-On the other hand, limiting the door opening on a per-wagon basis would be no major issue to implement. 
- 
-=== 56independent. 2022-08-07t20:16+0000 === 
-Maybe an overhang carriage opens its doors under carriage index mode, and a carriage refuses to open its doors under distance index mode. 
- 
-However, my [[http://56i.duckdns.org/blog/#The%20Hobby%20Cycle|hobby cycle]] is not tuned to programming (and may not be for a long time) so programming this feature would be exhausting and a waste of energy which could be spent on other things which would come about faster.