Here's a sample with no tricks-
Code: Select all
(setq mapData (list
(list "SE" "Node47" "Node48")
(list "Node47" "SE" "Node48" "Node78")
(list "Node48" "Node47" "SE")
(list "Node78" "Node47" "Node109")
(list "Node109" "Node78")
))
Maps are a list of lists. Each is (list [node ID] [link ID] [link ID] ...) where the first item is the actual system being defined and the links are the gates in that system.
Every system listed (item 0) would be available. A list of all these systems would be valid because they can all be reached, there aren't any random systems that may or may not be present. The viewer I have now shows this entire list as 'active all' which is to say, all the active systems on a user map.
Here's a sample which better represents the need for tracing the route-
Code: Select all
(block (mapLevel)
(setq mapData (list
;these are the starting positions possible
(list "SE" "Node47")
(list "Node15" "Node47")
(list "Node17" "Node47")
;here is the next system that is linked
(list "Node47" "Cond1" "Cond2")
;these are the next system set
(list "Node78" "Node47" "Cond3")
(list "Node79" "Node47" "Cond3")
;these are the next system set
(list "Node110" "Cond2")
(list "Node108" "Cond2")
(list "Node109" "Cond2" "Node140")
;this is a bonus system that only Node109 gets
(list "Node140" "Node109")
;and that's all
;this map generates a 4-5 system linear result
;with random start system - 1 of 3
;a connecting system 1 of 1
;and a random system - 1 of 2
;then an end system - 1 of 3
))
All the 'Cond' are turned into a decision for which system of a set is used.
In this example a random starting point is chosen from SE, Node15, or Node17. In the game, the map viewer would only show the 'known' systems- so it isn't totally important to trace the network, but I want to figure out the list of systems that were used in order to do several things- A) view the active current systems in the network in a test viewer to inspect the network constructed, and B) know which systems are currently available in the game in order for map information to be sold from vendors.
Here is the system conditionals for that map:
Code: Select all
(block (nodeLevel)
(setq mapNodeCond (list
(list "Cond1" "getStart")
(list "Cond2" "getOneEQ" "Node78" "Node79")
(list "Cond3" "getOneEQ" "Node109" "Node108" "Node110")
))
(setq nodeLevel (sysSetData "Sys26" "nodeConds" mapNodeCond))
)
Cond -itions are set up on a list, with their own unique ID (Cond1) and a conditional operator to make decisions: "getStart" = get the start point, "getOneEQ" = get one from the list that follows with equal odds between them. I am working out more of these, and 'higher' levels of operator decisions that can precede the Node Conds (not important for this discussion, as these all precede the mapData that needs to be traced for the network created)
After the decisions are made for the random links and systems we get the mapData as a 'hard links list'.
This example list then becomes something like:
Code: Select all
(block (mapLevel)
(setq mapData (list
(list "SE" "Node47")
(list "Node15" "Node47")
(list "Node17" "Node47")
(list "Node47" "SE" "Node78")
(list "Node78" "Node47" "Node109")
(list "Node79" "Node47" "Node109")
(list "Node110" "Node78")
(list "Node108" "Node78")
(list "Node109" "Node78" "Node140")
(list "Node140" "Node109")
;and that's all
;this map generates a 4-5 system linear result
;with random start system - 1 of 3
;a connecting system 1 of 1
;and a random system - 1 of 2
;then an end system - 1 of 3
))
Which would play as a linear network [ SE<->Node47<->Node78<->Node109<->Node140 ] if you played it with those random Cond -itions chosen.
So, the network trace needs to start from the start system- let's say SE, which has a connection to Node47 (cond1 is for the start link), Cond2 is for either Node78 or Node79, so I figured that the links could be followed from inside the list to define the network after the Cond -itions are defined.
My viewer shows this entire 'active' list as a filtered set of systems from the Full topology data (all the systems available), which is all the listed systems, or it shows the 'game' view- which only allows you to see known systems (this can be used to accurately map, except you must get the systems known first).
Maps I make use only a few of the systems from the Full set- These are all the ones in the list there, and I call them 'Active' or Active All. But to see what a game is going to actually deliver to the player, I need a Current Network- or the links that are made from the starting point, without adding the 'dead' or unused links in as it does now.
So, this map should be resolved down to a set of systems that simply shows the links from the start point forward- excluding the optional systems that were not chosen. I figured that a loop function that traced the links and systems would work well for this.
Ideally the function will simply produce and save a list such as "currentNetwork" in "Sys26" system. (sysSetData "Sys26" "currentNetwork" theListWeMade) A simple list of the NodeID would suffice: (list "SE" "Node47" "Node78" Node109" "Node140")