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

Pages: [1] 2 3 4
1
General / Choppy Movement With DeltaTime
« on: April 04, 2017, 01:31:48 am »
Hi everyone,

I'm struggling to get smooth movement in a game I'm working on. I was originally using a fixed timestep loop for handling the game logic, but I noticed that the movement was choppy, so I changed it (at least for now) to use delta time instead, but the choppy movement still persists.

Here is a minimal example of the code :

#include <SFML\Graphics.hpp>

int main()
{
       
        sf::RenderWindow win;
        win.create(sf::VideoMode(640, 512), "");
        win.setVerticalSyncEnabled(true);
        sf::Sprite p;
        sf::Texture t;
        t.loadFromFile("graphics/player.png");
        p.setTexture(t);
        p.setPosition(100, 100);
        sf::Clock clock;
        sf::Time dt;
        while (win.isOpen()) {
                dt = clock.restart();
                sf::Event event;
               
                while (win.pollEvent(event)) {

                        if (event.type == sf::Event::Closed) {
                                win.close();
                        }

                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::W)) {
                p.move(0, -32 * dt.asSeconds());
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::A)) {
                p.move(-32 * dt.asSeconds(), 0);
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::S)) {
                p.move(0, 32 * dt.asSeconds());
                }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::D)) {
                p.move(32 * dt.asSeconds(), 0);
                }

                win.clear();
                win.draw(p);
                win.display();
        }
        return 0;
}
 

As I say this results in choppy movement. By that, I mean that roughly once or twice a second the player stutters and the movement is not completely smooth or continuous. I've looked at a lot of questions regarding this same problem already, but most were caused by problems not present in my code, and otherwise I couldn't find a solution.

Any help would be appreciated thanks.

2
Window / Re: hiding or destroying events
« on: February 27, 2017, 04:31:29 pm »
hey thanks for the reply, yes that makes total sense! A stack based FSM should do it thank you. The problem was that I made a class to handle different screens, such as splash, loading, main menu and a few others but then implemented guis separately for in game and in the map editor. Then when it came to refactoring the gui i thought I should meld the screens class with the game and editor for architectural reasons but was struggling with how to do it.

I have looked at stack based FSM before in regards to ai etc, so this is just the tip I was looking for. Thanks again Mario!

3
Window / hiding or destroying events
« on: February 26, 2017, 10:37:04 pm »
Hello,

Just wondering if there is a way to destroy or hide an event. The reason being that I have my gui and actual game checking for click events and at the minute if i click a gui button, then the click also registers in the actual game layer.

I know that I could separate the gui and the game by making the game view smaller so it is a window within the bounds of the gui and only check for game related clicks if they are within the the game's viewport, but this seems like extra work when it could be possible (as far as i know) to say, check for the click in the gui and if it hits a button, do something then kill the event so it doesn't get passed to the game event loop.

So does anyone know if there is a way to remove an event from the event queue?

4
Graphics / Re: Text Wrapping in SFML
« on: January 13, 2017, 12:36:57 am »
I can't actually see where it is that you've declared the 'width' variable. Is this code actually the same as the code in your program?

5
General / Re: Problems capturing full screen mode for video
« on: January 12, 2017, 07:22:34 pm »
thanks, Exploit3r  :D

6
General / Re: Problems capturing full screen mode for video
« on: January 12, 2017, 04:17:06 pm »
Okay, it's the software that causes it. Apparently it will only record games if they're in borderless windowed mode. However, I managed to record in full screen using the screen capturer that comes with nvidia's geforce experience. Problem solved.

7
General / Problems capturing full screen mode for video
« on: January 12, 2017, 03:59:23 pm »
Hi, I'm just wondering if anyone else has had this problem? I wanted to make a video of my game to show the progress so far on youtube. I'm using Apowersoft free screen recorder. When i enter the game which is set to fullscreen, the software just records a black screen without any of the stuff that's going on in the game. Figured this is to do with sfml rather than the screen capture, as I don't think ptrscreen works either. Is there a fix for this?

8
Graphics / Re: rotating sprite without using transform.rotate
« on: January 12, 2017, 12:51:29 am »
Okay, well it's perhaps not the ideal way of doing things, particularly as my entity class already inherited from sf::Sprite, but I basically just instantiated another sprite as a member of entity and swapped something around so that it is used for the animations and drawing. That way I can use the inherited sprite for all the movement calculations and then use the instantiated mSprite to draw with an offset and so now it looks the way it should.

Solved I guess.

9
Graphics / Re: rotating sprite without using transform.rotate
« on: January 11, 2017, 11:24:21 pm »
hmm, well changing the origin to the centre, rotating and then changing it back to 0, 0, made it so the sprite is following the path, but off to the side of the path. The class inherits from sf::Sprite.

here is a screenshot for further clarification:

https://www.dropbox.com/s/za6cs8uk0853zbi/fail.png?dl=0

in the picture, the green squares are the path that the entity should be walking along, and even though it is following them, it is drawn off to the side. I put a circle around the moving entity so you can see what i mean.

10
Graphics / Re: rotating sprite without using transform.rotate
« on: January 11, 2017, 11:04:20 pm »
When i Just set the origin to the centre and leave it there, the sprite is no longer lined up with the grid spacing, so the sprite is always on the edge of each tile, instead of in the middle of it like it should be.

11
Graphics / rotating sprite without using transform.rotate
« on: January 11, 2017, 10:27:32 pm »
Okay, so my game uses a grid, pathfinding etc, i.e agents are stuck down to definite integer coordinates and can't just roam freely. To cut down on having to make a ton of artwork (and because the game is orthogonal/top down)  I decided it would be easier to use pure top down sprites and simply rotate them, effectively making it so I only needed to make artwork for one walk cycle, idle, attack etc.

However sadly I can't get rotation to work because of changing the origin. Now I've seen much discussion stating that if you want to keep the origin in the top left I would need to use a transform object and apply rotation to that and use it as a renderstate, however I couldn't get that to work. The main reason being that the transform only has transform.rotate, whereas the formula i use to work out rotation outputs an angle which is only good for sprite.setRotation as it sets the absolute rotation as opposed to the relative one.

So what I decided to try and do was to try various means of changing the the sprite's origin, set the rotation and then set the origin back to the left top corner, however this still produces undesirable outcomes. Here's my latest attempt at that. I used the hardcoded number 16 for ease of use and my sprites are 32x32, so it's their centre point:

void Entity::handleRotation(Tile * target)
{
        setOrigin(16, 16);
        setPosition(getPosition().x + 16, getPosition().y + 16);
        float angle = atan2(target->getPosition().y - getPosition().y, target->getPosition().x - getPosition().x);
        angle = ((angle * 180) / 3.14159265) + 90;
        {
                angle = 360 - (-angle);
        }
        setRotation(angle);
        setOrigin(0, 0);
        setPosition(getPosition().x - 16, getPosition().y - 16);
}


Again, this hasn't done as expected and I've tried many variants to no effect  :-\ Any suggestions, explanations or examples would be extremely helpful. Thanks in advance ;)

*note setOrigin, setPosition, getPosition,  setRotation are usable because the entity class publicly inherits from sprite.

12
Audio / Re: open AL unexpected message
« on: May 21, 2016, 02:51:32 am »
yeah, my audio is working. I use FL studio regularly to record and edit music. I watch videos and listen to music regularly without incident. Also gaming ofc ;) The drivers are up to date and I have no other problems with audio.

13
Audio / Re: open AL unexpected message
« on: May 21, 2016, 12:16:28 am »
okay so this is everything i get in the output window:

'Wetware.exe' (Win32): Loaded 'C:\Users\whore\Documents\Visual Studio 2015\Projects\Wetware\Debug\Wetware.exe'. Symbols loaded.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Users\whore\Documents\Visual Studio 2015\Projects\Wetware\Debug\sfml-system-d-2.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Users\whore\Documents\Visual Studio 2015\Projects\Wetware\Debug\sfml-window-d-2.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Users\whore\Documents\Visual Studio 2015\Projects\Wetware\Debug\sfml-audio-d-2.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Users\whore\Documents\Visual Studio 2015\Projects\Wetware\Debug\sfml-graphics-d-2.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glu32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ddraw.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dciman32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Users\whore\Documents\Visual Studio 2015\Projects\Wetware\Debug\openal32.dll'. Module was built without symbols.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Program Files (x86)\Common Files\Microsoft Shared\Ink\tiptsf.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\clbcatq.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\MMDevAPI.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\propsys.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\devobj.dll'
'Wetware.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\MMDevAPI.dll'
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dsound.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\MMDevAPI.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\AudioSes.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinTypes.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\UIAutomationCore.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\userenv.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sxs.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nvoglv32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wtsapi32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntmarta.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
The thread 0x664 has exited with code 0 (0x0).
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winsta.dll'. Cannot find or open the PDB file.
The thread 0x1814 has exited with code 0 (0x0).
The thread 0x83c has exited with code 0 (0x0).
The thread 0x24a0 has exited with code 0 (0x0).
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dinput.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\hid.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleacc.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\twinapi.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\twinapi.appcore.dll'. Cannot find or open the PDB file.
'Wetware.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcrypt.dll'. Cannot find or open the PDB file.
The thread 0x3e0 has exited with code 0 (0x0).
The thread 0x2a78 has exited with code 0 (0x0).
The thread 0xef4 has exited with code 0 (0x0).
The thread 0x1934 has exited with code 0 (0x0).
The thread 0x4b0 has exited with code 0 (0x0).
The thread 0x210c has exited with code 0 (0x0).
The thread 0xc18 has exited with code 0 (0x0).
The thread 0x11dc has exited with code 0 (0x0).
The thread 0x678 has exited with code 0 (0x0).
The thread 0x21d8 has exited with code 0 (0x0).
Exception thrown at 0x00A943E9 (openal32.dll) in Wetware.exe: 0xC0000005: Access violation reading location 0xDDDDDDDD.

and under callstack it simply says:

>   openal32.dll!00a943e9()   Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for openal32.dll]   
    [External Code]   


Hope that one of these was what you were asking for.

14
Audio / Re: open AL unexpected message
« on: May 20, 2016, 09:01:14 am »
Yes it does sound very similar. I found your post when originally looking for the problem on google. But figured it may be different because of the warning numbers and also because, if my memory serves me, you built sfml yourself, whereas im using a release build. Im thinking that i'll try and download a new or newer version of sfml and replace the dll, see if it is possibly corrupt somehow. Will report back if anything works.

15
Audio / Re: open AL unexpected message
« on: May 16, 2016, 09:41:20 pm »
high, yes, i'm using openal32.dll that came with sfml 2.3.2, and like i said this was working before without a hitch. the dll is most definitely next to the exe, yes.

I'm racking my brain trying to think of things that I could have altered on my machine that have changed the way it runs somehow, but can't think of anything.

Pages: [1] 2 3 4