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

Pages: [1]
1
General / Re: Compiles but crashes at sf::VideoMode
« on: July 29, 2012, 06:08:23 pm »
Thank you again.

2
General / Re: Compiles but crashes at sf::VideoMode
« on: July 29, 2012, 04:52:10 pm »
Ah, thanks.

Edit:

I compiled the source but it only seems to output the dll files without the -d infix (like sfml-window-d-2.dll).
But how important are these dll files for debugging?

3
General / Compiles but crashes at sf::VideoMode
« on: July 29, 2012, 03:35:41 am »
Hi,

I've downloaded the mingw 4.7 compiler and enabled C++11. Everything worked fine on 4.6.
I can compile my code but it doesn't run.

Debugger returns:

0  0x691c2811  sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)    
1  0x004755a6  main  
 

I've tried both
Windows 32 bits - GCC DW2
Windows 32 bits - GCC SJLJ

Neither works for me.

Any suggestions what I might be doing wrong?

Compiler:>mingw 4.7 C++11;
IDE:>Codelite;

( Yes I have tried SFML code only to run a window )

4
General discussions / Re: Potential memory leak SFML2.0?
« on: July 26, 2012, 07:32:01 pm »
Sorry for this. Everything seems to be working ok now it seems.
Memory goes up around to 15mb and then stagnates. Everything else I create is allocated and reused appropriately.

I´ll take a look. Thanks   :)

I've fixt a major memoy leak. So be sure to update.
Also download the README.MD from the source tab. The readme isn't shown correctly on my project page.

5
General discussions / Re: Potential memory leak SFML2.0?
« on: July 24, 2012, 02:46:51 am »
Maybe this article could help:
A Cross-Platform Memory Leak Detector

Is your port going to be available for download? ... I´m interested  ::)

Yeah...I can't get that library to work. It won't accept the changes being made to the operators. I have no clue on how to fix this. I can compile it  by just adding it to my project. But I can't do #include.

My Artemis port was mainly for learning C++. It's not exactly water proof and needs some redesigns. I want to work on this myself to see how far I will get. I will release it soon though. Pretty much summer vacation right now.

Edit:
Well I just made it public
https://bitbucket.org/stalei/artemiscpp

It's shady, so don't expect much from it.

6
General discussions / Re: Potential memory leak SFML2.0?
« on: July 23, 2012, 05:59:17 pm »
Unfortunately it's often the graphics driver that leaks. Is it up-to-date? Have you tried to run other OpenGL apps and watch the memory consumption?

According to my Nvidia updater I'm up to date.  I've tried some other opengl applications. But I can't really deduct anything from them. Obviously memory goes up when more objects are created. But I also have to keep in mind how clean the software is written ( and that's something you can't tell ). However Non of them show the same symptoms as what goes on with SFML. But then again. The clear/display functions eventually stopped going up. Event polling went on forever. It might be a stretch, but it could be something with the gamepad.

You could also try compiling for something else, e.g. Visual C++ 2010 Express. I did the other day, and I get no problems with memory leaks at all.

Also if your CPU is running at 15% for such as basic program...there is something strange going on. I used a crappy old Celeron 2.1Ghz PC with a 64mb video card as target hardware for our work, and with the latest SFML 2, I get 1% CPU when drawing a 1024x768 graphic @ 30fps.

So, I suspect, it is your video drivers or compiler that has screwed things up, and its repeatedly allocating/deallocating memory or creating new objects and not releasing them. I'd bet money its not an SFML bug, though.

Ed

Well yeah that is why it's so weird. It shouldn't be going this high.

I guess this will have to do. I'll update you if anything has changed during my development.

7
General discussions / Re: Potential memory leak SFML2.0?
« on: July 23, 2012, 03:38:47 am »
Either I've missed it, or we're still not sure which exacte SFML 2 version you're using. The RC binaries or your own freshly compiled binaries?  ???

Windows 32 bits - GCC DW2 (11.5 MB) ( yeah the RC ones )

Also I forgot to close my application. And watched some Cumminity(Tv Series). It's spiked at 260mb and still rising. There is definitely something going on.

8
General discussions / Re: Potential memory leak SFML2.0?
« on: July 23, 2012, 12:27:05 am »
This is essentially my complete code. Without my library objects/functions. There are 2 different things I tried:

1:No event polling loop: Goes up for a while and eventually stops. Goes up by a few kb a sec.
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>


int main(int argc, char **argv) {
       
        sf::RenderWindow window(sf::VideoMode(800, 600,32), "SFML window");
       
        sf::Clock deltaClock;
        sf::Time dt;

        window.setFramerateLimit(60);

       
        // Start the game loop
        while (window.isOpen()) {
               
               
                window.clear();
                window.display();
               
        }
       
        return EXIT_SUCCESS;
}
 

2: No clear/display call; CPU usage monitored at ~+15%. Goes beyond 100mb. It might stop eventually. But 100mb just for this code?
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>


int main(int argc, char **argv) {
       
        sf::RenderWindow window(sf::VideoMode(800, 600,32), "SFML window");
       
        sf::Clock deltaClock;
        sf::Time dt;

        window.setFramerateLimit(60);

       
        // Start the game loop
        while (window.isOpen()) {
               
                sf::Event event;
                while (window.pollEvent(event)) {
                        // Close window : exit
                        if (event.type == sf::Event::Closed)
                                window.close();
                }
               
        }
       
        return EXIT_SUCCESS;
}

Both debug build and release build seem to show the same thing. Maybe I'm missing some vital information. But it seem completely unlikely that this loop will cause the application to use more than 100 mega bytes.

9
General discussions / Re: Potential memory leak SFML2.0?
« on: July 22, 2012, 12:22:12 pm »
There is no leaks in sfml 2.0
Check this topic http://en.sfml-dev.org/forums/index.php?topic=8092

Yeah been there...nothing that helped me. Also this is C++ we are talking about. Not even Jesus can save you there.

There is now leaks in sfml 2.0
You mean "no leaks" ;)

Still, there shouldn't be a constant increase in RAM usage. Does the task manager allocation stop at some point or grow endlessly?

Well if I keep both the poll event and clear/display function running it goes up, continuously, but also the fastest. If I just keep the clear/display functions running it stops eventually( about 15 mb later ). If I only keep the poll event it keeps growing. I went from 30 mb to 160 mb+ and going( in a 7 minute span). And that was only coming from a simple while loop. Even if I don't draw anything between clear/display.

I even tried running my library code commenting out the SFML calls ( except window.isOpen() ) and the memory stagnates. When I created new Entities memory goes up. But doesn't go up endlessly. It only shows change in what I'm creating.

Like I said my library is not memory leak free. I'm pretty sure I made some flaws. However. My library does not show any signs that memory usage continuously keeps going up.

I tried looking for Memory leak tools. But most of them try to change the definition of new and what not. Tried about 3 of them so far and non will compile. I'm using mingw 4.6.2. ( with C++0x enabled ) And I'm not very much experienced to make changes to those memory leak codes to make them compatible for compilation.

I tried the trial version of C++ Memory Validator. But I can't seem to get the source code to be displayed ( Talking about my own library ).

Also:
Like I mentioned, there seems to be an issue when using a gamepad. Unplugged after plugging it ( or it's the sf::Joystick::isButtonPressed being called regardless of an unplugged controller ). There seems to be some heavy stuttering. Not always though. Just sometimes.

10
General discussions / Potential memory leak SFML2.0?
« on: July 22, 2012, 03:29:58 am »
Hi,

I'm porting Artemis:gamadu.com/artemis/ to C++ and I am pretty sure I have some leaks left that I'm trying to debug. I decided to make a test game with Artemis and SFML. But I've noticed something strange that comes from SFML:

This is my while loop:

while (window.isOpen()) {
               
                //dt = deltaClock.restart();
               
                sf::Event event;
                while (window.pollEvent(event)) {
                        // Close window : exit
                        if (event.type == sf::Event::Closed)
                                window.close();
                }
               
               
                world.loopStart();
                world.setDelta(deltaClock.restart().asSeconds());
                playerJoy.process();
                movsys.process();
                collider.process();
                // Clear screen
                window.clear();
                //updateSpriteSystem
                spritesys.process();
                // Update the window
                window.display();

               
        }

I look into my taskmanager and notice that my applications memory keeps rising. At first I thought I did something completely wrong with my library. So I took out my stuff leaving the SFML stuff in my test run. At this point memory was still going up.

Now I tried the reverse. And I left out:

               
                sf::Event event;
                while (window.pollEvent(event)) {
                        // Close window : exit
                        if (event.type == sf::Event::Closed)
                                window.close();
                }
               

                window.clear();

                window.display();

               
        }
( yes the while (window.isOpen()) is still present at this point)

And my memory stagnates at 27.30 kb. It doesn't go up or down. It stays exactly the same.
Unfortunately I can't give you any debug data. I simply observed the taskmanager.
It only goes up when using the windows method for pollEvent and clear (or display). I have no idea if other methods of the RenderWindow cause the same .

I hope someone can clarify this.

Edit:
I think there is something with the PollEvent. If I leave out that complete while loop for event polling memory goes up until a certain point and then stagnates. But if I put that while loop back memory continues to go up.

Also I'm using a gamepad to control certain entities. And sometimes my application lags because of it. I test my game for a while. Unplug my controller. Start my application again. And it stutters. Also using a lot of CPU cycles. While the controller is unplugged, I'm still checking with sf::joystick if a button is pressed.
Is this my doing or is there a flaw in the SFML implementation for gamepads/joysticks?

~Sidar


11
General / Re: Centralized Input management.
« on: June 16, 2012, 10:38:56 pm »
Thanks for the replies.
I'm trying to update to the latest MingW compiler, but I still need to get familiar with CodeLite.

But i think I found a solution that works for my game:
Let a player object implement an interface IJoyEventListener with the method : onJoyEvent(JoyEvent event)
Where JoyEvent is a struct with all the gamepad data.

And then I do something like:


for(size_t i=0; i<controllerID.size(); i++)
{
                               
        event.axisX = sf::Joystick::getAxisPosition(i,sf::Joystick::X);
        event.axisY = sf::Joystick::getAxisPosition(i,sf::Joystick::Y);
                               
        event.buttonA = sf::Joystick::isButtonPressed(i,st::input::A);
        event.buttonB = sf::Joystick::isButtonPressed(i,st::input::B);
        event.buttonX = sf::Joystick::isButtonPressed(i,st::input::X);
        event.buttonY = sf::Joystick::isButtonPressed(i,st::input::Y);
        event.buttonStart = sf::Joystick::isButtonPressed(i,st::input::START);
        event.buttonSelect = sf::Joystick::isButtonPressed(i,st::input::SELECT);
                               
                                //etc etc
                               
        controllerID.at(i)->onJoyEvent(event);
                               
}
 

Not the most elegant way. But it's a start.
I will probably overhaul all of this in the end anyways.

Edit:

Well after updating to the latest mingw 4.7.x i can't run my project anymore.
Had to add -static-libstdc++ to my linker options all of a sudden. And it crashes on creating a window. But doesn't specify why.

Stack call:
0  0x691c2811  sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)   
1  0x00401514  main  C:\\Users\\Sidar\\Documents\\Sidar\\C++\\ST\\Shmup\\main.cpp  98

12
General / Re: Centralized Input management.
« on: June 16, 2012, 09:51:42 pm »
Quote
Equivalent to what?

sf::Joystick::getAxisPosition directly returns either the x or y axis position. I read the tutorial on thor but couldn't see how I would ask the X en Y position. Is it just passing the sf::Joystick::X as the argument?

Quote
Yes Aurora/Thor depend on C++11 features like smart pointers. So you probably need to get a newer version of GCC that supports already nullptr.

I'm aware not everything is yer supported in MingWG 4.5.2?
http://gcc.gnu.org/gcc-4.5/cxx0x_status.html

Could you elaborate on this?

Quote
You eventually have to learn to handle such errors because you'll always run into them. But at the beginning it's hard and often time consuming when stickying to it, you will soon understand much more and be able to fix them in no time.
I'm fully aware of that. But I rather focus on technical details of my game rather than technical details on how the compiler works.

13
General / Re: Centralized Input management.
« on: June 16, 2012, 07:54:43 pm »
Thanks for replying,

I'll check it out. Even though I would have wanted to create such system myself. It's more from a learning point of view. But ill try it nonetheless.

Sidar

edit:

How do I get the equivalent of sf::Joystick::getAxisPosition ?

edit:
Aurora errors. I had to add the compiler options for -std=gnu++0x but then it errors out on me complaining about:
/Bromeon-Thor/extlibs/aurora/include/Aurora/Tools/SafeBool.hpp:64:32: error: 'nullptr' was not declared in this scope

I'm pretty much inexperienced with C++. And I honestly don't feel like chasing these errors down. I guess ill just try and build something myself. Suggestions are still welcome.

14
General / Centralized Input management.
« on: June 16, 2012, 06:46:27 pm »
Hi there,

First of all, I would like to thank you guys for providing this library as it really has been motivating me to work more on C++.

I'm working on a Shmup ( side scrolling shoot'em up ). And as I'm working my way up to making a suitable system for my game I'm pretty much stuck on how I should handle the input.
I know there are global methods for input and I could just write the input directly in my player class. However I rather want  my player object to "register" to an input manager instead and let this manager dispatch the event to all my registered object.

The reason for this is that I might want to implement a multiplayer mechanic up to 4 players.

Two things that make it hard for me to come up with a solution:
1:with the sf::Joystick object I can see if a button is pressed, but it also demands that I specify a controller id.

2:With window.pollEvent(...) it would require me to pass the window object to my manager. However I'm not sure if this is a good idea. From what I understood pollEvent pops the event, so other events might get lost if the input manager is popping events that are of no interest.

Basically what I want to do is something like

InputManager.registerJoy(myPlayerObject, joyID);
InputManager.registerKbrd(myPlayerObject);

And let my objects implement an interface/abstract class which are called on event. something like:

void onInputEvent(Event evt){
 //do magic here.
}

Now maybe I'm overlooking something that already exists in this library. But at this point I can't come up with a solution. Does anyone have suggestions?
Any help is appreciated!

Sidar

Pages: [1]
anything