Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        













Patreon donate button


Discussion forum





Multiplayer Game Client for Unreal Engine.
View documentation


## 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