Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/hirpc-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: hiRPC Resources

on:
pull_request:
types: [labeled]

jobs:
hirpc_build:
if: contains(github.event.label.name, 'ci:ready')
name: hiRPC Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: "./local-automation"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Bundle hiRPC
run: pnpm build_all

- name: Configure git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'

- name: Check for changes
id: check_changes
run: |
git add -A
if git diff-index --quiet HEAD; then
echo "No changes to commit."
echo "changes=false" >> "$GITHUB_OUTPUT"
else
echo "Changes found."
echo "changes=true" >> "$GITHUB_OUTPUT"
fi

- name: Commit files
if: steps.check_changes.outputs.changes == 'true'
run: |
git commit -m "chore: bundle hirpc in unity"

- name: Push changes
if: steps.check_changes.outputs.changes == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
2 changes: 1 addition & 1 deletion .github/workflows/hirpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:

jobs:
hirpc_tests:
name: Tests
name: hiRPC Tests
runs-on: ubuntu-latest
defaults:
run:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/unity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Unity

on:
push:
branches:
- dev
paths:
- "unity/**/*.cs"
pull_request:
branches:
- dev
paths:
- "unity/**/*.cs"

jobs:
unity_tests:
name: Unity Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run tests
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
packageMode: true
unityVersion: "2021.3.45f1"
projectPath: unity
testMode: playmode
githubToken: ${{ secrets.GITHUB_TOKEN }}
10 changes: 7 additions & 3 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ jobs:

- name: Install Dependencies
run: pnpm install

- name: Install Doxygen Dependencies
run: pnpm install
working-directory: "doxygen"

- name: Install Doxygen
run: |
wget https://www.doxygen.nl/files/doxygen-1.13.2.linux.bin.tar.gz
tar -xzf doxygen-1.13.2.linux.bin.tar.gz
sudo cp doxygen-1.13.2/bin/doxygen /usr/local/bin/doxygen
wget https://www.doxygen.nl/files/doxygen-1.12.0.linux.bin.tar.gz
tar -xzf doxygen-1.12.0.linux.bin.tar.gz
sudo cp doxygen-1.12.0/bin/doxygen /usr/local/bin/doxygen

- name: Check Doxygen version
run: doxygen -v
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ node_modules
dist
.env
build
.vscode
#v1
npm
78 changes: 77 additions & 1 deletion BETA_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,83 @@ This file will document changes made during the beta phase.

---

# 2025-3-2 - beta progress 1
# 2025-03-26 - beta progress 2

This version includes bug fixes, mock improvements and utilities for local Dissonity development.

## API

### Added

- `Api.ApplicationAccessHash` property.
- `@JavascriptMock` object.
- `DevDialogs` asset, used for local Dissonity development.

### Changed

- hiRPC messages can be mocked.
- Local storage can be mocked.
- Relative HTTPS Proxy requests can be mocked if the URL mappings are defined in the configuration file.

### Fixed

- Some mock implementations didn't work when disabling Dissonity info logs.
- Compatibility issues with older Unity versions.

## Internal

### Added

- Unit tests.

### Changed

- App hash is now stored in the API.
- Local development folder is now `LocalDissonity`.

## UI

### Added

- Javascript Mock interface.

## hiRPC

### Changed

- The instance is automatically set to `window.dso_hirpc` on instantiation.
- The instance is a frozen object.
- If an instance already exists on the window object, it is returned when attempting to create another instance.

## hiRPC Interface

## Changed

- Plugin methods now start with `Dso`.

## Fixed

- Loader path is now correctly set in production builds.
- Fixed check to detect whether the game is nested.

## hiRPC Kit

### Added

- Support for the new object freezing process.

## CI

### Added

- `local-automation` folder, used for file management during local development.

### Documentation

- Updated website structure.
- Improved API reference site.

# 2025-03-02 - beta progress 1

First beta version. The beta phase is expected to be more stable than alpha, but you should still watch out for breaking changes!

Expand Down
9 changes: 9 additions & 0 deletions MIT_LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2024 Discord Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
94 changes: 35 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
> Dissonity Version 2 is still in beta and may cause issues with your code between updates. Use it at your own discretion!

<div align="center">
<img src="https://i.imgur.com/60Sv0ak.png" width="650">
<img src="https://i.imgur.com/AmGkPpE.png" width="650">
</div>

<div align="center">
<img src="https://img.shields.io/badge/version-beta%201%20v2.0.0-yellow">
<img src="https://img.shields.io/badge/version-beta%202%20v2.0.0-yellow">
</div>


# About
## About

[Dissonity](https://dissonity.dev) is a Unity SDK that allows you to easily make Discord activities!
[Dissonity](https://github.com/Furnyr/Dissonity/) is a Unity SDK that allows you to easily make Discord activities!

# Examples
It is a C# implementation of the [Embedded App SDK](https://discord.com/developers/docs/developer-tools/embedded-app-sdk).

Update the current activity:
## Example

```cs
using UnityEngine;
Expand All @@ -33,28 +33,12 @@ public class MyScript : MonoBehaviour
await Initialize();

// Update activity
await Commands.SetActivity(new ActivityBuilder {
await Commands.SetActivity(new ActivityBuilder
{
Type = ActivityType.Playing,
Details = "In the lobby",
State = "Level 10"
Details = "Selecting game mode",
State = "In a Group"
});
}
}
```

Get all participants:

```cs
using UnityEngine;
using Dissonity.Models;
using static Dissonity.Api;

public class MyScript : MonoBehaviour
{
async void Start()
{
// Initialize Dissonity
await Initialize();

// Get all the participants in the activity
Participant[] participants = await Commands.GetInstanceConnectedParticipants();
Expand All @@ -63,44 +47,29 @@ public class MyScript : MonoBehaviour
{
Debug.Log($"{participant.DisplayName} is playing!");
}
}
}
```

Listen to `SpeakingStart`:

```cs
using UnityEngine;
using static Dissonity.Api;

public class MyScript : MonoBehaviour
{
async void Start()
{
// Initialize Dissonity
await Initialize();

// Subscribe to speaking start
await Subscribe.SpeakingStart(ChannelId, (data) =>
{
Debug.Log($"User with id {data.UserId} is talking!");
Debug.Log($"User with id {data.UserId} is speaking!");
});
}
}
```

## Installation

1. Create a Unity project (Unity 2021.3 or later, Unity 6 recommended)
2. Open the package manager and install the package from https://github.com/Furnyr/Dissonity.git?path=/unity#dev
3. Set the build platform to Web / WebGL
4. Player settings > Resolution and Presentation > Set the WebGL template to Dissonity
1. Create a new Unity project (Unity 2021.3 or later, Unity 6 recommended)
2. Open the package manager and install the package from this git URL: `https://github.com/Furnyr/Dissonity.git?path=/unity#v2`
3. Use the pop-up dialog to select a configuration file
4. Set the build platform to Web / WebGL
5. Player settings > Resolution and Presentation > Set the WebGL template to Dissonity

Dissonity is now installed! But you still need to configure a few components:
Dissonity is now installed! But you still need to configure a few things:

## Configuration

1. Right click your project assets > Create > Dissonity > Configuration
1. Open the configuration file in Assets/Dissonity/DissonityConfiguration.cs
2. Set your app id in `<SdkConfiguration>.ClientId` (find it [here](https://discord.com/developers/applications))

Up and running! If you want to test your activity within Unity:
Expand All @@ -109,28 +78,35 @@ Up and running! If you want to test your activity within Unity:

1. Right click the hierarchy > Dissonity > Discord Mock

If you run the game in a scene where there's a `@DiscordMock` object, it will act as a Discord simulator within Unity.
If you run the game in a scene where there's a `@DiscordMock` object, you will be able to test the activity within Unity, simulating Discord.

If there isn't a mock object in the scene, Dissonity will automatically create one.

## Production

Dissonity handles the game-making process. You will still need to host the backend that will serve the activity to Discord and handle the authentication process ([read the documentation](#documentation)).
Dissonity helps in the process to make the game, but you will still need to host the backend that will serve the activity to Discord and handle authentication.

If you're not sure how to continue, read the documentation.


# Documentation
## Documentation

https://github.com/Furnyr/Dissonity/wiki
- **Activities**: https://discord.com/developers/docs/activities/overview
- **Dissonity**: https://dissonity.dev/

https://dissonity.dev (not done yet)
## Contact

# Contact
- General contact: [`contact@dissonity.dev`](mailto:contact@dissonity.dev)
- Security issues: [`security@dissonity.dev`](mailto:security@dissonity.dev)
- Discord: `nyrrren`

DM me on Discord: `nyrrren`
## License

# License
Licensed under the [Apache License, Version 2.0](LICENSE).

Licensed under the [Apache License, Version 2.0](LICENSE)
This project includes code from the [Discord Embedded App SDK](https://github.com/discord/embedded-app-sdk), licensed under the [MIT License](MIT_LICENSE.md).

# Disclaimer
## Disclaimer

This project is not affiliated, endorsed, or sponsored by Discord Inc. or Unity Technologies.

Expand Down
Loading