Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/charisma-ai/colyseus-unreal
⚔️ Colyseus Multiplayer SDK for Unreal Engine
https://github.com/charisma-ai/colyseus-unreal
Last synced: about 1 month ago
JSON representation
⚔️ Colyseus Multiplayer SDK for Unreal Engine
- Host: GitHub
- URL: https://github.com/charisma-ai/colyseus-unreal
- Owner: charisma-ai
- License: mit
- Created: 2021-09-14T15:38:36.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-12T15:07:51.000Z (3 months ago)
- Last Synced: 2024-09-13T03:34:44.260Z (3 months ago)
- Language: C++
- Size: 51.8 KB
- Stars: 28
- Watchers: 6
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-unreal - colyseus-unreal - Colyseus Multiplayer SDK for Unreal Engine (Networking)
README
## Example
```cpp
#include "Client.h"
#include "Room.h"const FString UMyComponent::SocketURL = TEXT("https://my-url.com");
struct FMyMessageStruct
{
int Id;
std::string Name;
std::string Text;// You can rename fields!
MSGPACK_DEFINE_MAP(MSGPACK_NVP("id", Id), MSGPACK_NVP("name", Name), MSGPACK_NVP("text", Text));
};void UMyComponent::Connect()
{
ClientInstance = MakeShared(SocketURL);
ClientInstance->JoinOrCreate("room_name", {{"room_option", "option_value"}},
[this](TSharedPtr Error, TSharedPtr> Room)
{
if (Error)
{
UE_LOG(/* oh dear! */)
return;
}UE_LOG(/* connected! */)
this->RoomInstance = Room;
this->RoomInstance->OnMessage("message_type",
[](const msgpack::object& Message)
{
FMyMessageStruct Event = Message.as();
// Do something with the event...!
});
});
}
```## Contributors
Big thanks to [Hung Hoang](https://github.com/chunho32) for making the [Cocos2D C++](https://github.com/colyseus/colyseus-cocos2d-x) implementation of this client, which the Unreal Engine implementation is based on.
## License
MIT