Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jim70

Pages: 1 [2]
16
No, but what will I have to change to use udp?

17
What don't you understand? It's really trivial, and not more complicated than with TCP sockets. There are examples in the documentation, tutorials and example applications.

Then what do I need to change in this code?
       
        pre-window:
       
        sf::TcpSocket socket;
   char connectionType;

   cout << "Enter ip you wish to host/connect to." << endl;
   string tmp;

   cin >> tmp;

   sf::IpAddress ip(tmp);

   cout << "Port: ";
   int port;
   cin >> port;

   cout << "(s) for server and (c) for client: ";
   cin >> connectionType;

   if (connectionType == 's') {
      cout << "Waiting for someone to join..." << endl;
      sf::TcpListener listener;
      listener.listen(port);
      listener.accept(socket);
   }
   else {
      cout << "connecting..." << endl;
      socket.connect(ip, port);
   }
       
        ........

        game loop:
       
       
sf::Packet packet;

      if (prevPosition != rect1.getPosition() | prevRot != rot) {
         packet << rect1.getPosition().x << rect1.getPosition().y << rot;
         socket.send(packet);
      }

      socket.receive(packet);
      if (packet >> p2Position.x >> p2Position.y >> rot2) {
         rect2.setPosition(p2Position);
      }

18
Network / Can someone cook up a small example of udp sockets with packets?
« on: September 22, 2015, 10:45:02 am »
The documentation isn't very clear with this, so can someone cook up an example?

19
General discussions / Why do so many game take so much space?
« on: September 14, 2015, 10:42:58 am »
Don't know about you, ive made a decently complex game with plenty of sprites and a lua saving system but its still less than 10 MB, Why do most games take 1-4 gigs then?

20
General / SFML for vs 2015?
« on: September 12, 2015, 09:33:01 pm »
Is a vs 2015 version in the works? If so, when will it come?

21
General / Re: Multiple objects from same class?
« on: May 28, 2015, 10:29:52 am »
isnt there something like  LOL lol = new LOL ?

22
General / Re: Multiple objects from same class?
« on: May 28, 2015, 10:11:21 am »
so that i can have one class (with sf::texture, sprite, private & public variables etc) and reference it more than once and display the on screen.

23
General / Multiple objects from same class?
« on: May 28, 2015, 10:03:42 am »
I have a basic ai system, how do i do it so that i dont have to re-write the code for every ai i add with the same functionality?

Pages: 1 [2]
anything