mas-bandwidth / yojimbo

A network library for client/server games written in C++
BSD 3-Clause "New" or "Revised" License
2.45k stars 236 forks source link

Godot Engine and Yojimbo integration #84

Closed fire closed 6 years ago

fire commented 6 years ago

Does Yojimbo have any sort of builtin events like:

ENET_EVENT_TYPE_CONNECT
ENET_EVENT_TYPE_DISCONNECT
ENET_EVENT_TYPE_RECEIVE
ENET_EVENT_TYPE_NONE

I'm trying to make a server loop that takes client messages and forward them to the clients. This is for the godot game engine.

This is what the current Godot game engine does. https://github.com/godotengine/godot/blob/e24f2c6489afdccc6268008d3dcc1ff4ad8ea71c/modules/enet/networked_multiplayer_enet.cpp#L141

Do you have any guides or suggestions?

https://github.com/fire/godot/blob/18f8fe2f2586bfadf6c819f4a1e9863a7e890388/modules/yojimbo/NetworkedMultiplayerYojimbo.cpp

gafferongames commented 6 years ago

Yes the server config has callbacks for these events

On Apr 8, 2018, at 8:01 AM, K. S. Ernest (iFire) Lee notifications@github.com wrote:

Does Yojimbo have any sort of builtin events like:

ENET_EVENT_TYPE_CONNECT ENET_EVENT_TYPE_DISCONNECT ENET_EVENT_TYPE_RECEIVE ENET_EVENT_TYPE_NONE I'm trying to make a server loop that takes client connections messages and forwards them to the clients. This is for the godot game engine.

This is what the current Godot game engine does. https://github.com/godotengine/godot/blob/e24f2c6489afdccc6268008d3dcc1ff4ad8ea71c/modules/enet/networked_multiplayer_enet.cpp#L141

Do you have any guides or suggestions?

https://github.com/fire/godot/blob/18f8fe2f2586bfadf6c819f4a1e9863a7e890388/modules/yojimbo/NetworkedMultiplayerYojimbo.cpp

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

fire commented 6 years ago

https://github.com/networkprotocol/yojimbo/blob/master/yojimbo.h

virtual void ConnectLoopbackClient( int clientIndex, uint64_t clientId, const uint8_t * userData ) virtual void DisconnectLoopbackClient( int clientIndex ) virtual void OnServerClientConnected( int clientIndex ) virtual void OnServerClientDisconnected( int clientIndex )

That seems to be the ones. Thanks.

Also, do you think there's a reasonable way to spread load onto multiple cores?

gafferongames commented 6 years ago

Not currently. Yojimbo is single threaded.

Sent from my iPhone

On Apr 8, 2018, at 2:17 PM, K. S. Ernest (iFire) Lee notifications@github.com wrote:

https://github.com/networkprotocol/yojimbo/blob/master/yojimbo.h

virtual void ConnectLoopbackClient( int clientIndex, uint64_t clientId, const uint8_t * userData ) virtual void DisconnectLoopbackClient( int clientIndex ) virtual void OnServerClientConnected( int clientIndex ) virtual void OnServerClientDisconnected( int clientIndex )

That seems to be the ones. Thanks.

Also, do you think there's a reasonable way to spread load onto multiple cores?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

fire commented 6 years ago

Can you write a small sample how to hook the OnServerClientConnected event?

fire commented 6 years ago

Got it nevermind.

pgruenbacher commented 5 years ago

@fire you planning on doing an enet-alterative to godot? is it gonna be a PR cause I'd be interested in watching for it.

sorry for hijacking this issue...

fire commented 5 years ago

I'm probably going to use enet only. Sorry.