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

Migrate netcode to use Moffat.EndlessOnline.Sdk (eolib-dotnet) #353

Merged
merged 53 commits into from
Jun 5, 2024

Conversation

ethanmoffat
Copy link
Owner

@ethanmoffat ethanmoffat commented Jun 1, 2024

This is a MASSIVE change involving a rewrite of all the netcode handling.

Instead of a manual process of using PacketBuilder to send packets and Packet to read data from packets, all data handling for packets is now handled by code generated from eo-protocol. The implementing library for this is eolib-dotnet (i.e. Moffat.EndlessOnline.Sdk), which generates structures that serialize/deserialize packet data to/from raw streams of bytes.

With this new method, manual reading/building of packet data is no longer necessary. Data reading/writing is separated out as a responsibility of the eolib-dotnet library, meaning packet data reading/writing is no longer scattered throughout the application code. Packet handlers are solely responsible for taking the already parsed data and handling it accordingly. Packet translators are no longer required since the data is already

A design change was necessary for packet handling. A generic type was introduced for packet handlers, and packet objects are constructed via reflection by picking a packet type from the packet id in the raw byte stream. Instead of receiving an IPacket interface and requiring a cast, packets are passed to the handlers as strongly-typed objects that are already deserialized and converted from the raw byte stream.

A number of bugs and missing packets were implemented as part of this change. Additionally, the PacketDecoder project was completely removed, since a complete reference for the packet specs exists in eo-protocol. For all the details, see the commit history of this PR.

There are a couple additional cleanup items that remain:

  • Use the Moffat.EndlessOnline.Sdk types for file I/O instead of EOLib.IO. Evaluate the necessity of continuing to maintain EOLib.IO.
  • Evaluate the value of EOLib.Logging and necessity of continuing to maintain it.
  • Implement missing functionality. A number of features (packets to handle) that aren't present in vanilla eoserv/etheos were opened as issues for later work.

Proper send of chair packets when encountering a chair
- Capitalize player names
- Ignore overwriting main character class ID
- Ensure other players are added to map state repository
Fixes crash bug when attempting to re-serialize packets with invalid incoming data for logging purposes.
Fixes bug with arrays where only half the array would be loaded. Also fixes generated ToString implementations.
Only clear actors that have a renderer associated with them. Fixes bug where requester would repeatedly request the same actors and erroneously remove them too early.
Fixes issue where interval was not reset, constantly firing requests for the same entities and clearing out of range actors
Hat bitmaps now correctly only clip black pixels if the transparent color is present on the bitmap.
- Don't make fully transparent on up/left direction
- Remove some commented code that was erroneously committed
- Instead, debug log their packet id and ignore them.
- Example: BU pet code that sends a packet with a 0_0 packet id.
- (255, 255) used when dropping via inventory panel button.
- Item drop packet sends double-encoded coordinates, hence the (1, 1) offset.
- The official client uses (255, 255) for the inventory panel button. This is now replicated in EndlessClient.
Fixed-window mini map renderer was using incorrect coordinates when drawing entities. Fixes issue where entities would be rendered too far to the side of the screen.
Attempting to animate next frame for an NPC that is not doing the expected action would sometimes put the npc's frame out of bounds, which later caused a crash when attempting to load the texture for that (non-existent) frame.
Use private method and unregister the event when the associated renderer is disposed.
Reduces memory allocations in frequently executed code for temporary hash sets.
- CharacterRenderer: don't reallocate RT color data array unless recreating the target.
- MapRenderer: use for loops instead of foreach loops to reduce garbage generated from enumerators.
- MainCharacterEntityRenderer: direct comparison instead of call to params method with only one parameter.
Fixes party member HP update not showing in panel
Fixes rendering issues with players walking over spikes. Relies on presence/absence of a character on a spike tile to determine if the spikes should be rendered instead.
Timed spike tiles now correctly show the spike object when a timed spike packet is received.
- Drop warning now prevents drop unless you do it again
- Item_Agree handled
- Junk/Kick item now doesn't remove gold from inventory
- Client can request songs again
- Jukebox shows warning for not enough gold
- You don't have to stand right next to jukebox to use it
- Added "click" sound when item offer changes for either player
- Fixed issue where the other player agreeing would make the main player agree
- Fixed crash in trade dialog when the other player cancelled a trade
- Fixed inventory panel not updating until 'trade completed' dialog was closed
I'm tired of maintaining it
Fixes jittery/slow rendering speed when the game is not the focused window.
@ethanmoffat ethanmoffat added this to the Version 1 milestone Jun 1, 2024
@ethanmoffat ethanmoffat linked an issue Jun 1, 2024 that may be closed by this pull request
@ethanmoffat ethanmoffat merged commit d5f2181 into master Jun 5, 2024
3 checks passed
@ethanmoffat ethanmoffat deleted the use_sdk branch June 5, 2024 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EOLib.Net - generated packet code
1 participant