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

Pages: [1]
1
Network / How do i send std::list?
« on: April 19, 2014, 03:57:44 pm »
Hello everyone,

im trying to pack a std::list into a packet. I´ve read the tutorial on extending packets to handle user types. But i have my problems to get it to work with std::list. The list contains bullets which are a struct with four float variables. I hope somebody can help me with this.  :)
struct BulletInfo
        {
                float PosX;
                float PosY;
                float SpeedX;
                float SpeedY;
        };

        //List
        std::list<BulletInfo>BulletList;

2
General / Re: High Cpu Usage in Sfml 2.0 again
« on: December 30, 2012, 10:56:24 am »
Thx for your help. :)
When i use this in a Singleplayer game it works pretty well. For example i sleep in the beginning of  loop for 10 milliseconds.
But when i use this in a Multiplayer game the Multiplayer is lagging. A movement from a character needs 2 seconds do go to the other player.
I set the sleep time to 1, 2 and 5 milliseconds but it doesnt helped. Have you any idea how i should do this with network stuff? :)
I know that sleeping every loop a constant time isnt perfect but i wanted to test it fast.

3
General / High Cpu Usage in Sfml 2.0 again
« on: December 29, 2012, 01:15:09 pm »
Hello everyone,

when i run this project my cpu usage is at 25%. Normally i think should be around 5%!
I had the same problem a few weeks ago and you helped me to fix it. There it was something with the joystick update.
It cant be the same problem because i commented out the line in the sfml code and recompiled it.

Here is the code:
#include <SFML/Graphics.hpp>

void main()
{
    sf::RenderWindow App(sf::VideoMode(1280, 720, 32), "Test");
    sf::Sprite SPlayer;
    sf::Texture TPlayer;
        sf::Clock clock;

        sf::Time ElapsedTime;

    TPlayer.loadFromFile("tank1.png");
    SPlayer.setTexture(TPlayer);
       
        App.setVerticalSyncEnabled(true);

    while(App.isOpen())
    {
        sf::Event Event;
        while(App.pollEvent(Event))
        {
            if(Event.type == sf::Event::Closed)
                App.close();
        }
                ElapsedTime = clock.restart();

                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
                {
                        SPlayer.move(-50 * ElapsedTime.asSeconds(), 0);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
                {
                        SPlayer.move(50 * ElapsedTime.asSeconds(), 0);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
                {
                        SPlayer.move(0, -50 * ElapsedTime.asSeconds());
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
                {
                        SPlayer.move(0, 50 * ElapsedTime.asSeconds());
                }

        App.clear();

        App.draw(SPlayer);

        App.display();
    }
}

And here is an image of the output from very sleepy:
http://imgur.com/T8vWe

My Pc:
Intel Core i5 2500k
gtx 560 ti

Im using sfml 2.0. Its the build i have recompiled to fix the old problem.

Hope someone can help me :)

4
General / Re: High Cpu usage SFML 2.0
« on: October 27, 2012, 08:28:42 pm »
I downloaded it on friday a few hours after i created this thread.

5
General / Re: High Cpu usage SFML 2.0
« on: October 26, 2012, 11:26:52 pm »
It was LaurentGomila-SFML-2.0-rc-97-g109d914.tar

6
General / Re: High Cpu usage SFML 2.0
« on: October 26, 2012, 11:05:36 pm »
With the Rc and the latest source!

7
General / Re: High Cpu usage SFML 2.0
« on: October 26, 2012, 10:57:01 pm »
Now everything runs fine i have 2% Cpu usage  :)
Thank you

8
General / Re: High Cpu usage SFML 2.0
« on: October 26, 2012, 06:45:28 pm »
I can´t find Joystick::update in window.cpp and WindowImpl.cpp.
Should i comment out something different?

9
General / Re: High Cpu usage SFML 2.0
« on: October 26, 2012, 05:47:31 pm »
In which file is the window::pollEvent and what are cmakelist.txt files.
I have no clue how to compile sfml  ;D

10
General / Re: High Cpu usage SFML 2.0
« on: October 26, 2012, 03:48:58 pm »
@eXpl0it3r
I used Very Sleepy to profile it.
I dont know what it mean but here is a screenshot of it: http://imageshack.us/photo/my-images/803/sleepyr.png/

I have a logitech mx 518 mouse with 800 dpi at default and i have no Joystick.

@Mario
I have tested the framerate with fraps and it shows 60 fps.
Also i have forced VSync at my Nvidea driver.

11
General / Re: High Cpu usage SFML 2.0
« on: October 26, 2012, 02:59:46 pm »
I tested both and i added them before the loop.

App.setVerticalSyncEnabled(true);
and
App.setFramerateLimit(60);

And no i dont used both at the same time ;)

12
General / Re: High Cpu usage SFML 2.0
« on: October 26, 2012, 02:52:49 pm »
Nothing changed! Cpu usage is as high as before!

13
General / High Cpu usage SFML 2.0
« on: October 26, 2012, 01:33:30 pm »
Hello,

i have a problem with sfml 2.0!
On my pc and my laptop the cpu usage is very high (Pc: 25% / Laptop: 50%).
When i run the same project with a few changes with sfml 1.6 the cpu usage is normal(Pc: 4% / Laptop: 9%).
Here is the example code for SFML 2.0:
#include <SFML\Graphics.hpp>

void main()
{
        sf::Sprite SPlayer;
        sf::Texture TPlayer;
        sf::RenderWindow App(sf::VideoMode(1280, 720, 32), "Test");
        sf::Event Event;
        TPlayer.loadFromFile("test.png");
        SPlayer.setTexture(TPlayer);
        SPlayer.setPosition(500, 500);

        while(App.isOpen())
        {
                while(App.pollEvent(Event))
                {
                        if(Event.type == sf::Event::Closed)
                App.close();
                }

                App.clear();

                App.draw(SPlayer);

                App.display();
        }
}

In sfml 1.6 i use sf::image instead of sf::texture.
On both pc and laptop my os ist windows 7 (pc 64bit and laptop 32bit).
The pc has i5 2500k cpu and gtx 560ti graphics card. The laptop has a core 2 duo t6500 with 2.1 GHz and geforce 9600m gs graphics card.
On both i use visual studio express 2010 and there are no errors or warnings.

I hope someone could help me ;)

Pages: [1]