Skip to content

Develop Side Channels tutorial #3391

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

Merged
merged 10 commits into from
Feb 11, 2020
Merged

Develop Side Channels tutorial #3391

merged 10 commits into from
Feb 11, 2020

Conversation

vincentpierre
Copy link
Contributor

No description provided.

@vincentpierre vincentpierre self-assigned this Feb 7, 2020
To send a byte array from Python to C#, call the `super().queue_message_to_send(bytes_data)` method inside the
side channel. The `bytes_data` argument must be a `bytes` object.

To register a side channel on the Python side, call pass the side channel as argument when creating the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that custom Side Channels and mlagents-learn are currently mutually exclusive.

@harperj Another use case for plugins.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right. But I do not see how our training process would make use of custom made side channels. I see the side channels more as a research use case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, can't help but think some form of extension / plugin could allow us to add these more easily. That said, I think you're right @vincentpierre that it isn't obvious how we could use these side channels even if the user could add them.

Here is an implementation of a `StringLogSideChannel` that will listed to the `UnityEngine.Debug.LogError` calls in
the game :

```csharp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this code (and RegisterStringLogSideChannel ) should be an actual .cs file in the Examples directory. Otherwise it's way too easy for it to get out of date during refactors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW we might be able to populate the package docs based on code; there's a thread I started here https://unity.slack.com/archives/C070VFPRV/p1575917230249200

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this critique isn't specific to this example, large blocks of uncompiled unexecuted code always makes me nervous; see also the jupyter notebook)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very fair concern. I would like to have a tutorial rather than code because I would like users to make their own rather than rely on our own implementations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would solve the problem if there was a way to show code from a file in md

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a block of markdown code and actual .cs file are equally likely to get copy-pasted. If it's in the Examples and not the SDK, we're free to change the implementation later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think links from the docs to the .cs and vice versa is sufficient for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather keep the code in there. I would argue that If I add the .cs script in the Examples folder, it will still be untested code. If I add the .cs I would have to add the python code as well and we do not have a place to put this code right now (I do not want to put if in yet another notebook).
I do agree that it is very bad to have large amount of code in markdown as tutorial (looking at you RollerBall) but I do not think I like the alternative. Maybe we should put a hold on this PR for now ?

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>
vincentpierre and others added 2 commits February 7, 2020 16:05
Co-Authored-By: Chris Goy <christopherg@unity3d.com>
Copy link
Contributor

@chriselion chriselion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good aside from markdown vs. source files (and one edit). OK to merge now and we can migrate later.

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>
@vincentpierre vincentpierre merged commit 5951973 into master Feb 11, 2020
@delete-merged-branch delete-merged-branch bot deleted the develop-sc-tutorial branch February 11, 2020 00:45
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants