Skip to content

perf: redesign of area of interest - #743

Closed
paulpach wants to merge 8 commits into
masterfrom
aoi2
Closed

perf: redesign of area of interest#743
paulpach wants to merge 8 commits into
masterfrom
aoi2

Conversation

@paulpach

Copy link
Copy Markdown
Contributor

Same as #705, but not using a struct based delegate, instead the Interest manager has Send method

The AOI system we inherited from HLAPI and Mirror is poorly designed.
Its API requires O(n^2) algorithms, it is highly complex, and it is not flexible enough.

This PR implements AOI in a completely different way.
The NetworkIdentity and NetworkPlayer objects no longer track what they can see.

When the server spawns an object, all it does is raise the Spawned event,
the AOI system will subscribe to this event, and then show that object to all the relevant players.
Likewise, when a player joins, the AOI will listen for the event and show the relevant objects to the
newly created player.

In this fashion, we decouple AOI policy from NetworkIdentity and NetworkPlayers. The AOI system can keep the
relationship between them in a suitable structure.

In this PR, I implement the simplest InterestManager called GlobalInterestManager.
This Interest Manager will show all objects to all players.

Implement the class InterestManager to create any policy desired. I expect to create a Spatial Hashing interest Manager in the near future

BREAKING CHANGE: Removed NetworkVisibility, extend InterestManager and attach to the ServerObjectManager instead.

@paulpach
paulpach force-pushed the aoi2 branch 2 times, most recently from 9e1e616 to 6c0923e Compare March 27, 2021 16:39
The AOI system we inherited from Mirror is poorly designed.
It's API requires O(n^2) algorithms,  it is highly complex, and it is not flexible enough.

This PR implements AOI in a completely different way.
The NetworkIdentity objects no longer track visibility, and neither do NetworkPlayer.

When the server spawns an object, all it does it raise the Spawned event,
the AOI system will subscribe to this event,  and then show that object to all the relevant players.
Likewise,  when a player joins,  the AOI will listen for the event and show the relevant objects to the
newly created player.

In this fashion, we decouple AOI policy from NetworkIdentity and NetworkPlayers. The AOI system can keep the
relationship between them in any way that is suitable.

In this PR, I implement the simplest InterestManager called GlobalInterestManager.
This Interest Manager will just show all objects to all players.

Implement the class InterestManager to create any policy desired.  I expect to create a Spatial Hashing interest Manager

BREAKING CHANGE: Removed NetworkVisibility, extend InterestManager and attach to the ServerObjectManager instead.
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

83.1% 83.1% Coverage
0.0% 0.0% Duplication

@James-Frowen James-Frowen added the Work In Progess Shouldn't be merged yet label Apr 1, 2021
@github-actions github-actions Bot added the has conflicts Pull Request has merge conflicts label Apr 4, 2021
@James-Frowen

Copy link
Copy Markdown
Member

Closing old PR

New AOI branch here #948

@paulpach
paulpach deleted the aoi2 branch October 18, 2022 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has conflicts Pull Request has merge conflicts Work In Progess Shouldn't be merged yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants