mas-bandwidth/yojimbo

Failed to Create Message Type and Serialize check failed

Closed this issue · 4 comments


image

Hi there I'm currently running into a issue when trying to follow the USAGE.md file in your repo for whatever reason my server behaves strangely when having a client send a message to the server I'm using the basic test message layout from USAGE.md and I'm having trouble trying to figure out what these errors mean

things that I have made sure of

  1. Set on both client and server the same custom adapter class
  2. Set the same config class on both server and client
  3. I made sure all channel types were the same on both client and server
  4. Message Structure seems to be the same

As for my code there's nothing really different about my code vs the USAGE.md example code other than class names

Any help would be appreciated if you need further details of this issue please lemme know

Please post the serialize method for your message

`class TestMessage : public yojimbo::Message {
public:
int m_data;

TestMessage() :
    m_data(0) {}

template <typename Stream>
bool Serialize(Stream& stream) {
    serialize_int(stream, m_data, 0, 512);
    return true;
}

YOJIMBO_VIRTUAL_SERIALIZE_FUNCTIONS();

}; `

This is my message that I’m trying to send my message is no different from the example provided and I’m using the standard serialize method provided

What I did notice was missing from USAGE.md was were to appropriately call this function or if it needs to be called at all

Thanks for the quick response

UPDATE: I've tried using all of the test / example messages that are defined in shared.h and still the same message what I do notice is when messaging the server it seems to send three of the same messages from my client therefor making it so the server thinks there is 3 clients when there is only 1
image

EDIT: Turns out thats not the case it does the same behavior even if one message is sent

EDIT 2: I Redid my entire code and still nothing i feel like theres something im missing or havent called

i figured it out turns out you have to define all GameMessageTypes in your enum class in the macro otherwise the entire thing breaks just keep that in mind for anyone new using this

there should really be a check to see if the GameMessageType has been setup or not before it attempts to use it just a suggestion considering this took me wayyy to long to figure out