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 - Axenntio

Pages: [1]
1
Network / Re: Multi-clients problems
« on: July 10, 2016, 05:53:28 pm »
Ok, I've fix the bug.

I write
selector.add(*client);
instead of
selector.remove(*client);
when a client is disconnected.

2
Network / [SOLVE] Multi-clients problems
« on: July 08, 2016, 11:50:34 pm »
Hi there !

I've make an simple multiplayer game, but... when I want to make a login system, there are some issues.
Indeed, When the client one  connect to the server and log in, not probleme, his move are good, but when I connect a second client and log in, the moves of the two players are crazy.
Can someone explain me what are the error ?
Because all the physic of the game are managed by the server, and the move should be one pixel by pixel, to be aligned to a 16x16 grid...

Thanks you for your help.

https://github.com/Axenntio/NetworkingSFML

3
Network / Manage Client on the server
« on: December 06, 2015, 06:32:30 pm »
HI everyone, I continue my projet to make a multiplayer game, but i've got a problem:
How can I manage each client on the server ?
Because, All the clients give their X and Y position to the server, but how can I give X and Y position of all the clients to each other ?

I've actually these codes:

Client:
(click to show/hide)

Server:
(click to show/hide)

And with this, how can I give a ID link to the IP
with a array like this:
Id ArrayAxenntioEnadrixRuhtrax
Ip ArrayIp1Ip2Ip3

To use this with a function like
message("You are Axenntio","Axenntio");
void message(std::string text,std::string id){
        // Loop that link the Id with the Ip array
        //Then send the message to the client Axenntio
}
 

4
Network / Re: Trying to make a server with multiple connections
« on: May 04, 2015, 08:41:49 pm »
OK let make an upgrade ^^' (Probably because I'm a dev' and dev' are a little bit lazy)

Edit: Okay, finally done ! I've use the SocketSelector (rename with not same function between 1.6 and 2.0) Now I've a multi-client server !
For those how need this, I just use this page: http://www.sfml-dev.org/documentation/2.0-fr/classsf_1_1SocketSelector.php

Thanks to SFML community forhis help ! <3

5
Network / Re: Trying to make a server with multiple connections
« on: May 04, 2015, 07:36:01 pm »
Yea but I use SFML 2.0 and not 2.2 :/

6
Network / Re: Trying to make a server with multiple connections
« on: May 03, 2015, 10:44:09 pm »
Ow... Sorry for my mistakes :$
I didn't know std::vector and std::unique_ptr until eXplOit3r suggest them to me ^^'
I've also see the use of selector with the TCP socket ? This can make an Server multi-client you think ?

Edit: Seem to be usable only in SFML 1.6... There is an alternative for SFML 2.0 ?

7
Network / Re: Trying to make a server with multiple connections
« on: May 03, 2015, 09:07:36 pm »
Ok so, this line make my Application no responding
if(listener.accept(*socket[coNumber])==sf::Socket::Done && coNumber<MAXCONNEXIONS){
 

I know it because when I comment it the program run normaly.
This line is supposed to accept an connection from the client, but this make the code get the 255 error (not responding [The program crash])
listener.accept(*socket[coNumber])==sf::Socket::Done
 

I want to make a server for my clients, so multiple connections

8
Network / Trying to make a server with multiple connections
« on: May 02, 2015, 11:27:31 pm »
Hi everyone ! I've got some weird problem with my code...
The first time, I've make an array and if a client disconnected, I push the last elements to overwrite the client disconnected
for(int i=0;i<coNumber /*Number of connected clients*/;i++){
    if(socket[i].receive(packet)!=sf::Socket::Done){
        coNumber--; //Remove one client
        for(int j=i;j<coNumber;j++){
            socket[i]=socket[i+1];
        }
    }
}
 

But got the awesome
NonCopyable error

So I've ask to Lukas/eXpl0it3r (Thanks to him !)
And suggest me to use
std::vector<std::unique_ptr<sf::TcpSocket>> socket;
 

instead of
sf::TcpSocketsocket[MAXCONNECTIONS];
 

play with somes pointers, and then get stuck...
An error occured with this line:
if(listener.accept(*socket[coNumber])==sf::Socket::Done && coNumber<MAXCONNEXIONS){
 

No error during compiling, but during the execution (Application not responding)
Error 255

So there is my actual code:

(click to show/hide)

Thanks for your help !

Pages: [1]