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

Pages: [1] 2 3
1
Network / Re: Problem with sf::UdpSocket and sf::Packet
« on: February 23, 2013, 12:51:22 pm »
I managed to fix it, I don't know how but somehow it was fixed. Took quite some time but was probably just something that i overlooked. Thanks for the reply and sorry for the unnecessary post :)

2
Network / Problem with sf::UdpSocket and sf::Packet
« on: February 22, 2013, 11:14:29 pm »
For some reason i get wierd symbol on my small testprogram that waits for messages from my client. I'm trying to send sf::int32 value through a UdpSocket but on the serverside when i print the received message all that is being printed is weird symbols like smilies and such. What i tried was i took the sf::TcpSocket example that was in the documents and i just switched Tcp socket for Udp socket there. But for some reason I'm just getting weird data.

//Client

        m_socket = new sf::UdpSocket();
        m_socket->bind(3001);
        sf::IpAddress address;
        address = address.getLocalAddress();
        //std::string message = "Hello there you server there!";
        sf::Packet message;
        sf::Int32 param1 = 10;
        sf::Int32 param2 = 20;
        sf::Int32 param3 = 40;
        message << param1 << param2 << param3;


        m_socket->send(message, address, 3000);

//Server
m_udpSocket.bind(3000);

while(true)
        {
                std::cout << "WAITING FOR MESSAGE" << std::endl;

                sf::IpAddress sender;
                unsigned short port;
                sf::Packet receivedMessage;
                m_udpSocket.receive(receivedMessage, sender, port);
               
                sf::Int32 a, b, c;
                if (receivedMessage >> a >> b >> c)
                        std::cout << sender.toString() << " said: " << a << b << c << std::endl;
        };
}

What am I doing wrong? been searching on the forum but can't find a solution to this here problem..

3
Network / Re: Problems with sf::SocketSelector
« on: January 05, 2013, 01:07:22 pm »
While I'm allready asking things, would anyone happen to know why IRC is sending me infinite amounts of empty messages after I've connected?

4
Network / Re: Problems with sf::SocketSelector
« on: January 05, 2013, 01:04:32 pm »
Ahaaa... Didn't think that mattered, but now I know, thanks alot for the quick reply! :)

5
Network / Problems with sf::SocketSelector
« on: January 05, 2013, 12:25:36 pm »
The problem I'm having with the socket selector is that it for some reason doesn't find that i have messages waiting to be received in the socket. I'm connecting to IRC and it works perfectly well to join channels and send messages, but for some reason I am getting no messages back to my own client. ( I know that it is working to join channels and all that because i have another client open on the side that my own made client sends private messages and such to ) I have tried for many hours now to get it working but for some reason it just wont work. I'm hoping that someone can help me. Here is a minimal example

int main()
{
        sf::TcpSocket client;
        sf::SocketSelector selector;

        queue<string> msgQueue;

        msgQueue.push("NICK brewdal \n\rUSER testing 0 * :browdal\n\rJOIN #testthis\n\r");
        msgQueue.push("PRIVMSG #testthis :hallo\n\r");
        msgQueue.push("PRIVMSG Brodal :Hello you\n\r");
       
        selector.add(client);

        sf::Socket::Status status = client.connect("irc.freenode.net", 6667);
        if ( status != sf::Socket::Done )
                cout << "Failed to connect to the specified server" << endl;

        while ( true )
        {
                if ( selector.wait(sf::seconds(0.1f)) )
                {
                        if ( selector.isReady(client) )
                        {
                                char buffer[512];
                                size_t received = 0;
                                client.receive(buffer, 512, received);
                                buffer[received] = '\0';
                                cout << buffer << endl;
                        }
                }
                else if ( !msgQueue.empty() )
                {
                        status = client.send(msgQueue.front().c_str(),msgQueue.front().size());
                        if ( status != sf::Socket::Done )
                        {
                                cout << "Failed to send message" << endl;
                        }
                        else
                        {
                                msgQueue.pop();
                        }
                }
        }

    return EXIT_SUCCESS;
}

I have also tried using a wide variety of different times in the if ( selector.wait() ) and I have also tried infinite time but I still am not getting any messages.

6
Network / Re: Problems with sf::time::zero when using sf::tcpSocket
« on: January 03, 2013, 04:19:49 pm »
ohh.. wow... that was embarrasing :o gonna blame it on the lack of sleep ;D thanks alot! :D

7
Network / Problems with sf::time::zero when using sf::tcpSocket
« on: January 03, 2013, 04:09:19 pm »
I keep getting this problem Error   1   error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::Time const sf::Time::Zero" (__imp_?Zero@Time@sf@@2V12@B). I found an old thread that said that this was fixed so i thought that i maybe had an old version of SFML 2.0 or something so I downloaded the latest snapshot but im still getting that error and I can't figure out why it is happening.
Here is a minimal test program that recreates this problem for me

#include <SFML/Network.hpp>
#include <iostream>

using namespace std;

int main()
{
        sf::TcpSocket client;
        if ( client.connect("whateveriphere", 4567) != sf::Socket::Done )
                cout << "Failed to connect" << endl;
        return 0;
}

8
Graphics / Re: Twitching graphics with tile based maps
« on: December 03, 2012, 04:55:48 pm »
I have tried to record the problem now so that i can take a screenshot of it, but the weird thing is that my recording program is not picking up the graphical glitch. It is just visible to me when I am playing the game. Anyone have any ideas about that?. I have changed my vertical synchronization settings on my gfx card so that it lets the application decide wether to use vsync or not. I have tested this game on three different computes and they all experience the same thing.

9
Graphics / Re: Twitching graphics with tile based maps
« on: December 03, 2012, 02:58:01 pm »
Seems like it was the drivers that caused the thick lines, though I'm still having small graphic glitches from time to time that i don't know where they come from. It's like a twitching thing :/... I just removed the video instead of complaining. They won't do anything if i just remove the video right? ^^

10
Graphics / Re: Twitching graphics with tile based maps
« on: December 03, 2012, 02:23:59 pm »
I will try that thing and see if Vsync is forced to off. What the hell is FFT? >_< I'm not using anything called FFT :E

11
Graphics / Twitching graphics with tile based maps
« on: December 03, 2012, 02:01:31 pm »
I'm having a weird problem when im using tiles to render my map. Every now and then i get vertical twitching. Like thicker vertical lines that gro through the tiles. I have tried enabling vertical sync so that is not the problem and i can not figure out what is causing this. So if anyone know what the problem is and how to fix it please tell me. I'm also posting a link to a video showing what the problem is. The problem is the thicker lines that appear for a couple of milliseconds every now and then so watch the video for a while to spot them. http://www.youtube.com/watch?v=nqXuB80V5aQ&feature=youtu.be

12
Graphics / Re: [Solved]Possible to reuse pixels?
« on: November 14, 2012, 10:38:24 am »
The reason for 4 million tiles is cause I do not know exactly how big our designers are planning to make the map. And because if it can manage that many tiles or even more then it shouldn't be a problem when more stuff is added into the game. I figured out a better way to cull chunks that has the complexity O(1) instead of O(N) which mine has now, taking advantage of the constant time random access takes. Instead of iterating anything at all I just keep my chunks sorted and divide the cameras current position by the size of a chunk. I then store this number in an int to truncate it ( if value after division is 1.3245 it is truncated to 1, or if value is 13.5323 U get 13 ). Then I multiply this int by the size of a chunk to get an integer value which is also the index in the vector ( when the vector is sorted ) for the chunk I'm in. This way culling of chunks should not be affected by the the number of chunks that the vector contains. Someone please correct me if I'm wrong :)

13
Graphics / Re: [Solved]Possible to reuse pixels?
« on: November 11, 2012, 01:33:25 am »
could you please elaborate on both of the things you said? :) How do you mean change the content accordingly? And, what would be a better algorithm for handling this?  I'm not using any heavy data type for storing my tiles, i only insert vertices into the vertex arrays. So there's no unnecessary stored data ( i hope ). Thanks for all the replies by the way! :)

14
Graphics / Re: [Solved]Possible to reuse pixels?
« on: November 11, 2012, 01:12:41 am »
I found myself encountering lag quite quickly even with vertex arrays ( at 90k tiles i was at 20 fps ), so i changed my tactics a little. Made bigger chunks, each chunk has its own vertex array. Each chunk is 2048 x 1024 big and the tiles are 32x32. Now I'm at really high FPS with 4 million tiles on the screen, as I'm culling every chunk that my camera is not touching. This however does not either allow for infinite worlds as the number of chunks you have to iterate to find the ones you are intersecting increases with the amount of tiles on the screen although your memory will run out before the chunk amount causes any lag. Just wanted to give a hint to anyone else wanting to use huge amounts of tiles. If it lags even with vertex arrays, make several vertex arrays and only draw the ones on screen :)

15
Should be possible to do it if you're using primitives, Vertex or something like that to draw things onto the screen. Make the color of the thing that you want to remove into transparent color ( sf::Color::Transparent ) and draw that onto the screen at the exakt same position. Then remove the sprite. This will make it look like the sprite was removed. Things behind it will however dissapear as well. If there is something behind it just remove it and redraw what was behind it. Don't really see a good use for this when it comes to the whole screen though. A little tedious and all that.

Pages: [1] 2 3