-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix Reconnection Logic #168
Conversation
^ This has been fixed by Jeremie's SpacetimeDB PR |
c764afb
to
0bb78dd
Compare
0bb78dd
to
14cf1a3
Compare
5d47384
to
25a8c1b
Compare
14cf1a3
to
8c9c9e7
Compare
public class SpacetimeDBNetworkManager : MonoBehaviour | ||
{ | ||
private static bool _alreadyInitialized; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't exposed before to the users so this is not an API break
using SpacetimeDB; | ||
using UnityEngine; | ||
|
||
namespace SpacetimeDB | ||
{ | ||
// This class is only used in Unity projects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for the whitespace changes here, this file wasn't properly formatted before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -15,7 +15,7 @@ public sealed class RemoteTables | |||
{ | |||
public class CircleHandle : RemoteTableHandle<EventContext, Circle> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is automatically generated
746d728
to
547187e
Compare
602d07b
to
9c25cf7
Compare
src/SpacetimeDBNetworkManager.cs
Outdated
private void ForEachConnection(Action<IDbConnection> action) | ||
{ | ||
// TODO(jdetter): We're doing this for now because we can't break the API during a minor release but | ||
// in the future we should just change ActiveConnections to be a list so that we can reverse-iterate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ActiveConnections is already not part of the public API though? Or do you mean some other API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that ActiveConnections was referenced in the bindings somewhere and I was worried about creating an API break there, but I grep'd in the SpacetimeDB project for ActiveConnections
and there's nothing there so maybe you're right. Thanks for the heads up 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has internal
visibility so bindings couldn't use it even if they wanted to.
unity-tests~/client/Assets/Scripts/autogen/_Globals/SpacetimeDBClient.cs
Outdated
Show resolved
Hide resolved
a39e0a3
to
87fa4fc
Compare
ed0fcdf
to
3dcfbad
Compare
**Please do not rebase this PR** ## Description of Changes *Describe what has been changed, any new features or bug fixes* This is very similar to #176 except it imports the circle game as a submodule instead of copying the code over into this repo. This is the SpacetimeDBCircleGame PR that we're dependent on right now: clockworklabs/SpacetimeDBCircleGame#3 - This PR introduces a testsuite which runs in Unity. Right now it just spawns in a circle, eats some food and verifies the decay logic is working correctly. I've also written some reconnection tests but they don't work because reconnections are currently broken. There are also one-off tests but those don't work either because they also require reconnections to be working. Update: reconnections have been fixed via #168. I've used the built-in unity testsuite framework to achieve this, along with the UnityCI tool from GameCI. The documentation for this docker container can be found here: https://game.ci/docs/github/getting-started/ ## API - [ ] This is an API breaking change to the SDK *If the API is breaking, please state below what will break* Not breaking ## Requires SpacetimeDB PRs *List any PRs here that are required for this SDK change to work* None ## Testsuite SpacetimeDB branch name: 0935b7346b825b8cbb9f36d9ed256136b73b5f0b ## Testing *Write instructions for a test that you performed for this PR* - [x] The testsuite is passing: https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/actions/runs/11604456943/job/32313229775 You can follow test instructions here to double check my work: clockworklabs/SpacetimeDBCircleGame#3 ## Follow-up Actions - [ ] Rebase the reconnection logic PR onto this PR and re-enable the reconnection tests --------- Co-authored-by: John Detter <no-reply@boppygames.gg>
3dcfbad
to
56f82c3
Compare
the future Add testing section to PR description (#164) v Below is a render of what the new PR description looks like *Describe what has been changed, any new features or bug fixes* - [ ] This is an API breaking change to the SDK *If the API is breaking, please state below what will break* *List any PRs here that are required for this SDK change to work* *Write instructions for a test that you performed for this PR* - [ ] Describe a test for this PR that you have completed Working on a more ergonomic CI workflow Workflow runs on staging Small bug fix Test again speedup Use public bindings Use serial instead of license Updated default branch to be master Disable all but one test because we don't support reconnections right now Small update Fixes Testsuite uses local reference to SDK Added comma debugging One more debug Small changes small sed fix Small fix - newline character was messing up branch name Added debug Updated how branch name is populated We'll give this a try to make the C# SDK happy C# tests building! Updated README Small fix Move unity-tests to unity-tests~ Use relative path reference Use relative path reference Small update to the workflow Updated README for new functionality
causing errors. Disconnected connection should be removed from active connections Small fix that has to do with the active connections list being modified during enumeration Small fix Another fix Small simplification, should be working now Small improvement to how OnDestroy works Small fix Compilation fix :shrug-emoji: Updated tests NPM ignore file Fix reconnection issues Small compilation fix Small fix Fixes for reconnections Reformat Self review Restored API - no API breaks here Fix C# SDK Tests Super small polish Updated readme + publish/generate scripts Move unity-tests to unity-tests~ Resolving conflicts Fixing conflicts
44c95c7
to
41e0bd5
Compare
Description of Changes
Describe what has been changed, any new features or bug fixes
MonoBehaviour
instead of just a bool.MonoBehaviour
s are typically destroyed when a scene reload happens and in this case we'll want to allow developers to spawn a newSpacetimeDBNetworkManager
if the previous one has been destroyed.API
This is not an API break.
If the API is breaking, please state below what will break
Requires SpacetimeDB PRs
List any PRs here that are required for this SDK change to work
Testsuite
SpacetimeDB branch name: master
Testing
Write instructions for a test that you performed for this PR
Testsuite passes