Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Game randomly no longer working  (Read 1591 times)

0 Members and 1 Guest are viewing this topic.

juiceeYay

  • Newbie
  • *
  • Posts: 16
    • View Profile
Game randomly no longer working
« on: February 10, 2015, 05:55:14 am »
So I have been pulling hairs out trying to figure what has gone wrong. My game has been behaving as expected for at least a week and all of a sudden when I tried running it today, it acted out. It started randomly moving sprites all over the screen if I moved my mouse or pressed a key (it was designed to move the view only if WASD was pressed and it did do that up until today). Once I exited the program Xcode would spit out the same error: "memory read failed for 0x41a00000".

I tried making the same project on my Windows computer. Configured SFML for Code::Blocks and I know it works because I made some simple SFML games to test. This game compiles fine, but it just produces a blank white window that doesn't respond.

I am attaching the three files used since they are each around 200 lines long, so if anybody has any ideas that would be awesome thanks.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11028
    • View Profile
    • development blog
    • Email
Re: Game randomly no longer working
« Reply #1 on: February 10, 2015, 01:55:25 pm »
Narrow it further down by cutting out everything that doesn't remove the issue.
That way you'll most likely find the issue yourself and if you don't, you'd end up with a minimal examples other can test.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

juiceeYay

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Game randomly no longer working
« Reply #2 on: February 10, 2015, 07:01:54 pm »
I have been, it is essentially just drawing a few sprites with one texture and is still returning weird memory issues in Xcode. All my other SFML projects that I haven't even opened in weeks now don't work either in Xcode, returning strange memory errors I have never encountered before. I have even't used the word "new" or used pointers in any of my code (have used references as parameters in methods).

SFML appears to be working fine on the Windows computer, so I will try to narrow it down on there if I can, but I don't just want to completely abandon ever using my laptop again to make SFML projects. Thus why I uploaded the files, I've eliminated everything, and along the way, every single error is memory related in Xcode. Also it makes no sense why in Xcode my sprites should be moving as my mouse moves, there is nowhere in my "main" that I call anything mouse related nor should they move if I am just pressing WASD to move the view.
« Last Edit: February 10, 2015, 07:04:57 pm by juiceeYay »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11028
    • View Profile
    • development blog
    • Email
Re: Game randomly no longer working
« Reply #3 on: February 10, 2015, 10:37:06 pm »
Well "all of a sudden" stuff doesn't get broken. Something changed and you should try to figure out what exactly. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

juiceeYay

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Game randomly no longer working
« Reply #4 on: February 17, 2015, 02:53:38 am »
Well I don't know what's going on now. I tried starting from scratch, and now nothing works. I created a fresh SFML project in Xcode using the template, which has always worked for me, but now when I run, the window opens and the sprite "cute_image" briefly shows up on the window and then the program crashes. It says there is a "EXC_BAD_ACCESS" on Thread 1 at the line "window.draw(sprite)".

What have I done wrong? I haven't changed any settings in the template or in Xcode as far as I'm aware. I haven't downloaded a new version of SFML either.

I have found why it wasn't working on Windows though: code::blocks won't properly execute std::uniform_real_distribution, which my code uses, even when I tell it to use C++11, so not sure how to get around that, but I guess I can just use 'rand()'.
« Last Edit: February 18, 2015, 12:03:44 am by juiceeYay »