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

Pages: [1]
1
SFML projects / Re: Witch Blast (dungeon crawl shooter)
« on: May 19, 2015, 02:16:00 pm »
Wow, that screenshot has made me realize how horribly bad I am at this game (though I still enjoy playing it!). I'm not even halfway to the lowest of the top 10 scores there. :(

2
SFML projects / Re: Simple SFML Game Starter Setup
« on: May 19, 2015, 02:09:14 pm »
Thanks for the PR, I merged it yesterday. I've had a death in the family, so things are taking me a while now.

If anyone is interested, please consider a donation to the Wounded Warrior Project (in honor of my brother, Christopher Traver). https://support.woundedwarriorproject.org/default.aspx?tsid=72

3
SFML projects / Simple SFML Game Starter Setup
« on: May 08, 2015, 02:09:29 pm »
I made this for myself to have a basic starting point for making games with SFML, and I thought someone else might find it useful/interesting.

https://github.com/kiswa/SFML_Starter

It uses CMake (though only tested on Linux, so please let me know if it needs changes for other platforms) and builds an executable named "sfml" which demonstrates the state transitions and debug output.

It includes an asset manager which currently only manages sf::Texture and sf::Font objects, but more will be added once I make a game with it. Have a look through the code and let me know if there's anything that could make it more useful (or if it has any bugs).

EDIT: I should mention that it assumes C++11 and SFML 2.2.

4
General / Re: Segmentation Fault When Exiting Pause State
« on: May 07, 2015, 03:09:32 pm »
I've actually got it working now (with one text-related bug I'm still messing with). Once I realized what you guys meant I came at it from the other side of things.

The game class now runs the loop, calling the methods on the active state. When a state transitions, it sets a flag in the state machine and at the start of each loop the machine checks that flag to see if it should pop the state (or add a new state).

I just checked it in, so you can see what I did if you're interested. https://github.com/kiswa/SFML_Starter/

5
General / Re: Segmentation Fault When Exiting Pause State
« on: May 06, 2015, 05:49:55 pm »
Maybe not 'simple', but your response just got my brain to think about it the right way and I have some ideas now.

Thank you!

6
General / Re: Segmentation Fault When Exiting Pause State
« on: May 06, 2015, 04:19:36 pm »
I know that's what's causing the problem, I'm just having a hard time figuring out what needs to be done to solve it. I tried adding an additional check to the loop and calling a method before popping the state from the stack, but it had the same results.

I'm obviously missing something (it's been a while since I did any serious C++) and I was just hoping someone would see it and go "Oh, you just need to do X." Optimistic, I know.

7
General / Re: Segmentation Fault When Exiting Pause State
« on: May 06, 2015, 12:57:52 am »
I'm still going through it, but you're probably right.

If anyone wants to spend some time figuring it out though, I'd appreciate it. I've stepped through it several times, and everything goes in the order I expect. It only segfaults in one particular case, and I've gone through it step-by-step several times.

I thought it was related to SFML because the segfault was always thrown from the RenderWindow::pollEVent method

8
General / Re: Segmentation Fault When Exiting Pause State
« on: May 05, 2015, 11:43:29 pm »
I've continued to dig into this and am getting nowhere. I changed a significant amount of code today, and I still get the same result.

Apparently, I'm doing something wrong when leaving a state. When the segfault is thrown, the call stack looks like this:
Code: [Select]
#0  sf::Window::pollEvent(sf::Event&)() at :0
#1  kg::PauseState::handleInput(this = 0xef64d0) at src/pause_state.cpp:36
#2  kg::PauseState::mainLoop(this = 0xef64d0) at src/pause_state.cpp:28
#3  kg::PauseState::start(this = 0xef64d0) at src/pause_state.cpp:9
#4  kg::StateMachine::startState(this = 0x610150, newState = std::unique_ptr<kg::State> containing 0x0, isReplacing = false) at src/state_machine.cpp:15
#5  kg::GameState::handleInput(this = 0x10a62d0) at src/game_state.cpp:83
#6  kg::GameState::mainLoop(this = 0x10a62d0) at src/game_state.cpp:63
#7  kg::GameState::start(this = 0x10a62d0) at src/game_state.cpp:11
#8  kg::StateMachine::startState(this = 0x610150, newState = std::unique_ptr<kg::State> containing 0x0, isReplacing = true) at src/state_machine.cpp:15
#9  kg::Game::Game(this = 0x7fffffffe7a0, width = 800, height = 600, title = "(\a\?\?\?\?\?\?$@\?\?\?\?\?\?\?\?\?\?\\?\?\?\?\?\?\?\?\?\?\?\?@\?\?\?\?\?\?\\?\?\?\\?\?\\?\?\?\?\?\?\?\?\?\?\?\?\\?\?\?\?\?\?\\?\?\?\?\?@", '\?' <repeats 13 times>, "/TwQ\???\?\?$@\?\?\?\?\?\?\?\?\?\?\", '\?' <repeats 18 times>, "/T\?\?\?\5Tv/Tg=r'Tv", '\?' <repeats 24 times>, "\?\?@\?\?\?\?\?\?\?\?\?\?\\?\?\", '\?' <repeats 15 times>...) at src/game.cpp:8
#10  main(argc = 1, argv = 0x7fffffffe8b8) at src/main.cpp:4

I don't understand why PauseState code is still running at this point! It should not exist once it has been popped off the state machine stack. What am I doing wrong?

Latest code is at https://github.com/kiswa/SFML_Starter/

9
General / Re: Segmentation Fault When Exiting Pause State
« on: May 05, 2015, 03:31:12 pm »
I did use a debugger, and I still couldn't figure out exactly where it was blowing up.

I figured it was related to the stack, and I'm assuming you meant "pause state" when you wrote "unique_ptr gets destroyed and the play state with it." If I'm understanding correctly, I can't pop the pause state because the running code is still in the pause state? Then why does it successfully return to the game state? I can enter and exit the pause state multiple times without a problem, but it throws a segfault when closing the window from the game state. (EDIT: But only if the pause state was entered and exited at least once.)

I'm still not sure what I'm missing, but thanks for the help so far.

10
General / [SOLVED] Segmentation Fault When Exiting Pause State
« on: May 05, 2015, 02:12:48 am »
I have been working on a basic starter setup for an SFML game. When I run it, it works fine, states transition as expected, updates are are at 30 per second, FPS is unbound. Going well.

However, when I transition from the game state to the pause state and back, I get a segfault when closing the window. This does not happen when exiting directly from the game (initial) state, or from the pause state. It only happens when exiting after returning from the pause state to the game state.

I have no idea what I'm missing. Take a look at the code and let me know if you have any ideas. https://github.com/kiswa/SFML_Starter/

Pages: [1]
anything