Avorion Forum

General => Mods => Topic started by: koonschi on March 22, 2017, 12:58:11 PM

Title: Announcement: Entity.index Changes!
Post by: koonschi on March 22, 2017, 12:58:11 PM
Entity Index Change to UUIDs
I'd like to inform you beforehand that we'll be changing the Entity.index from a 32bit number to a 128bit uuid.

Why's that?
Because it's about damn time! I wanted to do this for a long time but I always thought "later will be a better time". Well, it is later now. We're doing this change because we've always run into problems with the 32bit number. Entity indices have to be changed often, for example whenever changing the sector, leading to issues when turrets (which are their own entities) have to find their parent, which has been an issue that's been popping up recently. With the introduction of the new 128bit number, we can easily assign fixed, server unique IDs to entities, without having to worry about duplicates, even on a server-global scale.

When is it coming?
Sooner, rather than later. I'm not sure how and when we'll introduce the change, but we're currently working on this since it will pave the way for other features, fixes, improvements and simpler code. It might come this week, next week or in a month. But it will definitely be part of one of the next patches.

Why are you telling us this?
I'm telling you, because I wanted to give you a head's up of a fundamental change that might affect you. If you've been using the Entity.index property as a number, then you'll have to adjust your mod. If you've been using it solely for comparing entities or checking if an entity is there, etc. then you probably won't even see a difference. I'm working on making this transition as painless as possible.

But I don't want to adjust my mod, can't you just work around this?
No. We've been working around this problem for a long time and it's lead to more problems than it avoided. It's time that we make this change, even if it might break a few things or if things have to be adjusted. This is the long-term solution and it will make a lot of things a lot easier.

I wrote a mod that uses the index, what should I do now?
If you've been using it only for comparing entities or checking if an entity is there, etc. then you probably won't have to do anything. Entities will receive unique IDs upon first loading of a save, and they will keep those ids. If you've saved IDs into files or in other places, then you will have to adjust that.

How will the new Ids look like?
They'll be normal UUIDs, meaning they'll have 128 bits and when you print them they'll look like a string of hex numbers, separated by dashes: 6a12a4d5-e9e6-4568-afcc-34c70b24a668

I think that's all you have to know for now. I'll let you know if anything else comes up.
Have fun!
Title: Re: Announcement: Entity.index Changes!
Post by: Nexus on March 23, 2017, 05:54:12 AM
Thanks for the heads up. Thankfully I get all the ID's at runtime so it shouldn't be much of a problem  =)