Expanding Tables with Typcreate?
-
- 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


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.
Get on Discord for mod help and general chat


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.
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.
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
-
- 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


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.
Get on Discord for mod help and general chat


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.
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.
The lack of this (or other alternatives) turned what could have been a 3 line fix into a 50 line kludge.
- pixelfck
- 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.
Cheers,
Pixelfck
There is a proposal that would change this (go read the thread, it could be informative).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).
Cheers,
Pixelfck