Skip to content
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

v2.0.0 features and fixes for vehicle initialization and rendering #62

Conversation

zolantris
Copy link
Owner

@zolantris zolantris commented Apr 8, 2024

(Raft +Vehicles)

Features

  • Adds rudder prefab without connecting it. Has snappoints for the connection part of the rudder.
  • Adds hull prefab without much logic attached to boat floation. Hulls are basically 3x6 planks but in a half cylinder. Has snappoints for all edges that match a 2x2 wood plank size.
  • Adds support for rendering V2.x.x ValheimVehicle WaterVehicle which is a raft replacement.
  • Adds snappoints to rope anchor.
  • Adds snappoints for masts. Yes, they can now snap to the ship floor if auto is deselected.
  • Adds snappoints to Raft Wheel aka. (MBRudder)
  • Adds PrefabRegistryController which makes the prefab registry call for all prefabs. Each prefab will eventually have it's own file for organization to make it easier to find specific prefabs and fix their logic.

Fixes

  • Fixes ActivatePendingPieces. Likely resolve detached states of masts and steering wheels. Optimizes much of the raft re-renders. Whenever a raft instance currently exists it will active the pending

TODOs/Issues (these will be added to the epic PR epic/raft-and-vehicles-v2)

  • Fix SteeringWheel rudder references in older rafts. The new system breaks older raft attachments
  • Fix SteeringWheel animations on new and old rafts.

Sentry Unity

Makes the logging service extensible by making all Unity BepInEx packages considered a scoped package when registering with the framework. Incompatible with unity packages that directly call Sentry.Init. Sentry must be managed from this package otherwise the scope and delegation will not work unless Sentry.Init from this package is called last.

Features

  • Adds Sentry package for Unity projects error logging. The framework should allow for multiple projects to register error logging separately and not conflict. This needs more testing, but will be released for all valheim projects and potentially all UnityBepInEx projects... The Sentry package is builts as an opt-in logging service. ValheimRAFT and ValheimVehicles will not require it. If the user install it, it will be used, if they do not, it will not be used.

… cross compatibility. Need to revert this next commit
…ues with cross compatibility. Need to revert this next commit"

This reverts commit 9291bda.
…not be referencing these new routines in the older MBRaft
…nt interfaces for referencing the boat controller
…guards to WaterVehicleController so it does not need to added when the prefab is created like the previous ship awake patches were being used
…T as a separate dependency that is only turned on if it exists
…make wheel have snappoints that match valheim's data translations
- Make the raft wood larger. The prefab is set to a large scale to make
  the initial raft easier to make
- add support for hud triggering for the boat
- add more guards to a few methods
- Make hullcomponents initialize a ship if they are detached and have no
  references to a ship zdo.
…ngs problem, but may need to do the re-write to understand things better first
…ews, but still not able to get the views to remain rendered when loading a temp inactive component. The component gets garbage collected within milliseconds of its adding to the current view
- WIP fix ship, but still have pending item problems,
- add snappoints to masts
…ly. The new ValheimShip renders properly now
- add support for snapping for ship_rudder_advanced and
  ship_rudder_basic
- add snapping support for rope_anchor
- add ship_rudder_basic and ship_rudder_advanced unity assets
- update bundle with new rudder values, also make the wood color darks, rope anchor
- split asset bundle into 3 parts 1 shared, 1 for raft 1 for vehicles
- add support for most prefabs to be a single file of related functions
  calling register
- cleanup a bunch of name sharing using PrefabNames instead of pointing
  to the controller
- use GetPrefab instead of using a save instance when creating a hull.
  This may need to be reverted if it makes things slower
@zolantris zolantris changed the title Fix/custom gameobject causes znetview removal v2.0.0 features and fixes for vehicle initialization and rendering Apr 8, 2024
@zolantris zolantris merged commit ee9c4ee into epic/raft-and-vehicles-v2 Apr 8, 2024
@zolantris zolantris deleted the fix/custom-gameobject-causes-znetview-removal branch April 8, 2024 02:02
zolantris added a commit that referenced this pull request May 17, 2024
* v2.0.0 features and fixes for vehicle initialization and rendering (#62)

* move files around for valheim vehicles

* use the dynamic keycode for the raft anchor hint instead of hardcoded LShift

* start adding logic to valheimvehicles and adding hull enums/const value definitions

* add the run key fallback if the raft custom key is not set make the run
keycode show in raft steering wheel

* port most of the raft code to the WaterVehicle and BaseVehicle, will not be referencing these new routines in the older MBRaft

* Fixes many types for RopeLadder and Rudder which now need two different interfaces for referencing the boat controller

* WIP issues initializing the boats with hulls

* attempt to decoupled ship to work with hulls

* WIP still not able to get the object to spawn with NREs for wearNtear

* WIP, create a prefab instance of WaterVehicle which contains the same amount of components and ships

* attempt to fix ZDO util issues with netview

* add full prefab for testing ship issues

* fix initialization by binding correct items for prefabs and add more guards to WaterVehicleController so it does not need to added when the prefab is created like the previous ship awake patches were being used

* WIP issues with raft not allowing items

* add steps for connecting a step debugging specifically for rider

* add quick tutorial on sentry install with nuget

* add sentryunityplugin package

* make sentry-package build and add readme, integrate within ValheimRAFT as a separate dependency that is only turned on if it exists

* add SentryUnity runtime dependencies of 1.8.0 only, so the package and build

* ship now floats correctly

*problems with ship still, most of this commit probably needs to be reverted

* add horem shader mocks

* fix folder generation issue

* fix prefab-rendering, add more guards too

* update assetbundle with sailshader changes by using vegitation mock and combining with previous sailshader

* add new ship_hull prefab, tweak scale

* BREAKING!!! re-organize all patches

* Sanitize scalar sizes of raft items, add better layering support and make wheel have snappoints that match valheim's data translations

* start connecting new vehicle controls to ship, also fix a bunch of initialization issues with the new hull

* fix patch refactor error and add nameof to show usage of the patch dependency

* refactor a bunch of components into Interface structure

* wip attempt to fix steering wheel and ship movement

* fix transfrom issue with initate of controlsgui

* attempt to get sentry scopping working

* make raft floor larger, add unity scale to object

* cleanup sentryunitywrapper integration so it does not get added within ValheimRAFT

* remove unnecessary rigidbody nesting after the WaterController items were nested within the VVShip prefab

* - add support for using rudder on the new ships
- Make the raft wood larger. The prefab is set to a large scale to make
  the initial raft easier to make
- add support for hud triggering for the boat
- add more guards to a few methods
- Make hullcomponents initialize a ship if they are detached and have no
  references to a ship zdo.

* WIP issues with rendering after leaving a zone, attempting to fix things problem, but may need to do the re-write to understand things better first

* add a bunch of wearntear protection patches to prevent breakage of views, but still not able to get the views to remain rendered when loading a temp inactive component. The component gets garbage collected within milliseconds of its adding to the current view

* Ship still not rendering correctly

- WIP fix ship, but still have pending item problems,
- add snappoints to masts

* add slightly better approach to avoiding race conditions when creating a new ship

* add boxcollider to raft hull gameobject in unity

* Add a GhostRender pattern for Vehicle prefabs that initialize complexly. The new ValheimShip renders properly now

* WIP fix ship deletion by preventing wearntear destruction

* feat(ship-rudder): adds ship rudder

- add support for snapping for ship_rudder_advanced and
  ship_rudder_basic
- add snapping support for rope_anchor
- add ship_rudder_basic and ship_rudder_advanced unity assets
- update bundle with new rudder values, also make the wood color darks, rope anchor

* valheim-vehicles prefab controller

- split asset bundle into 3 parts 1 shared, 1 for raft 1 for vehicles
- add support for most prefabs to be a single file of related functions
  calling register
- cleanup a bunch of name sharing using PrefabNames instead of pointing
  to the controller
- use GetPrefab instead of using a save instance when creating a hull.
  This may need to be reverted if it makes things slower

* Fix prefab controller

* stable prefab loading

* fix onboard collider name references

* fix ship rendering, but still have hulls duplicating

* update assetbundle and fix wood color

* fix ship rendering jitters by initializing within WaterVehicleController for hull. This was caused by water collider settings. Will look at this in a separate focused PR.

* Feat/v2 sailing and prefab updates (#69)

* make MoveableBaseRoot checks secondary to new ship logic

* initialize Base values for sails so VVShip can control sails hoisted and mast direction

* Sailing and Piece fixes

- make raycast check more efficient for new vehicle, avoiding second
  check
- make Sail and Ramp Edit components work with asset bundle split
- remove assetbundle reference in top level plugin

* add workarounds for MoveableBase for registering rudder and ship controls

* - add blender file for vehicles mod
- add sprites
- split sprites to shared bundle and vehicles only bundle
- sprites are not spriteatlasv2. This cannot be reverted via unity, but
  this commit can be reverted to restore the icons
- fix snappoints of hull component but likely will need to reset the transform in blender

* - make the rudder rotate in direction wheel rotates
- make wheel rotate well again too.
- Compatibility - add support for bed coordinate update.

* add exported hull from project that was resaved over the new rudder

* fix hull meshes so they snap better, fix/restore overwritten blender file

* update new valheim libs after game update 0.217.46 which updates unity to 2022.3.17f

* update jotunn reference to 2.19.0

* add lower poly version wood for performance reasons

* re-organize materials and shaders. Add GPU instancing for all materials besides sailmat which likely cannot receive it since it is dynamic. May need a shader tweak

* signifantly reduce assetbundle size by removing large wood textures

* fix triplanar positioning issue as it was using world position instead of local position, shaders no longer move when the ship moves for blackmarble

* Fixes and QOL optimization:

- fix rendering for boat logic using a placement listener to hide the
  prefab.
- fix 0.217.46 regression with materials being null and attempting to
  access data on a null reference
- add prefab rendering for vehicleShip so it does not require as much
  code and runtime.
- optimize colliders on the ship.
- tweak the float collider to use it's current y axis instead of a
  hardcoded value.
- add support for turning the ship direction based on rudder or wheel.
  Not fully functional, but it works in 180 degree rotations from
  original spot currently.

* more tweaks

- attempt to make wheel avoid camera collisions which jitter everything.
  Done via changing layer for colliders
- add a helper to visualize ship colliders via linerenderer
- Update encapsulation logic to include ALL item collider bounds
- Add a heavier method that looks at all render child nodes. This is an
  opt in config via EnableExactVehicleBounds. Only applied to v2.0.0
  ship for now.
- Add better logic so when removing pieces the colliders are updated.
  v2.0.0 ship only.
- Add worldcenter position logic for v2.0.0 ship that gets the first
  rudder or first wheel and sets the pivot point there.

* tweak encapsulation logic

* refactor back to synced transforms for watervehicle due to rigidbody including all prefab piece colliders in it's calculation which caused issues with float, and blocking colliders calcs

* fix collider logic to include localPosition points of all colliders within a piece added, fix bounds issue where it did not pass the current value to a method

* Fix most issues with raft colliders yay! The debug output drawing boxes will also help others debug problems if they come up with large or smaller ships

* - more collider tweaks, but still having problems centering things
- add the collider debugger to the moveable base raft for testing

* WIP almost fixed collider alignments

* stable collider calculation, now just have to local transform correctly

* update logic on BaseVehicleController to exactly calculate colliders

* bad vector code

* Restore possibly working collider calcs

* feat(colliders)

- colliders now align properly with boat.
- colliders have fallback checks to ignore areas of the raft that would
  cause the raft to increase size by extreme amounts.
- adds wake expansion and centering similar to bounds based on ship
  hulls

* revert unity back to previous setup without tests

* add LODGroup for ShipWheel

* Refine collider setting so it is much more accurate for local vs global

* fix planbuild for raftmod, change guid as v2.0.0 is a breaking change

* Fix ship collider logic by using Physic sync command before adding Pieces

* update to unity 2022.3.17f1

* - Attempt to fix sailmat shaders with fog
- remove the 5mb and 9mb sail and sail_normal files. They seem to not be
  needed

* - move all assets for valheimRaft under vehicles main folder for organizing project vs other lib import assets
- remove Deprecated assetbundle, there are many new optimized assets in
  new bundle, no need for the old one

* Add vehicle commands and boilerplate for locating a vehicle, not yet implemented

* fix hover for wheel on vehicleship but not mbraft

* feature and bug fixes

- tweak metallic colors and rename some materials to match their usage
  semantically.
- [performance] disable wood reflections
- [performance] switch secondary wood normal maps to primary
- add keel prefab. This will be used for water effects. Additional Keels will
  make ship water effects extend past rudder. TODO future, keel variants will allow
  upwind sailing.
- adds switch prefab. Does nothing so far, but is ready to have a toggle
  system added to it.
- [fix] ship sailing logic.
- [fix] ship rotation logic. The ship will now rotate based on first rudder or wheel placement. Likely will adjust to only apply for rudders.

* BREAKING! update translations for mbrudder, to valheim_vehicles_wheel and add a easy way to map prefabnames with icons, name, and description

* cleanup for unity

- cleanup unity objects
- add icons for new prefabs
- add fixes for blocking collider so it pushes hull upwards
- attempt to fix ship controls bug with player. But may need to revert
  back to original approach with multiple controls being added however
  there would need to be a validation step upstream to prevent multiple
  players from controlling the ship at same time.

* - issues with wheelprefab animations left hand moving repeatedly
- issues with ship not moving when wheel being controlled, likely the
  ship is not being considered valid somewhere

* Fix rotation colliders by using a bounds point calculation on a rotated collider parent

* fixes for colliders during rotation and sailing

- sailing now point in correct direction when wheel is changed
- sailing wind direction matches global direction transformed from front
  of ship based on wheel
- ship colliders are now based on the hull, removing hull will make
  the colliders guess at a near lowest bounds.
- rotation keeps being a problem so near 90 and 270 degrees have a transform. It needs more tweaks before ready.

* - fix SteeringWheelComponent offsets so the lefthand and righthand
  update correctly on the X axis and not an inverse.
- use dead center for ship controls to accurately determine the hand
  attachpoints and roatation
- rename RudderWheelComponent to SteeringWheelComponent

* update rudder to only use a capsule collider and align the capsule with rudder orientation

* add a better designed hull called ship hull advanced with flat hull bottom, design WIP

* Rotate a point within FloatCollider and not the bounds, and it allows for bounds to not have to be redrawn on rotation or do calcs on a rotated bounds.

* add GUI for new ShipWind indicator

* integrate new GUI for ship hud. And cleanup some components

* add back full res stag icon, and tweak a few things with steering wheel removal, tweak boxcollider logic for blocking collider to be just above float collider

* - fix ship unloading for teleports so base vehicle properly unmounts before destroying gameobjects within itself IE teleporter.
- Calling Destroy before this will cause the netviews within it to be deleted is game breaking.

* feat(flying,hull prefabs, and metallic color tweaks)

- Improve the custom update logic
- Add flying tweaks to make velocity less insane.
- Improve delegation of logic for physics. So most of the logic is
  within VehicleShip instead of some updates being in the
  BaseVehicleController
- Add Wood, Iron, ribs which are a combo of 2x2 slabs
- Add slabs but not integrate as pieces yet. These are 4x4 pieces of
  wood or iron.

* fix return issue with UpdateAnchorVelocity

* - organize updating for sails and rudders
- add support for rudder speed changes
- add support for vehicle flight to only use rudder speed
- add less realistic vehicle sail speed which does not blow the vehicle
  in the direction the wind is going but instead the direction the ship
  faces in the air
- add some helpers for most of the Physics FixedUpdate logic for the
  boat to organize things and cleanly separate concerns.

* integrate the blocking collider logic to use hull only, this will prevent random rocks and items from causing collisions for boats that are taller above water

* stablize ship flying by directly setting ship rotation to flat value

* slightly improve the auto toggle feature

* fix moveablebase ship control compatibility

* fix raft creative command, and get MoveableBase compatible with steering

* remove many debug logs

* update unity

* fix baseVehicle not adding a piece when it was active

* stability and other tweaks

- Add anchor icon for ship hud whenever MBRaft or VehicleShip is in
  anchored state
- Add Compatibility class for VehicleShip and Ship so future updates
  requiring type overrides do not require casting to access similar or
  equivalent methods

* fix hovertext for steeringwheel when disabled

* - fix physics update by adding a Invoke delay to prevent larger ships from crashing game on unload
- cleanup unused code and remove ongui sections used for debugging but
  not useful for users

* add slabs to raft, include slabs and other hulls as vehicle hull bounds, remove the hull component as it is not being used right now

* change unity prefabs, add slabs, fix sail color setter in SailComponent

* update the sailshader to properly use Alpha channels. Add a _MistAlpha that controls the mist fade in mistlands for sails

* remove many of the unnecessary properties added to sailshader in attempt to get it compatible with mistlands

* WIP, align hull ribs, add 2x2 variants and wall variants for 2x2 and 4x4 slabs but need to rename the registry components

* add automatic sprite generation script for the valheim raft unity project prefabs

* restore ship pieces

* - tweak iron colors

- fix snappoints for ribs, add selector for rib snappoints

- add advanced rudder iron (similar to a sub fin with double rudder
  tail)

* - fix torches increasing size of trigger area by extreme amounts due to colliders outside of piece layer being counted

- fix issues with snappoints not being aligned for top of 2x2 slab and
  wall prefabs

- Fix steeringwheel break so it does not bail when array is mutated by
  cloning the array that's iterated

* Fix teleport issues by waiting until the zone is loaded and firing a physics update before updating the position of the player due to the position not matching the raft likely due to the raft portal being in the middle of moving into the area

* cleanups and try to fix sailshader regression by restoring the older properties.

* Feat/raft v2 ashland compatibility (#70)

* add all the 0.218.15 patch libs including updating jotunn 2.20.0

* WIP possibly crashing valheim after updating it on this branch

* fix sail creator

* fix groundcollider and ship controls

* fix both base ship and vehicle ship huds so they do not interfere

* Sail logic improvements

- swap sails to a prefab
- remove rotation for sails. This was never stable. Not supporting it.
- remove SailRotationFromEdit Menu
- remove all rotation references from EditSailComponentPanel
- Swap to loaded assets for panels instead of dynamically loading per
  panel.

* - tweak fading logic for mistlands sails to be a bit nicer and more abrupt but not a full fade with a very very small outline
- update manifest to fit character cap for thunderstore
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.

1 participant
  翻译: