Looking through the Huari.xml I see that the <OnGlobalTopologyCreated> is used inside the System element, for a rootNode system.
Is the event run when the topology is created at the beginning of the game, or is it called when the system is created? If it is created when the system is created, then there is a stargate being created in a system that the player has potentially visited, and potentially fully explored, right?
If I wanted to arrange the network in the beginning of the game, an OnGlobalTopologyCreated in the first system would be able to set up links between nodes that haven't been entered yet, right?
The function to establish a link doesn't place a stargate- so each time a link is made a sysCreateStargate must be used to add the gate, yes? It doesn't look like sysCreateStargate would work on a remote system, is that the case?
What is sysGetEnvironment returning?
New Functions for topology- questions
-
- Developer
- Posts: 2998
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
<OnGlobalTopologyCreated> is called once at the beginning of the game. It is called after the topology is generated (all the random nodes are determined) but before the first system is created.Periculi wrote:Looking through the Huari.xml I see that the <OnGlobalTopologyCreated> is used inside the System element, for a rootNode system.
Is the event run when the topology is created at the beginning of the game, or is it called when the system is created? If it is created when the system is created, then there is a stargate being created in a system that the player has potentially visited, and potentially fully explored, right?
If I wanted to arrange the network in the beginning of the game, an OnGlobalTopologyCreated in the first system would be able to set up links between nodes that haven't been entered yet, right?
The function to establish a link doesn't place a stargate- so each time a link is made a sysCreateStargate must be used to add the gate, yes? It doesn't look like sysCreateStargate would work on a remote system, is that the case?
What is sysGetEnvironment returning?
<OnGlobalSystemCreated> is called every time that a new system is created.
You are right that (sysAddStargateTopology) adds stargate links between nodes (whether or not they have been entered). And you are right that a call to (sysCreateStargate) must be made to create the actual stargate object in the proper system.
That's why Huari.xml has the two calls in seperate events--the first when the topology is created, the second when the actual system is created/entered.
I think you get the mechanics, but just to be explicit:
1. The Huari code is designed to create a stargate in a random system in the mainline to the Huaramarca system.
2. The code defines the Huaramarca node with a single stargate that leads to an unspecified system (the keyword "[Prev]" indicates that we will fix up the DestID later.)
3. When the game starts (<OnGlobalTopologyCreated>) we pick a random node (call it the "source node") and connect it to Huaramarca using (sysAddStargateTopology). This is the equivalent of adding a <Stargate> element in the source node's <Node> definition. At this point, we also fix up the "[Prev]" value to point back to the source node.
4. When the system for the source node is created, <OnGlobalSystemCreated> is called. The code then creates a stargate object using (sysCreateStargate).
Hope that helps. I think with the fixes that I made in 0.99a, you should be able to do what you want, but I'm happy to continue adding the support that you need.
- Periculi
- Fleet Officer
- Posts: 1282
- Joined: Sat Oct 13, 2007 7:48 pm
- Location: Necroposting in a forum near you
The only part I don't quite get is how the OnGlobalTopologyCreated event is even found in a system type element that I thought wasn't loaded until the system was actually entered.
Does this mean that the game is loading the system type elements at the beginning while constructing the topology? (And now looks in the system type for that specific event?)
How would the event be handled in the case of a random system type that was re-used multiple times?
I am going to have do some fairly intense experiments with this, I think!
Thanks for all the wonderful new topology toys, George, I will let you know how it goes and hopefully be making the most of them in future mods.
Does this mean that the game is loading the system type elements at the beginning while constructing the topology? (And now looks in the system type for that specific event?)
How would the event be handled in the case of a random system type that was re-used multiple times?
I am going to have do some fairly intense experiments with this, I think!
Thanks for all the wonderful new topology toys, George, I will let you know how it goes and hopefully be making the most of them in future mods.

-
- Developer
- Posts: 2998
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
Not really. At the beginning of the game, after the topology is constructed, every design type element with an OnGlobalTopologyCreated event will get called (once and only once). Because that event is called before any system is created, you can't access any system objects--only topology nodes.Periculi wrote:Does this mean that the game is loading the system type elements at the beginning while constructing the topology? (And now looks in the system type for that specific event?)
How would the event be handled in the case of a random system type that was re-used multiple times?
- Periculi
- Fleet Officer
- Posts: 1282
- Joined: Sat Oct 13, 2007 7:48 pm
- Location: Necroposting in a forum near you
Well, that's great!
Could you spare a moment to explain root nodes?
Let's say I want to create a set of nodes that initially has no gate connections at all, with the intention of adding the links with the topology event. Would this be possible? Would they need to all be root nodes?
Then let's say that I want to use a segment of nodes, or the games current topology, and have a pool of nodes to link in to the segment with the topology event- would the pool of unlinked nodes all need a topology event, or could a single topology event process the links with a script (recursive function, perhaps)?
Could you spare a moment to explain root nodes?
Let's say I want to create a set of nodes that initially has no gate connections at all, with the intention of adding the links with the topology event. Would this be possible? Would they need to all be root nodes?
Then let's say that I want to use a segment of nodes, or the games current topology, and have a pool of nodes to link in to the segment with the topology event- would the pool of unlinked nodes all need a topology event, or could a single topology event process the links with a script (recursive function, perhaps)?
-
- Developer
- Posts: 2998
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
A root node is just a node that can't trace a path to another root node.
A root node is either the starting node for a game (Eridani) or it is a node that is only accessible via (objGateTo) like Elysium or it is a node that is linked dynamically using (sysAddStargateTopology) like Huaramarca.
You can use <OnGlobalTopologyCreated> to link multiple nodes.
A root node is either the starting node for a game (Eridani) or it is a node that is only accessible via (objGateTo) like Elysium or it is a node that is linked dynamically using (sysAddStargateTopology) like Huaramarca.
You can use <OnGlobalTopologyCreated> to link multiple nodes.