-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPC can wander outside of settlement map #10
Comments
I don't recall seeing this behavior in my builds. Maybe I missed it...? In Threat of the Trinity NPCs stay within the town border, though I did modify most of the code around this both long ago and recently. I can't recall what I did precisely. |
I can force the issue with the jester in moonglow by standing in front of him while he attempts to move an eventually blocking in on the left or upper edge or in the corner and he will eventually attempt to move outside the map boundary and the code will flag an exception trying to access a less than zero array index in x32x32[][]. |
Hmph. I can't replicate this behavior in the original DOS and TotT. I have not tested a build of u4-decompiled though. |
There could be other code below this function that prevents the actual move but I don't get there after the exception when it accesses the out of bound array. |
I thought something like that. Which might mean this exception is an artifact of your build environment? |
Interesting view.... |
Oh, fer-cryin-out-loud @plaidpants, I thought surely no one else had this idea about a nearly 40 year old game! (sorry for the thread hijack) |
@plaidpants I couldn't reproduce the problem either. update: sorry, I didn't see read your post concerning the exception yet. |
I tried a few things (#pragma's and such) but I don't seem to be able to disable this check in VS2019, might also be OS enforced so I am not able to see if anything downstream is impacted. Your plan for a comment sounds good. Unhandled exception at 0x00007FF68D5887F7 in UN_U4.exe: 0xC0000005: Access violation reading location 0x00007FF78D5C231F. |
That looks cool. Putting the map on a toroid? |
I managed to reproduce the exception. So it seems to happen only in x64 mode, and only in the cases where I may leave the issue opened while thinking about it. btw, I too like the toroid view. Can you upload an animated view in youtube ? |
@ergonomy-joe I didn't create the toroid view, @jaredr did, but here is a youtube video of mine in action Original Ultima 4 in VR |
I just changed the comments in the code to explain the issue. I think this will do for now. @plaidpants nice video |
Some video of the toroid: https://youtu.be/hZl2ixrNMH8 |
That looks really cool! |
Fenyx4 thanks for sharing, looks great. |
Needed to add this code to prevent the npc from wandering outside of the currently loaded map. This is especially evident in moonglow where the town doesn't have any walls and the wandering jester will wander out of town and cause an exception in the code.
The text was updated successfully, but these errors were encountered: