-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request - Communication System + YNOP Data Get/Set system #55
Comments
@jetrotal Sorry for the delay since I have been away from contributing to ynoengine. I have a few suggestions:
// in namespace C2S
class RpcPacket : public C2SPacket {
public:
RpcPacket(std::string _method, std::vector<std::string> _params) : C2SPacket("rpc"),
method(_method), params(_params), id(++idseq) {}
std::string ToBytes() const override { return Build(id, method, params); }
unsigned const id; // to properly identify server responses
protected:
static unsigned idseq = 0;
std::string method;
std::vector<std::string> params;
}; The client would send this packet to the server and create a callback to asynchronously handle the server's response.
// an example of how it may be defined
template <typename... Params> // each Arg must be compatible with std::to_string()
RpcRequestAsync* ProcessBridgeRequest(std::string method, Params... params);
// modelled after FileRequestAsync
class RpcRequestAsync {
// unlike FileRequestAsync::Bind, we won't require caller to hold onto the request
// since it is mainly called for side effects
void Bind(std::function<void(std::string)>);
};
// then they are used like this:
auto* req = ProcessBridgeRequest("read", "some/data/path");
req->Bind([](std::string data) { ... });
If this distinction is important, we can split Would you be willing to submit a PR for this? I apologize for not being able to spend more time on this, but I should be able to work on the server part regardless. Most validation can be done on the server instead, and any protocol between client and server can be defined in an adhoc manner without recompiling the engine (except to change client's behavior). |
Heyo @Desdaemon, I put together some of what we spoke earlier about this feature:
Simple Communication System + YNOP Data receiver for EasyRPG
Allows the player to recieve or send data to the server
1. Basic Operations
GET Operation (0)
SET Operation (1)
2. Other Features
Player Data Operations
3. Error Handling
4. Command Structure (5000)
(Just for reference, code is almost pseudo-code)
5. Storage Guidelines
Server-Side Storage
cu/playermaps/PlayerName/mapname.json
Client-Side Handling
The text was updated successfully, but these errors were encountered: