From: Erik V. <eri...@xs...> - 2012-05-31 22:25:42
|
Stefan (and possibly others), Sorry, this is long. I intend to put an even longer version in the Wiki later on. I'm happy to report that I have made quite some progress with the new Stop properties framework, that was discussed a while ago. It's almost ready to be pushed, but I would first like to present its main aspects and reopen it for discussion. I would like to publish it as a whole. This framework is intended to provide maximum flexibility in stop property configuration, on many levels. It is also intended to address the following requirements and bugs: - 1837: the need to assign different types to different stops with different properties on one mine tile. - 1835: the Berlin loop bug, also relevant to 18EU. As discussed, Stefan's existing method is not maintainable. - 1837 (and other games): the requirement that certain trains may only access one stop of a given type (i.e. mine). Please note, that this framework only addresses the problems mentioned (and several others) in *configuring* such properties. Currently, just one of these properties is being used by Stefan's route and revenue calculation code, so there is a lot more work to do to bridge our two worlds. See the end of this message for more remarks on this aspect. The stop properties are now collected in a new class named Access. The properties are unchanged from the previous situation, except that one new property has been added: - stopType (city, town, port, mine, pass etc.). The list of values is hardcoded, but easily extendable if needed. - runTo (can a train run to a certain station?). Still unused. It is intended to configure initial access restrictions like those of 1851 Birmingham and 1835 Elsass-Lothringen. - runThrough (can a train run through a certain station?). Still unused. Probably useful for off-map areas, Goderich and other cases. - loop (can a train re-enter a hex visited before?). Still unused, and perhaps redundant. It was intended to prevent the Paris/Berlin/Vienna loop problems in 18EU and 1835, but that issue can be equally well addressed by the trainMutexID, to be discussed below. 'loop' may still prove useful for 1860, where no train may re-enter ANY hex. - score type: major or minor (e.g. for 1835 n+m trains and for the many games where towns do not count against the train size). This is the only stop property already in use. The new framework allows more fine-grained configuration. - trainMutexID (provisional name). The value can be any string. This stop property is new, and intends to replace the 'city name' that Stefan currently is using to prevent the Berlin (etc.) loops. As discussed earlier, that solution is not well sustainable. Another potential use of trainMutexID is to address the rule in 1837 and 18VA that goods trains may hit only one mine station each. In principle, all stop properties can be defined per hex, per tile, per station, per stop type, or even globally, but several (pretty obvious) exceptions exist. The configuration levels are, in order of precedence: 1. Specific MapHex station (defined in Map.xml with 'station' value > 0). 2. Specific Tile station (defined in TileSet.xml with 'station' value > 0). For preprinted tiles (id<=0) only. 3. MapHex (defined in Map.xml with 'station' value absent or 0). 4. Tile (defined in TileSet.xml with 'station' value absent or 0). For preprinted tiles (id<=0) only. 5. MapManager default per stop type (defined as default in Map.xml). 6. TileManager default per stop type (defined as default in TileSet.xml). 7. MapManager general default (defined in Map.xml). 8. TileManager general default (defined in TileSet.xml). 9. Generic default per stop-type (hardcoded). Any property still undefined on a certain level "falls through" to the next level. It's probably preferable to define properties per hex rather than per tile, but (at least for preprinted tiles) both are possible. Both property parsing and the precedence "fall-through" mechanism are methods of class Access. This refactoring has allowed to clean up some repetitive code in various classes. Comments per property: - stop type can only be defined on levels 1-4, as it is required further down. If still undefined after level 4, it is derived from the tile Station type. - runTo and runThrough: levels 1-8. - scoreType and trainMutexID: levels 1-6. I could only test the fall-through mechanism with scoreType, as that is the only item currently used by Stefan's code. Testing was easy, by setting conflicting score type values ('major' and 'minor') on different levels for ports and villages in 18EU, and watching the displayed train routes. I have also tested trainMutexId, after (temporarily) changing lines 257 and 258 in NetworkVertex to call city.getTrainMutexID() instead of station.getCityName(). This way, I could switch the Berlin loop allowance on and off. Stefan, I was wondering why your setting of city="B/V" for the Berlin/Vienna tiles in 18EU did prevent one-hex loopback, but not the Berlin-Vienna route. I guess you are doing this check per hex only. If you could lift that restriction, and look at duplicate city names (or whatever) on all stops of a route, I think we would have a strong mechanism to achieve all kinds of train access limitations. Configuring stop properties is done with the <Access> XML tag, as follows <Access station="1" type="city" runTo="yes" runThrough="no" score="minor" trainMutexID="X"/> where all attributes are optional (and in this example all or most are redundant anyway). The <Access> tag can be put inside <Tile>, <Hex> or in the <Defaults> sections of Map.xml and TiIeSet.xml. Multiple occurrences are allowed. I have added stop types like "port", "mine", "halt", "pass", just in case. For instance, in 18EU I can now declare the port properties in Map.xml: <Defaults> <Access type="port" score="minor"/> </Defaults> If only a stop type needs be declared, a shortcut is possible by putting its definition inside the <Tile> or <Hex> tags. So, for the 18EU port of Amsterdam, we could have <Hex name="A4" value="10" tile="-800" orientation="0"> <Access type="port"/> </Hex> but this can be merged to <Hex name="A4" type="port" value="10" tile="-800" orientation="0"/> BTW 'type="port"' has replaced the (completely unused) 'port="yes"' in 18EU/Map.xml. Whether or not this all will turn out to be useful remains an open question, because Stefan appears to have implemented some restrictions in ways that may not directly correlate with this framework. So, to make it work, some bridge must be built somewhere. I am also open to add <Access> attributes that would directly call Stefan's classes, as I understand he has suggested, provided that the new attribute names are a bit user-friendly. I am thinking of attributes like accessModifier and/or revenueModifier. The latter may be needed anyway. Comments welcome. No hurry. Erik. |
From: Mike B. <com...@ip...> - 2012-06-01 03:28:43
|
Just to point out, Erik, that in 18EU and a couple of other games, minor stops (towns) do not count against the overall stop limit, surely this is another score type to be accommodated? Mike Bourke Campaign Mastery http://www.campaignmastery.com Co-author, Assassin's Amulet http://www.legaciescampaignsetting.com --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 120531-0, 31/05/2012 Tested on: 1/06/2012 1:28:05 PM avast! - copyright (c) 1988-2012 AVAST Software. http://www.avast.com |
From: Erik V. <eri...@xs...> - 2012-06-01 07:57:18
|
Mike, 18EU does not have n+m trains, so 'minor' has a different meaning in 18EU than in 1835. Stefan has taken care of that. But of course, if it would help Stefan to make stop counting more generic, I'm more than willing to add another type. In this new framework that would be very easy to do. I'd call such a new, do-not-count score type "free". Erik. > -----Original Message----- > From: Mike Bourke [mailto:com...@ip...] > Sent: Friday, June 01, 2012 5:28 AM > To: 'Development list for Rails: an 18xx game' > Subject: Re: [Rails-devel] Stop properties framework > > Just to point out, Erik, that in 18EU and a couple of other games, minor stops > (towns) do not count against the overall stop limit, surely this is another > score type to be accommodated? > > Mike Bourke > Campaign Mastery http://www.campaignmastery.com Co-author, Assassin's > Amulet http://www.legaciescampaignsetting.com > > > > > --- > avast! Antivirus: Outbound message clean. > Virus Database (VPS): 120531-0, 31/05/2012 Tested on: 1/06/2012 1:28:05 PM > avast! - copyright (c) 1988-2012 AVAST Software. > http://www.avast.com > > > > > ---------------------------------------------------------------------------- -- > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and threat > landscape has changed and how IT managers can respond. Discussions will > include endpoint security, mobile security and the latest in malware threats. > http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel |
From: Mark S. <mar...@gm...> - 2012-06-01 10:35:11
|
Erik, I haven't been as active recently as in the past, but given this discussion, have you considered the "Halts" and "Run through Tokened Out Station" in 1860? Or have you considered the Mail Stops in 1853? With regards to your thinking here? There is of course the minor matter where 1853 has two (Broad/Metre) different gauge trains and three (Broad, Metre and Dual) different gauge tracks in Auto-Route Calculation? Mark On Fri, Jun 1, 2012 at 3:57 AM, Erik Vos <eri...@xs...> wrote: > Mike, > > 18EU does not have n+m trains, so 'minor' has a different meaning in 18EU > than in 1835. Stefan has taken care of that. > > But of course, if it would help Stefan to make stop counting more generic, > I'm more than willing to add another type. > In this new framework that would be very easy to do. I'd call such a new, > do-not-count score type "free". > > Erik. > > > > -----Original Message----- > > From: Mike Bourke [mailto:com...@ip...] > > Sent: Friday, June 01, 2012 5:28 AM > > To: 'Development list for Rails: an 18xx game' > > Subject: Re: [Rails-devel] Stop properties framework > > > > Just to point out, Erik, that in 18EU and a couple of other games, minor > stops > > (towns) do not count against the overall stop limit, surely this is > another > > score type to be accommodated? > > > > Mike Bourke > > Campaign Mastery http://www.campaignmastery.com Co-author, Assassin's > > Amulet http://www.legaciescampaignsetting.com > > > > > > > > > > --- > > avast! Antivirus: Outbound message clean. > > Virus Database (VPS): 120531-0, 31/05/2012 Tested on: 1/06/2012 1:28:05 > PM > > avast! - copyright (c) 1988-2012 AVAST Software. > > http://www.avast.com > > > > > > > > > > > > ---------------------------------------------------------------------------- > -- > > Live Security Virtual Conference > > Exclusive live event will cover all the ways today's security and threat > > landscape has changed and how IT managers can respond. Discussions will > > include endpoint security, mobile security and the latest in malware > threats. > > http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > _______________________________________________ > > Rails-devel mailing list > > Rai...@li... > > https://lists.sourceforge.net/lists/listinfo/rails-devel > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel > |
From: Stefan F. <ste...@we...> - 2012-06-01 13:15:57
|
Not counting towns/minors towards the train length is a train attribute and not a stop attribute. (countTown=yes/no). On 06/01/2012 09:57 AM, Erik Vos wrote: > Mike, > > 18EU does not have n+m trains, so 'minor' has a different meaning in 18EU > than in 1835. Stefan has taken care of that. > > But of course, if it would help Stefan to make stop counting more generic, > I'm more than willing to add another type. > In this new framework that would be very easy to do. I'd call such a new, > do-not-count score type "free". > > Erik. > > >> -----Original Message----- >> From: Mike Bourke [mailto:com...@ip...] >> Sent: Friday, June 01, 2012 5:28 AM >> To: 'Development list for Rails: an 18xx game' >> Subject: Re: [Rails-devel] Stop properties framework >> >> Just to point out, Erik, that in 18EU and a couple of other games, minor > stops >> (towns) do not count against the overall stop limit, surely this is > another >> score type to be accommodated? >> >> Mike Bourke >> Campaign Mastery http://www.campaignmastery.com Co-author, Assassin's >> Amulet http://www.legaciescampaignsetting.com >> >> >> >> >> --- >> avast! Antivirus: Outbound message clean. >> Virus Database (VPS): 120531-0, 31/05/2012 Tested on: 1/06/2012 1:28:05 PM >> avast! - copyright (c) 1988-2012 AVAST Software. >> http://www.avast.com >> >> >> >> >> > ---------------------------------------------------------------------------- > -- >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and threat >> landscape has changed and how IT managers can respond. Discussions will >> include endpoint security, mobile security and the latest in malware > threats. >> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Rails-devel mailing list >> Rai...@li... >> https://lists.sourceforge.net/lists/listinfo/rails-devel > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel |
From: Erik V. <eri...@xs...> - 2012-06-01 19:35:43
|
> Not counting towns/minors towards the train length is a train attribute and > not a stop attribute. (countTown=yes/no). Indeed, for the known cases we don't need a third value. I'm a bit unsure about the 1860 halts, but let's address that issue when (and if!) the time comes. Erik. |
From: Stefan F. <ste...@we...> - 2012-06-01 13:06:08
|
Erik: some quick comments see below. My major proposed change is to rename the Access class to StopType and then have those defined in xml. You can even hardcode some of them if you prefer that. Each Stop would then link to the according StopType object. Similar to what we have for TrainType. The StopType attribute below would then be renamed to id or name and has no function other than that. Stefan On 06/01/2012 12:25 AM, Erik Vos wrote: > Stefan (and possibly others), > > Sorry, this is long. I intend to put an even longer version in the Wiki > later on. > > I'm happy to report that I have made quite some progress with the new Stop > properties framework, that was discussed a while ago. > It's almost ready to be pushed, but I would first like to present its main > aspects and reopen it for discussion. I would like to publish it as a > whole. > > This framework is intended to provide maximum flexibility in stop property > configuration, on many levels. It is also intended to address the following > requirements and bugs: > - 1837: the need to assign different types to different stops with different > properties on one mine tile. > - 1835: the Berlin loop bug, also relevant to 18EU. As discussed, Stefan's > existing method is not maintainable. > - 1837 (and other games): the requirement that certain trains may only > access one stop of a given type (i.e. mine). > > Please note, that this framework only addresses the problems mentioned (and > several others) in *configuring* such properties. Currently, just one of > these properties is being used by Stefan's route and revenue calculation > code, so there is a lot more work to do to bridge our two worlds. See the > end of this message for more remarks on this aspect. It is not only between Rails Game and Revenue Code we have to coordinate, but also between Rails1.x and Rails2.0 code. I will port your changes forward to Rails2.0 as soon as Rails2.0 has stabilized, however I will then add the required code to support that directly into Rails2.0. I have no intention to back-port this code then to Rails1.x. > > The stop properties are now collected in a new class named Access. The > properties are unchanged from the previous situation, except that one new > property has been added: > > - stopType (city, town, port, mine, pass etc.). The list of values is > hardcoded, but easily extendable if needed. Even if you do not follow my proposal above, stopType should be merely a label and there should not be code like if stopType.equals(...) then ... > > - runTo (can a train run to a certain station?). Still unused. It is > intended to configure initial access restrictions like those of 1851 > Birmingham and 1835 Elsass-Lothringen. > > - runThrough (can a train run through a certain station?). Still unused. > Probably useful for off-map areas, Goderich and other cases. > > - loop (can a train re-enter a hex visited before?). Still unused, and > perhaps redundant. It was intended to prevent the Paris/Berlin/Vienna loop > problems in 18EU and 1835, but that issue can be equally well addressed by > the trainMutexID, to be discussed below. 'loop' may still prove useful for > 1860, where no train may re-enter ANY hex. If required it seems to be better an game attribute or a train attribute. Or is there any game where this loop property is hex-specific? > > - score type: major or minor (e.g. for 1835 n+m trains and for the many > games where towns do not count against the train size). This is the only > stop property already in use. The new framework allows more fine-grained > configuration. > > - trainMutexID (provisional name). The value can be any string. This stop > property is new, and intends to replace the 'city name' that Stefan > currently is using to prevent the Berlin (etc.) loops. As discussed > earlier, that solution is not well sustainable. Another potential use of > trainMutexID is to address the rule in 1837 and 18VA that goods trains may > hit only one mine station each. Question is whether a trainMutexId is valid globally or per-hex/tile? See your own question below. Or make this variable and create an attribute for it. > > In principle, all stop properties can be defined per hex, per tile, per > station, per stop type, or even globally, but several (pretty obvious) > exceptions exist. > The configuration levels are, in order of precedence: > > 1. Specific MapHex station (defined in Map.xml with 'station' value> 0). > 2. Specific Tile station (defined in TileSet.xml with 'station' value> 0). > For preprinted tiles (id<=0) only. > 3. MapHex (defined in Map.xml with 'station' value absent or 0). > 4. Tile (defined in TileSet.xml with 'station' value absent or 0). For > preprinted tiles (id<=0) only. > 5. MapManager default per stop type (defined as default in Map.xml). > 6. TileManager default per stop type (defined as default in TileSet.xml). > 7. MapManager general default (defined in Map.xml). > 8. TileManager general default (defined in TileSet.xml). > 9. Generic default per stop-type (hardcoded). > > Any property still undefined on a certain level "falls through" to the next > level. It's probably preferable to define properties per hex rather than > per tile, but (at least for preprinted tiles) both are possible. > > Both property parsing and the precedence "fall-through" mechanism are > methods of class Access. This refactoring has allowed to clean up some > repetitive code in various classes. > > Comments per property: > > - stop type can only be defined on levels 1-4, as it is required further > down. If still undefined after level 4, it is derived from the tile Station > type. > - runTo and runThrough: levels 1-8. > - scoreType and trainMutexID: levels 1-6. > > I could only test the fall-through mechanism with scoreType, as that is the > only item currently used by Stefan's code. Testing was easy, by setting > conflicting score type values ('major' and 'minor') on different levels for > ports and villages in 18EU, and watching the displayed train routes. > > I have also tested trainMutexId, after (temporarily) changing lines 257 and > 258 in NetworkVertex to call city.getTrainMutexID() instead of > station.getCityName(). > This way, I could switch the Berlin loop allowance on and off. > > Stefan, I was wondering why your setting of city="B/V" for the Berlin/Vienna > tiles in 18EU did prevent one-hex loopback, but not the Berlin-Vienna route. > I guess you are doing this check per hex only. If you could lift that > restriction, and look at duplicate city names (or whatever) on all stops of > a route, I think we would have a strong mechanism to achieve all kinds of > train access limitations. Easy answer: The current identifier used for the vertex sets is derived from the combination of the hex city attribute combined with the tile city attribute. This allows running from Berlin to Vienna. > > Configuring stop properties is done with the<Access> XML tag, as follows > <Access station="1" type="city" runTo="yes" runThrough="no" > score="minor" trainMutexID="X"/> > where all attributes are optional (and in this example all or most are > redundant anyway). > The<Access> tag can be put inside<Tile>,<Hex> or in the<Defaults> > sections of Map.xml and TiIeSet.xml. Multiple occurrences are allowed. > > I have added stop types like "port", "mine", "halt", "pass", just in case. > For instance, in 18EU I can now declare the port properties in Map.xml: > <Defaults> > <Access type="port" score="minor"/> > </Defaults> > > If only a stop type needs be declared, a shortcut is possible by putting its > definition inside the<Tile> or<Hex> tags. > So, for the 18EU port of Amsterdam, we could have > <Hex name="A4" value="10" tile="-800" orientation="0"> > <Access type="port"/> > </Hex> > but this can be merged to > <Hex name="A4" type="port" value="10" tile="-800" orientation="0"/> > BTW 'type="port"' has replaced the (completely unused) 'port="yes"' in > 18EU/Map.xml. > > Whether or not this all will turn out to be useful remains an open question, > because Stefan appears to have implemented some restrictions in ways that > may not directly correlate with this framework. So, to make it work, some > bridge must be built somewhere. I am also open to add<Access> attributes > that would directly call Stefan's classes, as I understand he has suggested, > provided that the new attribute names are a bit user-friendly. I am > thinking of attributes like accessModifier and/or revenueModifier. The > latter may be needed anyway. The current structure which I believe is quite reasonable is the following separates the revenue code from Rails code efficiently and there are only a few specialized classes which are translate the structure of Rails into the structure of revenue calculation: Those are the two adapter classes and there are a few methods in NetworkTrain and NetworkVertex, but this could be moved into adapters as well) All other classes are ignorant to any changes of Rails and vice versa. Game specific cooperation between Rails and the Revenue Calculator is done via the three modifier classes. > > Comments welcome. No hurry. > > Erik. > > > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel |
From: John D. G. <jd...@di...> - 2012-06-02 03:04:00
|
On 2012-05-31 15:25, Erik Vos wrote: > I'm happy to report that I have made quite some progress with the new Stop > properties framework, that was discussed a while ago. I like the general framework, but wanted to toss in a few comments, so I will snip all the parts I'm not commenting on. > The stop properties are now collected in a new class named Access. [snip] > - runTo (can a train run to a certain station?). Still unused. It is > intended to configure initial access restrictions like those of 1851 > Birmingham and 1835 Elsass-Lothringen. runTo sounds more like a train attribute which says which kinds of stops a particular train can visit. I'd suggest we either call this option something like disable="yes", or use some "magic" revenue value (say, -9999) to mean that no train can go there. (The advantage of the latter approach is that the existing OffBoardRevenue mechanism in data/Game.xml can turn it on/off.) > - loop (can a train re-enter a hex visited before?). Still unused, and > perhaps redundant. It was intended to prevent the Paris/Berlin/Vienna loop > problems in 18EU and 1835, but that issue can be equally well addressed by > the trainMutexID, to be discussed below. 'loop' may still prove useful for > 1860, where no train may re-enter ANY hex. I like the idea of "loop" being a tile or hex option, because some games allow a train to visit any city tile more than once (but not the same city), while other games allow this for multiple-large-city tiles but not for multiple-dit tiles (1853, if I recall). By the way, in 18EU, this rule does not just affect train runs. A route that starts in Berlin (NW), passes through an empty token space in Berlin (NE), and then goes to Wien is not a legal route for any purpose. Thus a company in Berlin (NW) would not be allowed to build track if its connection to the new track must pass through Berlin (NE); nor would a minor company in Berlin (NW) be allowed to merge into a major company in Wien during the final exchange round. > - score type: major or minor (e.g. for 1835 n+m trains and for the many > games where towns do not count against the train size). This is the only > stop property already in use. The new framework allows more fine-grained > configuration. 1837 also has express trains (4E, 5E) which completely ignore dits. I'd want a way to set that behavior as a property of the train type. > Stefan, I was wondering why your setting of city="B/V" for the Berlin/Vienna > tiles in 18EU did prevent one-hex loopback, but not the Berlin-Vienna route. > I guess you are doing this check per hex only. If you could lift that > restriction, and look at duplicate city names (or whatever) on all stops of > a route, I think we would have a strong mechanism to achieve all kinds of > train access limitations. Your trainMutexID is a better idea than using city names for this. City names are generally one per hex, and not all games even name the cities. (And then there are the dual city spaces like the OO's in 1830 and the 404s in 1837, where there are two city names but it may not be possible to tell which is which, such as if Philadelphia/Camden is laid with one city north of the other.) |
From: Stefan F. <ste...@we...> - 2012-09-10 05:33:18
|
Erik: it seems to me that this got never pushed to the Rails1.x track. Maybe you could either push that to master or send me as a patch, so that I can add it to Rails2.0? As stated in the previous mail, I have refactored the MapHex and Stop classes a little bit to make them undo-proof, but there are still the Access attributes to be handled. I agree that a separate Access-Class is a great improvement, maybe I do not agree on having 9 levels of configuration, as I prefer to have the defaults set either in TileManager or MapManager, but not allow to set them both (preferably the former). And it will get confusing if e.g. one sets defaults in both. And I suggest to remove the Station types: Having a hard-coded "OffMap" and a xml-defined "offmap" is not a good solution. However most of the usages for the Station types is inside the algorithm code, thus it is my duty to fix that. Thanks, Stefan On 06/01/2012 12:25 AM, Erik Vos wrote: > Stefan (and possibly others), > > Sorry, this is long. I intend to put an even longer version in the Wiki > later on. > > I'm happy to report that I have made quite some progress with the new Stop > properties framework, that was discussed a while ago. > It's almost ready to be pushed, but I would first like to present its main > aspects and reopen it for discussion. I would like to publish it as a > whole. > > This framework is intended to provide maximum flexibility in stop property > configuration, on many levels. It is also intended to address the following > requirements and bugs: > - 1837: the need to assign different types to different stops with different > properties on one mine tile. > - 1835: the Berlin loop bug, also relevant to 18EU. As discussed, Stefan's > existing method is not maintainable. > - 1837 (and other games): the requirement that certain trains may only > access one stop of a given type (i.e. mine). > > Please note, that this framework only addresses the problems mentioned (and > several others) in *configuring* such properties. Currently, just one of > these properties is being used by Stefan's route and revenue calculation > code, so there is a lot more work to do to bridge our two worlds. See the > end of this message for more remarks on this aspect. > > The stop properties are now collected in a new class named Access. The > properties are unchanged from the previous situation, except that one new > property has been added: > > - stopType (city, town, port, mine, pass etc.). The list of values is > hardcoded, but easily extendable if needed. > > - runTo (can a train run to a certain station?). Still unused. It is > intended to configure initial access restrictions like those of 1851 > Birmingham and 1835 Elsass-Lothringen. > > - runThrough (can a train run through a certain station?). Still unused. > Probably useful for off-map areas, Goderich and other cases. > > - loop (can a train re-enter a hex visited before?). Still unused, and > perhaps redundant. It was intended to prevent the Paris/Berlin/Vienna loop > problems in 18EU and 1835, but that issue can be equally well addressed by > the trainMutexID, to be discussed below. 'loop' may still prove useful for > 1860, where no train may re-enter ANY hex. > > - score type: major or minor (e.g. for 1835 n+m trains and for the many > games where towns do not count against the train size). This is the only > stop property already in use. The new framework allows more fine-grained > configuration. > > - trainMutexID (provisional name). The value can be any string. This stop > property is new, and intends to replace the 'city name' that Stefan > currently is using to prevent the Berlin (etc.) loops. As discussed > earlier, that solution is not well sustainable. Another potential use of > trainMutexID is to address the rule in 1837 and 18VA that goods trains may > hit only one mine station each. > > In principle, all stop properties can be defined per hex, per tile, per > station, per stop type, or even globally, but several (pretty obvious) > exceptions exist. > The configuration levels are, in order of precedence: > > 1. Specific MapHex station (defined in Map.xml with 'station' value > 0). > 2. Specific Tile station (defined in TileSet.xml with 'station' value > 0). > For preprinted tiles (id<=0) only. > 3. MapHex (defined in Map.xml with 'station' value absent or 0). > 4. Tile (defined in TileSet.xml with 'station' value absent or 0). For > preprinted tiles (id<=0) only. > 5. MapManager default per stop type (defined as default in Map.xml). > 6. TileManager default per stop type (defined as default in TileSet.xml). > 7. MapManager general default (defined in Map.xml). > 8. TileManager general default (defined in TileSet.xml). > 9. Generic default per stop-type (hardcoded). > > Any property still undefined on a certain level "falls through" to the next > level. It's probably preferable to define properties per hex rather than > per tile, but (at least for preprinted tiles) both are possible. > > Both property parsing and the precedence "fall-through" mechanism are > methods of class Access. This refactoring has allowed to clean up some > repetitive code in various classes. > > Comments per property: > > - stop type can only be defined on levels 1-4, as it is required further > down. If still undefined after level 4, it is derived from the tile Station > type. > - runTo and runThrough: levels 1-8. > - scoreType and trainMutexID: levels 1-6. > > I could only test the fall-through mechanism with scoreType, as that is the > only item currently used by Stefan's code. Testing was easy, by setting > conflicting score type values ('major' and 'minor') on different levels for > ports and villages in 18EU, and watching the displayed train routes. > > I have also tested trainMutexId, after (temporarily) changing lines 257 and > 258 in NetworkVertex to call city.getTrainMutexID() instead of > station.getCityName(). > This way, I could switch the Berlin loop allowance on and off. > > Stefan, I was wondering why your setting of city="B/V" for the Berlin/Vienna > tiles in 18EU did prevent one-hex loopback, but not the Berlin-Vienna route. > I guess you are doing this check per hex only. If you could lift that > restriction, and look at duplicate city names (or whatever) on all stops of > a route, I think we would have a strong mechanism to achieve all kinds of > train access limitations. > > Configuring stop properties is done with the <Access> XML tag, as follows > <Access station="1" type="city" runTo="yes" runThrough="no" > score="minor" trainMutexID="X"/> > where all attributes are optional (and in this example all or most are > redundant anyway). > The <Access> tag can be put inside <Tile>, <Hex> or in the <Defaults> > sections of Map.xml and TiIeSet.xml. Multiple occurrences are allowed. > > I have added stop types like "port", "mine", "halt", "pass", just in case. > For instance, in 18EU I can now declare the port properties in Map.xml: > <Defaults> > <Access type="port" score="minor"/> > </Defaults> > > If only a stop type needs be declared, a shortcut is possible by putting its > definition inside the <Tile> or <Hex> tags. > So, for the 18EU port of Amsterdam, we could have > <Hex name="A4" value="10" tile="-800" orientation="0"> > <Access type="port"/> > </Hex> > but this can be merged to > <Hex name="A4" type="port" value="10" tile="-800" orientation="0"/> > BTW 'type="port"' has replaced the (completely unused) 'port="yes"' in > 18EU/Map.xml. > > Whether or not this all will turn out to be useful remains an open question, > because Stefan appears to have implemented some restrictions in ways that > may not directly correlate with this framework. So, to make it work, some > bridge must be built somewhere. I am also open to add <Access> attributes > that would directly call Stefan's classes, as I understand he has suggested, > provided that the new attribute names are a bit user-friendly. I am > thinking of attributes like accessModifier and/or revenueModifier. The > latter may be needed anyway. > > Comments welcome. No hurry. > > Erik. > > > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel > |
From: Erik V. <eri...@xs...> - 2012-09-10 16:30:47
|
Stefan, I remember that a while ago you had already sent some comments on my below proposal, and at that time I was working on a further response when I got distracted and the whole issue fell by the wayside. I'll have to revisit all of it, which I hopefully can do later this week (fortunately - for this project - the weather is seriously worsening over here :-)). Indeed I think it's best to finish my work in about its current state, taking into account whichever of your comments appeal to me, and commit the whole thing so that we have a clear base to work from. On the 9 levels: obviously we'll never use all of them together. However, I think all or most of these levels will find a good use in some context, and in any case it turned out to be very easy to provide all that flexibility. But let's continue discussing the fine details later. Erik > -----Original Message----- > From: Stefan Frey [mailto:ste...@we...] > Sent: Monday, September 10, 2012 7:33 AM > To: Development list for Rails: an 18xx game > Subject: Re: [Rails-devel] Stop properties framework > > Erik: > it seems to me that this got never pushed to the Rails1.x track. > Maybe you could either push that to master or send me as a patch, so that I > can add it to Rails2.0? > > As stated in the previous mail, I have refactored the MapHex and Stop > classes a little bit to make them undo-proof, but there are still the Access > attributes to be handled. > > I agree that a separate Access-Class is a great improvement, maybe I do not > agree on having 9 levels of configuration, as I prefer to have the defaults set > either in TileManager or MapManager, but not allow to set them both > (preferably the former). And it will get confusing if e.g. one sets defaults in > both. > > And I suggest to remove the Station types: Having a hard-coded "OffMap" > and a xml-defined "offmap" is not a good solution. However most of the > usages for the Station types is inside the algorithm code, thus it is my duty to > fix that. > > Thanks, > Stefan > > On 06/01/2012 12:25 AM, Erik Vos wrote: > > Stefan (and possibly others), > > > > Sorry, this is long. I intend to put an even longer version in the > > Wiki later on. > > > > I'm happy to report that I have made quite some progress with the new > > Stop properties framework, that was discussed a while ago. > > It's almost ready to be pushed, but I would first like to present its > > main aspects and reopen it for discussion. I would like to publish it > > as a whole. > > > > This framework is intended to provide maximum flexibility in stop > > property configuration, on many levels. It is also intended to address > > the following requirements and bugs: > > - 1837: the need to assign different types to different stops with > > different properties on one mine tile. > > - 1835: the Berlin loop bug, also relevant to 18EU. As discussed, > > Stefan's existing method is not maintainable. > > - 1837 (and other games): the requirement that certain trains may only > > access one stop of a given type (i.e. mine). > > > > Please note, that this framework only addresses the problems mentioned > > (and several others) in *configuring* such properties. Currently, > > just one of these properties is being used by Stefan's route and > > revenue calculation code, so there is a lot more work to do to bridge > > our two worlds. See the end of this message for more remarks on this > aspect. > > > > The stop properties are now collected in a new class named Access. > > The properties are unchanged from the previous situation, except that > > one new property has been added: > > > > - stopType (city, town, port, mine, pass etc.). The list of values is > > hardcoded, but easily extendable if needed. > > > > - runTo (can a train run to a certain station?). Still unused. It is > > intended to configure initial access restrictions like those of 1851 > > Birmingham and 1835 Elsass-Lothringen. > > > > - runThrough (can a train run through a certain station?). Still unused. > > Probably useful for off-map areas, Goderich and other cases. > > > > - loop (can a train re-enter a hex visited before?). Still unused, and > > perhaps redundant. It was intended to prevent the Paris/Berlin/Vienna > > loop problems in 18EU and 1835, but that issue can be equally well > > addressed by the trainMutexID, to be discussed below. 'loop' may still > > prove useful for 1860, where no train may re-enter ANY hex. > > > > - score type: major or minor (e.g. for 1835 n+m trains and for the > > many games where towns do not count against the train size). This is > > the only stop property already in use. The new framework allows more > > fine-grained configuration. > > > > - trainMutexID (provisional name). The value can be any string. This > > stop property is new, and intends to replace the 'city name' that > > Stefan currently is using to prevent the Berlin (etc.) loops. As > > discussed earlier, that solution is not well sustainable. Another > > potential use of trainMutexID is to address the rule in 1837 and 18VA > > that goods trains may hit only one mine station each. > > > > In principle, all stop properties can be defined per hex, per tile, > > per station, per stop type, or even globally, but several (pretty > > obvious) exceptions exist. > > The configuration levels are, in order of precedence: > > > > 1. Specific MapHex station (defined in Map.xml with 'station' value > 0). > > 2. Specific Tile station (defined in TileSet.xml with 'station' value > 0). > > For preprinted tiles (id<=0) only. > > 3. MapHex (defined in Map.xml with 'station' value absent or 0). > > 4. Tile (defined in TileSet.xml with 'station' value absent or 0). > > For preprinted tiles (id<=0) only. > > 5. MapManager default per stop type (defined as default in Map.xml). > > 6. TileManager default per stop type (defined as default in TileSet.xml). > > 7. MapManager general default (defined in Map.xml). > > 8. TileManager general default (defined in TileSet.xml). > > 9. Generic default per stop-type (hardcoded). > > > > Any property still undefined on a certain level "falls through" to the > > next level. It's probably preferable to define properties per hex > > rather than per tile, but (at least for preprinted tiles) both are possible. > > > > Both property parsing and the precedence "fall-through" mechanism are > > methods of class Access. This refactoring has allowed to clean up > > some repetitive code in various classes. > > > > Comments per property: > > > > - stop type can only be defined on levels 1-4, as it is required > > further down. If still undefined after level 4, it is derived from the > > tile Station type. > > - runTo and runThrough: levels 1-8. > > - scoreType and trainMutexID: levels 1-6. > > > > I could only test the fall-through mechanism with scoreType, as that > > is the only item currently used by Stefan's code. Testing was easy, > > by setting conflicting score type values ('major' and 'minor') on > > different levels for ports and villages in 18EU, and watching the displayed > train routes. > > > > I have also tested trainMutexId, after (temporarily) changing lines > > 257 and > > 258 in NetworkVertex to call city.getTrainMutexID() instead of > > station.getCityName(). > > This way, I could switch the Berlin loop allowance on and off. > > > > Stefan, I was wondering why your setting of city="B/V" for the > > Berlin/Vienna tiles in 18EU did prevent one-hex loopback, but not the > Berlin-Vienna route. > > I guess you are doing this check per hex only. If you could lift that > > restriction, and look at duplicate city names (or whatever) on all > > stops of a route, I think we would have a strong mechanism to achieve > > all kinds of train access limitations. > > > > Configuring stop properties is done with the <Access> XML tag, as follows > > <Access station="1" type="city" runTo="yes" runThrough="no" > > score="minor" trainMutexID="X"/> > > where all attributes are optional (and in this example all or most are > > redundant anyway). > > The <Access> tag can be put inside <Tile>, <Hex> or in the <Defaults> > > sections of Map.xml and TiIeSet.xml. Multiple occurrences are allowed. > > > > I have added stop types like "port", "mine", "halt", "pass", just in case. > > For instance, in 18EU I can now declare the port properties in Map.xml: > > <Defaults> > > <Access type="port" score="minor"/> > > </Defaults> > > > > If only a stop type needs be declared, a shortcut is possible by > > putting its definition inside the <Tile> or <Hex> tags. > > So, for the 18EU port of Amsterdam, we could have > > <Hex name="A4" value="10" tile="-800" orientation="0"> > > <Access type="port"/> > > </Hex> > > but this can be merged to > > <Hex name="A4" type="port" value="10" tile="-800" > orientation="0"/> > > BTW 'type="port"' has replaced the (completely unused) 'port="yes"' in > > 18EU/Map.xml. > > > > Whether or not this all will turn out to be useful remains an open > > question, because Stefan appears to have implemented some restrictions > > in ways that may not directly correlate with this framework. So, to > > make it work, some bridge must be built somewhere. I am also open to > > add <Access> attributes that would directly call Stefan's classes, as > > I understand he has suggested, provided that the new attribute names > > are a bit user-friendly. I am thinking of attributes like > > accessModifier and/or revenueModifier. The latter may be needed > anyway. > > > > Comments welcome. No hurry. > > > > Erik. > > > > > > > > > > > > > > ---------------------------------------------------------------------- > > -------- > > Live Security Virtual Conference > > Exclusive live event will cover all the ways today's security and > > threat landscape has changed and how IT managers can respond. > > Discussions will include endpoint security, mobile security and the > > latest in malware threats. > > http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > _______________________________________________ > > Rails-devel mailing list > > Rai...@li... > > https://lists.sourceforge.net/lists/listinfo/rails-devel > > > > > ---------------------------------------------------------------------------- -- > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and threat > landscape has changed and how IT managers can respond. Discussions will > include endpoint security, mobile security and the latest in malware threats. > http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel |
From: Erik V. <eri...@xs...> - 2012-09-11 15:42:20
|
I have pushed the Access-related code to master unchanged, so we have a common basis to work from. Please find my original description below. As said there, the only attribute I could test so far is the score type. Some further remarks, partly in response to comments by Stefan: 1. If the 'loop' attribute turns out to be redundant (as I suspect, noticing Stefan's plans to handle tile revisits), it can easily be removed. 2. The same applies to all other attributes, and new ones can also be added pretty simply. The only exception is stopType, which is required as it plays a role in the precedence rules. 3. Although 9 precedence levels look like serious overkill, it offers flexibility, and in practice you will probably never use more than two or three. The precedence list can be simplified as follows: 1/2. Per specific station on a hex or tile. 3/4. Per specific hex(es) or tile(s). 5/6. Default per stop type (city, town, etc.) 7/8. General defaults (per game). 9. Hardcoded 'fall-through' default per stop type. In each pair, a specification per hex precedes a specification per tile. You'll probably define the generic access properties of a game on level 5 or 6 in either MapManager or TileManager, as Stefan wants it. In addition, you may need to specify some exceptions on level 3 or 4, whichever is more appropriate in each case. Usage of levels 1/2 is rare; these levels were only added to enable handling a specific preprinted tile in 1837 (and that need, which we couldn't handle in the old way, triggered this whole upgrade). 4. The current code is the end result after several rework cycles. I consider it rather elegant, but please judge for yourself. 5. The Stop class still contains a lot of debug logging, which is very useful in testing, but needs to be restricted or removed later on. Erik > -----Original Message----- > From: Erik Vos [mailto:eri...@xs...] > Sent: Friday, June 01, 2012 12:26 AM > To: Development list for Rails: an 18xx game > Subject: [Rails-devel] Stop properties framework > > Stefan (and possibly others), > > Sorry, this is long. I intend to put an even longer version in the Wiki later on. > > I'm happy to report that I have made quite some progress with the new Stop > properties framework, that was discussed a while ago. > It's almost ready to be pushed, but I would first like to present its main > aspects and reopen it for discussion. I would like to publish it as a whole. > > This framework is intended to provide maximum flexibility in stop property > configuration, on many levels. It is also intended to address the following > requirements and bugs: > - 1837: the need to assign different types to different stops with different > properties on one mine tile. > - 1835: the Berlin loop bug, also relevant to 18EU. As discussed, Stefan's > existing method is not maintainable. > - 1837 (and other games): the requirement that certain trains may only > access one stop of a given type (i.e. mine). > > Please note, that this framework only addresses the problems mentioned > (and several others) in *configuring* such properties. Currently, just one of > these properties is being used by Stefan's route and revenue calculation > code, so there is a lot more work to do to bridge our two worlds. See the > end of this message for more remarks on this aspect. > > The stop properties are now collected in a new class named Access. The > properties are unchanged from the previous situation, except that one new > property has been added: > > - stopType (city, town, port, mine, pass etc.). The list of values is hardcoded, > but easily extendable if needed. > > - runTo (can a train run to a certain station?). Still unused. It is intended to > configure initial access restrictions like those of 1851 Birmingham and 1835 > Elsass-Lothringen. > > - runThrough (can a train run through a certain station?). Still unused. > Probably useful for off-map areas, Goderich and other cases. > > - loop (can a train re-enter a hex visited before?). Still unused, and perhaps > redundant. It was intended to prevent the Paris/Berlin/Vienna loop > problems in 18EU and 1835, but that issue can be equally well addressed by > the trainMutexID, to be discussed below. 'loop' may still prove useful for > 1860, where no train may re-enter ANY hex. > > - score type: major or minor (e.g. for 1835 n+m trains and for the many > games where towns do not count against the train size). This is the only stop > property already in use. The new framework allows more fine-grained > configuration. > > - trainMutexID (provisional name). The value can be any string. This stop > property is new, and intends to replace the 'city name' that Stefan currently > is using to prevent the Berlin (etc.) loops. As discussed earlier, that solution > is not well sustainable. Another potential use of trainMutexID is to address > the rule in 1837 and 18VA that goods trains may hit only one mine station > each. > > In principle, all stop properties can be defined per hex, per tile, per station, > per stop type, or even globally, but several (pretty obvious) exceptions exist. > The configuration levels are, in order of precedence: > > 1. Specific MapHex station (defined in Map.xml with 'station' value > 0). > 2. Specific Tile station (defined in TileSet.xml with 'station' value > 0). > For preprinted tiles (id<=0) only. > 3. MapHex (defined in Map.xml with 'station' value absent or 0). > 4. Tile (defined in TileSet.xml with 'station' value absent or 0). For preprinted > tiles (id<=0) only. > 5. MapManager default per stop type (defined as default in Map.xml). > 6. TileManager default per stop type (defined as default in TileSet.xml). > 7. MapManager general default (defined in Map.xml). > 8. TileManager general default (defined in TileSet.xml). > 9. Generic default per stop-type (hardcoded). > > Any property still undefined on a certain level "falls through" to the next > level. It's probably preferable to define properties per hex rather than per > tile, but (at least for preprinted tiles) both are possible. > > Both property parsing and the precedence "fall-through" mechanism are > methods of class Access. This refactoring has allowed to clean up some > repetitive code in various classes. > > Comments per property: > > - stop type can only be defined on levels 1-4, as it is required further down. If > still undefined after level 4, it is derived from the tile Station type. > - runTo and runThrough: levels 1-8. > - scoreType and trainMutexID: levels 1-6. > > I could only test the fall-through mechanism with scoreType, as that is the > only item currently used by Stefan's code. Testing was easy, by setting > conflicting score type values ('major' and 'minor') on different levels for ports > and villages in 18EU, and watching the displayed train routes. > > I have also tested trainMutexId, after (temporarily) changing lines 257 and > 258 in NetworkVertex to call city.getTrainMutexID() instead of > station.getCityName(). > This way, I could switch the Berlin loop allowance on and off. > > Stefan, I was wondering why your setting of city="B/V" for the Berlin/Vienna > tiles in 18EU did prevent one-hex loopback, but not the Berlin-Vienna route. > I guess you are doing this check per hex only. If you could lift that restriction, > and look at duplicate city names (or whatever) on all stops of a route, I think > we would have a strong mechanism to achieve all kinds of train access > limitations. > > Configuring stop properties is done with the <Access> XML tag, as follows > <Access station="1" type="city" runTo="yes" runThrough="no" > score="minor" trainMutexID="X"/> > where all attributes are optional (and in this example all or most are > redundant anyway). > The <Access> tag can be put inside <Tile>, <Hex> or in the <Defaults> > sections of Map.xml and TiIeSet.xml. Multiple occurrences are allowed. > > I have added stop types like "port", "mine", "halt", "pass", just in case. > For instance, in 18EU I can now declare the port properties in Map.xml: > <Defaults> > <Access type="port" score="minor"/> > </Defaults> > > If only a stop type needs be declared, a shortcut is possible by putting its > definition inside the <Tile> or <Hex> tags. > So, for the 18EU port of Amsterdam, we could have > <Hex name="A4" value="10" tile="-800" orientation="0"> > <Access type="port"/> > </Hex> > but this can be merged to > <Hex name="A4" type="port" value="10" tile="-800" > orientation="0"/> BTW 'type="port"' has replaced the (completely unused) > 'port="yes"' in 18EU/Map.xml. > > Whether or not this all will turn out to be useful remains an open question, > because Stefan appears to have implemented some restrictions in ways that > may not directly correlate with this framework. So, to make it work, some > bridge must be built somewhere. I am also open to add <Access> attributes > that would directly call Stefan's classes, as I understand he has suggested, > provided that the new attribute names are a bit user-friendly. I am thinking > of attributes like accessModifier and/or revenueModifier. The latter may be > needed anyway. > > Comments welcome. No hurry. > > Erik. > > > > > > > ---------------------------------------------------------------------------- -- > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and threat > landscape has changed and how IT managers can respond. Discussions will > include endpoint security, mobile security and the latest in malware threats. > http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel |