Skip to content

Conversation

@mandlar
Copy link
Contributor

@mandlar mandlar commented Jan 8, 2025

#24

This PR is bringing CUO up to version 0.1.8.0. I fixed a number of issues and bugs that came up from migrating CUO. This build seems to be fairly stable in both Unity Player and on my Android phone. There could potentially be issues I haven't discovered yet.

  • I flagged all changes from CUO with the // MobileUO: comment to make it easier to spot changes when upgrading from version to version
  • The assistant is still working, I kept the old Packet.cs class ONLY for the assistant so it wouldn't be broken. In the future, it should probably be re-written to use the new PacketHandler (or whatever it is in later CUO versions).
  • ScrollArea UI control was re-written, I split out the old version into AssistScrollArea and put it inside of the assistant so it wouldn't break anything. In the future, someone should re-write the assistant to not use the old ScrollArea control anymore
  • I added the CUO version number that MobileUO is based off of inside of CUOEnvironment.Version
  • Rendering code changed quite a bit in CUO. I had to make a few changes to get things working, mostly by keeping some of the old rendering code and mixing it in with the new camera code. Someone else can probably make it work correctly, but I'm not experienced enough in Unity/XNA/graphics to do it myself so I hacked the old and new bits together
    • had to set _use_render_target to true, otherwise the rendering was a bit broken with the new rendering system
    • the game window was deattached from the view port (it was rendering everything at 0,0 origin), so I adjusted that
    • Fixed a bunch of other boundary conditions/offsets, especially for mouse input and the viewport
    • Used old logic of WorldToScreen() and MouseToWorldPosition() for camera
    • Used older version of GetViewPort() for world rendering
    • SetDataPointerEXT() isn't implemented in our version of XNA, so I kept old versions of using the SetData() implementation
  • I reverted the recent PR for music as it was incorrectly playing the same song everywhere in Unity Player and Android. Will revisit in later CUO versions when we catch up to the original patch
  • The resource files (.resx for strings) cannot be included in the main Unity project as Unity won't load them. I had to create a separate csproj to build a dll JUST for the .resx files in order to get Unity to read them. This solution might change slightly later in 1.x when CUO's folder structure changes.

I think that sums up the highlights. At this point, I'll continue migrating CUO version by CUO version and fixing issues as they come up. Once we hit 1.x a lot of the project structure changes due to conversion to .NET Core from .NET Framework

new rendering method does not work correctly, but reverted to old method via _use_render_target flag
…builds the dll into the Unity assets folder in order to get these files working inside of Unity. The files are still symlinked to the original ones.
…t the old version of ScrollArea control into the assistant so that it would only affect the assistant and not everywhere else. The more optimal solution is to re-write the assistant with the new ScrollArea behavior
…playing the same (incorrect) song everywhere in both Unity player and Android. Will re-visit later with CUO uprades
@VoxelBoy VoxelBoy self-requested a review January 8, 2025 12:33
@VoxelBoy
Copy link
Owner

VoxelBoy commented Jan 8, 2025

Wow, great work. I will run a smoke test of sorts on the branch and go over the changes to hopefully merge it in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants