DaanVandenBosch / phantasmal-world

A suite of tools for Phantasy Star Online.
https://www.phantasmal.world/
MIT License
24 stars 5 forks source link

Coordinates in 3D view differ from X, Y, Z values in scripts #17

Closed Shade53 closed 3 months ago

Shade53 commented 3 months ago

Hi, I've started using your quest editor in place of QEdit, since it is far more user friendly, however I've noticed that the coordinates listed on entities seems to differ greatly from the ones used in scripts. I have placed an NPC where I expect the normal quest starting position to be: image

But I see the coordinates in the entity panel are MUCH farther away from the default positions used in the script: image

I've even tried taking the coordinates from the script and placing them in the appropriate X, Y, Z and rotation fields(Y in rotation, allowing it to underflow the value) and I find the NPC to be out in space instead of on the Pioneer. The only thing that seems correct is the rotation value when it underflows produces a rotation value of 345, which works out great, but the NPC is still not in the place that I want the player to be: image

My concern is: How am I supposed to get accurate coordinates for the script in the 3D view?

I am running the newest clone of the webserver from your main branch, so I have all the newest features, is this working as intended and if so, is there maybe some math I should be using to convert coordinate values from the NPC's/Objects in the 3D View to the script, or will the script accept old QEdit coords AND new Phantasmal coords?

I can see that you have moved on to other projects for the most part, but any help would be appreciated.

DaanVandenBosch commented 3 months ago

Phantasmal world shows the same values as qedit, so at least we're consistent. It looks like the script coordinates are absolute world coordinates, while the object/NPC coordinates are section-relative. The quest editor doesn't have a way of displaying the world coordinates at the moment. I guess we have a good reason now to show world coords somewhere.

DaanVandenBosch commented 3 months ago

I've added world coords to the entity view, they still seem to be off from the coords in the script. A bit weird, but maybe the devs just tweaked one and forgot to update the other and it doesn't really matter to the game?

Shade53 commented 3 months ago

Oh yeah! It has been soo long since I last worked on a PSO quest I forgot that entities set their '0' to the center of the room/section they are assigned to. And just like that I was able to get the world coords by just setting the entity's section ID to 0. Was able to verify this by now taking the default p_setpos coords and putting them into the entity coords and the entity now ends up where I expect the player to end up!

It would still be nice if we could get a display of the coordinates based on "current floor center" for use with OPCodes that don't take room/section ID values, but for now I can work around this by just setting an entity to section 0, then placing it where I want to get the coordinates from so I can use the coords from the entity in the code. I just need to make sure I remember to delete the entity when I am done using it for coords.

I can close this as resolved, unless you would rather have me keep this open as a "Feature Request" of sorts for an easier way to get the "world coords" for OPCodes that use them?

DaanVandenBosch commented 3 months ago

This is exactly the feature I implemented, unless we're talking about two different things: image

Do you mean something else by 'display of the coordinates based on "current floor center"'?

Shade53 commented 3 months ago

Oh sorry, I thought you were still working on that since you said they were a bit off. But if they are only off by 1-2 then it would not matter that much indeed.

As for the "current floor center" I think I may have mistakenly assumed that the center changed when you changed maps/floors, like 0 in Forest 1 is different than 0 in Pioneer 2.

I went ahead and gave it a try in the prototype and it looks like it matches up close enough to the point that you can't actually tell if it is off or not from the normal quest 'spawn-in' locations. Though I do still have to remember to delete whatever entity I am using as a pointer I'll take that as a win since it's already soo easy to place down and delete entities in your awesome tool!

Keep up the good work, I'll update my copy of the build so I can take advantage of this new feature!