Home Game Development c++ – Server-Client Communication – Game Development Stack Exchange

c++ – Server-Client Communication – Game Development Stack Exchange

0
c++ – Server-Client Communication – Game Development Stack Exchange

[ad_1]

I’ve a consumer, and it is mainly a potato consumer. What I imply by that’s it is code is one thing like this: (This is a junky model of the code, simply to make some extent)

str enter; str output; int inputnum; int outputnum;
cout << output;
if (output == 1) {
    cin << inputnum;
}
else {
    cin << enter;
}

What I’m attempting to do is ship these enter variables to and take these output variables from a server that does all the sport logic and the like. The recreation is a text-based MUD.

I’ve seen one million issues like this:

Complicated Graph. The elements are unimportant.

But I do not want that kind of factor. All I want is one thing like this:

[Client] ←→ [Server]

Because all of the logic is on the server, so it is not essential to do stuff like working it by way of settle for sockets and the like. Is there a easy solution to simply join 4 variables two going a method and two going the opposite? That’s all I’m attempting to do, however there are no easy methods to try this I’ve seen. Here’s kind of an instance of the kind of factor I’d prefer to occur:

Client 1:

Demon HP: [####################]
You used SWORD on DEMON!
Demon HP: [##################--]

Client 2:

Demon HP: [####################]
User1 used SWORD on DEMON!
Demon HP: [##################--]

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here