Replacing UNIDs with hashable strings

Post ideas & suggestions you have pertaining to the game here.
Post Reply
User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

Hello,

Myself, digdug, PKodon, Avan, and others were just discussing replacing the static unid tables with string hashtables in the engine, so that we don't have to hand handle lots of long hex numbers all the time. Hash lookups are likely fast enough at this point to be a viable alternative, and well-made libraries are plentiful.

Here's what I'm envisioning:

Code: Select all

<ItemType type="wvr/mod/itBlah"> (this is my mod)
<ItemType type="avan_tsb_itRDNGun"> (overwrite something in tsb)
<ItemType type="guy/itSomething"> (for someone who doesn't care about specifying mods)
<ItemType type="grm/core/itSomeItem"> (overwrite something in the core game)
<ItemType type="grm/a1/itFruit">
Sure, we'll have to yell at people to pick a name prefix and stick with it, but that should be less painful in the long run than getting people to pick unid prefixes, and it's less painful to extend as well.

I considered adding a <TranscendenceExtension ... namespace="/wvr/mod"> sort of declaration but it seemed better to have full disclosure in each item id created. A namespace like this could be used to do some checking, though.
Image
Image
Image
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

To add to the above (And point out why my example uses "_" instead of "/": One of the major points of the namespace being just a string, with the delimiters included, is that nothing but the modders need to be able to differentiate it - the game just cares about the string literal being at the front, in order to prevent conflicts, thus allowing the hashtable to work. This means that everyone can use the namespacing style of their choice, so long as its sufficiently obvious.

This is an issue for me since I know some people like to use their own prefixing style - it just needs to be obvious what it is. Alterecco uses "/" as in linux pathnames, and that trend got carried on by a few other modders. I use "_" because "/" looks to my eyes like its part of the same word - neurological issues make that hard for me to distinguish. I dont mind if other modders use it, I can slowly puzzle through their code, so long as I dont have to use it (and can use something that is easily readable to me and reasonably readable to everyone else), I'm happy.

(Not to mention all my current stuff is prefixed as such anyways (such as LRL_unidLRL15 or TSB_itAnsabiPositronBeam))
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
User avatar
PKodon
Militia Lieutenant
Militia Lieutenant
Posts: 127
Joined: Sat Apr 18, 2009 6:03 pm
Location: "Minocs. I've got a baaad feeling about this.... This is no cave!"

So, okay, I'm going to ask some questions here that I asked online, as I have little understanding of how these things work.

Currently, I use Notepad++ to do searches through all .xml files in my Transcendence directory (either Transcendence/CC source or extension source) for all mention of a particular object/UNID (this way, one way or another, I find both where it's defined, and where it's referenced).

I don't know how code would reference these new identifiers, where it currently uses UNIDs for reference.

I don't know how we could be warned that two different mods are trying to replace the same Vanilla object (or the same object in some mod).

And I don't know how my current means of searching through source would end up changing (instead of finding 4 instances of 0x12345678, would I find 23 instances of "Turbolaser" instead)?

Currently we have a list of "registered" UNID namespaces, would we just convert that to registered namespace prefixes? (for example, mine might be PK or PKodon.)

Would this kind of thing involve extra typing (on our keyboards) for everything when writing mods?

I probably have other questions, but this will do for starters.

PK
"Don't ask ..., I don't wanna know, and I don't wanna care!" - PK
Meet us on IRC --> Image
"... the hornet battlepod is the closest we have ingame to flying into battle in a wheelbarrow
with a bathtub nailed upside down to the top of it to provide armor."
- The Shrike
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

I deeply support this because it would make it easier for new modders to pick up the game and mod.
Also, it would make it easier for veteran modders to deal with very large mods with hundreds of UNIDs to declare. (and that could become very common if we want to make large adventures)
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

digdug wrote:I deeply support this because it would make it easier for new modders to pick up the game and mod.
Also, it would make it easier for veteran modders to deal with very large mods with hundreds of UNIDs to declare. (and that could become very common if we want to make large adventures)
like tsb..
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
Post Reply