Bienvenue, Invité. Merci de vous connecter ou de vous inscrire. Avez-vous oublié d'activer ?

Voir les contributions

Cette section vous permet de consulter les contributions (messages, sujets et fichiers joints) d'un utilisateur. Vous ne pourrez voir que les contributions des zones auxquelles vous avez accès.


Sujets - s1and1

Pages: [1]
1
Général / sf::Packet the packet data is mixed up
« le: Décembre 29, 2021, 08:29:33 pm »
Hello, I'm trying to create a thread that takes an instance of the sf::Packet class as an argument, but everything is mixed up there.



sf::UdpSocket sock;

void server(sf::Packet pack, sf::Address addr, sf::Packet packet){
    int a;
    pack >> a;
    std::cout<<a;
}

int main(){
    sf::Address addr;
    sf::Packet packet;
    unsigned short port;
    sock.bind(19132);
    sock.receive(packet, addr, port);
    std::thread thr(server, packet, addr, port);
    thr.detach();
}

2
Général / client floods the server
« le: Décembre 19, 2021, 11:40:18 am »
sorry for my english.

Hello, creating a multiplayer game faced a problem. The client is flooding with udp requests and the server is working too slow, so the position of the player in the screen of another player is very different from the real ones.

The client sends requests via while(true) and the server runs in the same cycle.


is it possible to somehow reduce the load?


Thank you in advance!

Pages: [1]
anything