Author Topic: The problem with the IDs.  (Read 1144 times)

War

  • "The top player is here!"
  • Level 20: Nobom
  • *
  • Posts: 1490
    • View Profile
    • My website
The problem with the IDs.
« on: January 09, 2020, 10:01:14 AM »
New objects don't take the minimal ID that is free, but the minimal ID that was never used.
For example, I have 2 objects, the first have the ID 1 and the second have the ID 2.
I delete the object with the ID 1, and I create a new object.
The new object will have the ID 3.
It should have taken the ID 1.
TingThing should make the new objects that the minimal free ID.
Hey, wassup wassup? My name is Warrior555MainsGanon (but just call me War) and I'm the main guy behind Megaman Zero Online and the upcoming Matt's Adventure! I don't speak often here but I'm a very friendly lad so if you wanna talk, don't hesitate!

saiwong3268

  • Level 6: Milder
  • *
  • Posts: 119
    • View Profile
Re: The problem with the IDs.
« Reply #1 on: January 09, 2020, 11:34:51 AM »
There is another issue with IDs. If you create a sandbox game and create some custom enemies
and then import it into a project that already have their own custom enemies, the IDs of the sandbox
custom enemies will change in reflection of which IDs have already been used in the project.

So you then need to go through all the command lines that referenced the sandbox custom enemies
and update them to their new IDs in the project. If you miss updating any IDs this will lead to many
unknown game behaviour issues.

Gizgord

  • average
  • Level 18: Statix
  • *
  • Posts: 835
    • View Profile
Re: The problem with the IDs.
« Reply #2 on: January 09, 2020, 01:49:35 PM »
There is another issue with IDs. If you create a sandbox game and create some custom enemies
and then import it into a project that already have their own custom enemies, the IDs of the sandbox
custom enemies will change in reflection of which IDs have already been used in the project.

So you then need to go through all the command lines that referenced the sandbox custom enemies
and update them to their new IDs in the project. If you miss updating any IDs this will lead to many
unknown game behaviour issues.
how do you want it to be any other way?
do you want to overwrite existing enemies just so the exported ones can have proper ID's?
if you want change ID numbers for those first ones, you have go update every command prompts anyway.

saiwong3268

  • Level 6: Milder
  • *
  • Posts: 119
    • View Profile
Re: The problem with the IDs.
« Reply #3 on: January 09, 2020, 05:14:51 PM »
how do you want it to be any other way?
do you want to overwrite existing enemies just so the exported ones can have proper ID's?
if you want change ID numbers for those first ones, you have go update every command prompts anyway.

The point I was making is that importing the sandbox level into the project results in a broken game
with incorrect references to enemies.

The solution to this is non-trivial and there are various ways to solve this (e.g. have a different ID system which are not using simple numbers that can overlap between sandbox/project).

One way would be similar to what happens when you convent assembly language to machine code and resolve JUMP type instructions.
What could be done is to scan through all the sandbox command lines that reference an ID and
"tag" and/or "mark" these entries, then when the sandbox code is merge into the project and
objects (such as custom enemies) are assigned their new IDs the "tags" are updated to reference the new IDs