Expanding Tables with Typcreate?

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

I've seen claims that it's possible to use typcreate to add lines to a table (eg. tbCorpDefenders) but can't find any documentation of how to get the table into a string so this can be done.
Literally is the new Figuratively
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

I do it in this mod.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

It looks like you're not directly using the vanilla tables.

When typcreate was first suggested, Taben also requested a function to read an XML type as a string for manipulation. That is what I need. If I can't read the original table at runtime there's no advantage to constructing the replacement table at runtime.
Literally is the new Figuratively
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

You can't read the XML at runtime sadly unless George added it in a later version.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Jeoshua
Militia Lieutenant
Militia Lieutenant
Posts: 163
Joined: Sat Sep 06, 2008 3:48 pm

Definitely can't read XML itself. I just spent 3 days searching over the available information and trying to code something that required reading XML and modifying it. Completely not in the game, not even indirectly. Only certain parts of the XML are exposed in various methods, and never raw XML. By the time the script code ends up running, the XML doesn't even seem to still be in memory (unless you've made some fake XML in a <StaticData> block.

The lack of this (or other alternatives) turned what could have been a 3 line fix into a 50 line kludge.
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

The XML structure/data is indeed discarded after read it; the relevant data is stored in C++ objects. At game start, the engine does not know about the original XML nor its structure.
george moromisato wrote: Why do we do this? For efficiency. We need to access a ship's mass to calculate motion. We do that once per ship 30 times per second. If there are 100 ships in a system, we're accessing that variable 3000 times per second. A quick member-variable access is a lot faster than a hash table lookup (plus potentially a string-to-integer conversion).
There is a proposal that would change this (go read the thread, it could be informative).

Cheers,
Pixelfck
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
Post Reply