Stargates get priveleged information!

Post ideas & suggestions you have pertaining to the game here.
Post Reply
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

Why is it that stargates can display the name of the next system, but we can't get that same information from script?

Because this happens, it seems to me that the game engine has prepared that information. Does this also mean that the system definition to use is decided from the table in the <Node>?

The only way that I can figure that Eridani knows whether Groombridge, Lalande or 5 Indi is at the other side of the gate is because the information exists.

So this:

Code: Select all

	<Node ID="C1">
		<System								level="1"	variant="commonwealth">
			<Table>
				<Item chance="30" name="Groombridge" UNID="&ssEarthSpaceStandard;"/>
				<Item chance="40" name="Lalande"	UNID="&ssEarthSpaceRedDwarf;"/>
				<Item chance="30" name="5 Indi"		UNID="&ssEarthSpaceAsteroids;"/>
			</Table>
		</System>

		<StarGates>
			<StarGate Name="Inbound" DestID="Prev" DestGate="Outbound"/>
			<StarGate Name="Outbound" DestID="C3" DestGate="Inbound"/>
		</StarGates>
	</Node>
Must be processed into some kind of list with defined values when the topology is loaded, before the game is entered:

(C1, Groombridge, &ssEarthSpaceStandard;, level 1)

This information has to be there when Eridani is created, otherwise the stargate label would be incorrect in the Eridani system.

How much information is really available? Does variant get saved? Does the level?

But most importantly: Why can't we access this information from scripts?
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

You are exactly right.

At game creation time, the entire topology is processed. In other words, all the random choices are resolved and a single topology is generated. Internally, this is kept as a list of nodes connected by stargates [each node corresponds to a system and is identified by nodeID]

When a system is created (which only happens the first time the player enters it) we generate the actual objects in the system, including the stargate objects. At system creation time, the code matches up the stargate objects with the stargate links in the topology. It then sets the name of the stargate to match the destination node.

Fortunately, in 0.99 this infomation will be available.

1. The function (sysGetStargates [nodeID]) takes a nodeID and returns a list of stargate IDs in that node. [Note: this is a list of stargate IDs, not stargate objects.]

2. The function (sysGetStargateDestinationNode [nodeID] gateID) takes a nodeID and a gateID and returns the nodeID that the stargate goes to.

Using the two functions above, it is possible to traverse the entire topology

Note that you still don't get access to objects in other systems--especially since some of the systems in the topology haven't been created yet. But you can drop some data in the node structure for later.

For example, you could enumerate all level 5 nodes and pick a random one. Then you can store data in that node:

(sysSetData theNode "CreateCoolStationHere" True)

Then, inside the OnCreate of a system, you could check for that data:

(if (sysGetData "CreateCoolStationHere")
; create the station
)

0.99 also adds two new events:

OnGlobalGameCreated is invoked at the begining of the game after the topology is generated.

OnGlobalSystemCreated is invoked right after a system is created (at the same time as OnCreate for a system, but you can put the event on any type).
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

None of those functions return the name of the system.

And, the name is one thing I am particularly after for mapping and other content generation purposes. Knowing that SE connects to C1 doesn't tell me if C1 is Groombridge, Lalande or 5 Indi.

So we can traverse the gates and get node ID returned. That's a good start. But where do those functions get a level indication to enumerate the level 5 or whatever systems? How do we retrieve the name of the system, the level, or even possibly make use of the variant value?
At game creation time, the entire topology is processed. In other words, all the random choices are resolved and a single topology is generated. Internally, this is kept as a list of nodes connected by stargates [each node corresponds to a system and is identified by nodeID]
Is the information in the Node tag that pertains to the system also resolved into a single value- the name and system definition to use?

Oh, and does OnGlobalSystemCreated work in items? In the playership? Is that the menaing of event on any type? Otherwise, what's the real difference from OnCreate?

How much information could some form of function like (sysGetNodeData [nodeID]) retrieve for a given uncreated system from Eridani at the beginning of the game, hypothetically.
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

I would rather have a setSystemName. It would be much more useful and we could just use some system data to get the names outside the system then (because you can set data at the same time as you set the systems name.
Crying is not a proper retort!
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

Yes, that would be handy.

It would even be able to work even if it only worked on the current system.

I would like to retrieve the system definition type as well, which would allow me to know what systems were going to be created in a network.

That would allow me to map the star types (as they aren't random for system definitions) and environment type from the topology and produce content tailored for what was going to be showing up in the game.
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

I would like to retrieve the system definition type as well, which would allow me to know what systems were going to be created in a network.
hmm if I had to do that without a new function there would be three different approaches

put the system type in the node name, then you could just use the find function in .99 to find out what type it is

put some data on the sun or make a marker of some kind different for each type, this has the disadvantage only being able to tell when in the same system

put it into the data at the beginning of the game and use that data to override the real system type.
Crying is not a proper retort!
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Periculi wrote:And, the name is one thing I am particularly after for mapping and other content generation purposes. Knowing that SE connects to C1 doesn't tell me if C1 is Groombridge, Lalande or 5 Indi.

So we can traverse the gates and get node ID returned. That's a good start. But where do those functions get a level indication to enumerate the level 5 or whatever systems? How do we retrieve the name of the system, the level, or even possibly make use of the variant value?
Yeah, I didn't have the complete list of functions. I've also added:

(sysGetName [nodeID])
(sysGetLevel [nodeID])
(sysHasAttribute [nodeID] attrib)

(attributes should help you instead of variants)
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Periculi wrote:Is the information in the Node tag that pertains to the system also resolved into a single value- the name and system definition to use?
Yes.
Periculi wrote:Oh, and does OnGlobalSystemCreated work in items? In the playership? Is that the menaing of event on any type?
Yes.
Periculi wrote:How much information could some form of function like (sysGetNodeData [nodeID]) retrieve for a given uncreated system from Eridani at the beginning of the game, hypothetically.
Not sure I get the question. You can retrieve whatever information you put in (it is just like (objGetData) et al). Use (sysSetNodeData) and (sysGetNodeData) to store your own data and use it for your own purposes. The functions work for both created and uncreated systems (since they operate on nodes).
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

ooh very nice george thanks for the new info
I am looking forward to .99 alot. There must be tons of new functions.
Crying is not a proper retort!
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

It's not implemented yet, but I should also add:

(sysGetSystemType [nodeID]) -> system type UNID

[Edit: Now implemented in 0.99]
Last edited by george moromisato on Wed Jul 16, 2008 1:30 am, edited 1 time in total.
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

hmm where are system attributes?
Crying is not a proper retort!
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Betelgeuse wrote:ooh very nice george thanks for the new info
I am looking forward to .99 alot. There must be tons of new functions.
Cool, I'm glad you like it! I wouldn't say there are tons of new functions, but I tried to add a bunch that were easy to add and that people had suggested.

BTW, I'm still on track for an end of July release of 0.99. I'll give a more definite date after this weekend.
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

Wow, this has turned into a great thread. :)
Not sure I get the question. You can retrieve whatever information you put in (it is just like (objGetData) et al). Use (sysSetNodeData) and (sysGetNodeData) to store your own data and use it for your own purposes. The functions work for both created and uncreated systems (since they operate on nodes).
I guess the question should really be:

If a function existed that could retrieve all the information on a given nodeID that is not the current or a created system, such as at the very beginning of the game, what information would be returned?

However, you are apparently providing all the functions I could desire to sniff out the network details I want. (And a huge thanks for that!)

How do I set attributes on a nodeID, and what attributes are there?
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Betelgeuse wrote:hmm where are system attributes?
Attributes can be added on the System tag:

Code: Select all

<Node ID="SE" ...>
   <System name="Eridani" ... attributes="newBeyond">
   ...
</Node>
You can then test for them with (sysHasAttribute)

All systems before St. Kat's have the attribute "newBeyond".
St. Kat's is marked as "stKatharine"
Systems after St. Kat's and up to and including Jiang's star have the attribute "ungoverned"
All systems after that have the attribute "outerRealm"

If you create your own nodes, you can obviously use whatever attributes you want.
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

interesting could be used to generate themed systems.

Can the SystemType tell what is in there so it can change what tables it uses dependent on the attributes? (more so we don't have to generate the stations when we enter the system)
Crying is not a proper retort!
Post Reply