Hello everyone, I have been working on a game for a few days and I tried implementing collision detection today. Whenever my player is about to collide with a wall or object, love crashes. There's no error or anything and I am not sure what has gone wrong.
Is there a way I can see some more info as to why the game crashed?
Debugging a crash?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Debugging a crash?
Can't you post a *.love file ?
Or at least, the relevant code.
Or at least, the relevant code.
Re: Debugging a crash?
Make or go to your config.lua file and add
then print out what variables you need to see, for instance:
Code: Select all
t.console = true
Code: Select all
print("Collision Function: " .. CollisionFunction( x,y,w,h,x2,y2,w2,h2 ) )
Re: Debugging a crash?
When you say LÖVE crashes, you mean it terminates abnormally? You'll have to use the debugging tools of your OS to figure out why that happened. Linux has gdb and Windows has WinDbg (or the built-in one in Visual Studio). On OS X it's LLVD or gdb, I think. However, the Windows build does not have any debugging symbols, so that's not very useful.
The love.physics module has a few issues that could cause such a termination.
If you don't or can't use the debugging tools, you'll have to resort to print debugging. At the start of your code, open a file with the Lua IO and sprinkle your functions with some calls to file:write that write the name of the called function. Always file:flush after writing (or turn the buffering off) because the crash will eat the last few bytes that still are in the memory. When it crashes again, open the file and you'll see roughly where it was last. You can then narrow the search and, when you found the culprit, ask us why that makes it crash.
The love.physics module has a few issues that could cause such a termination.
If you don't or can't use the debugging tools, you'll have to resort to print debugging. At the start of your code, open a file with the Lua IO and sprinkle your functions with some calls to file:write that write the name of the called function. Always file:flush after writing (or turn the buffering off) because the crash will eat the last few bytes that still are in the memory. When it crashes again, open the file and you'll see roughly where it was last. You can then narrow the search and, when you found the culprit, ask us why that makes it crash.
Shallow indentations.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Debugging a crash?
On OS X I use the Terminal and if a Löve project causes the app itself to outright crash it will print out to the Terminal output. On Windows however the console itself is part of the Löve app and will therefore disappear when it crashes so it's harder to immediately troubleshoot. Follow what Boolsheet says. I don't know where on Windows console crash logs are kept though. Can Löve be run from the DOS Prompt like on OS X and Linux or does it not work that way?
Can you put your project up here for us cross platform people to test and see if it's just Windows?
Can you put your project up here for us cross platform people to test and see if it's just Windows?
Re: Debugging a crash?
I'm not really interested in posting it, but I guess I will if that's what it takes.
The crash occurs if you walk sidewise into a wall or try to move up or down. You can press w,a,s,d to move.
It's probably a stupid little mistake in the code, which is why I wanted to fix it myself.
The crash occurs if you walk sidewise into a wall or try to move up or down. You can press w,a,s,d to move.
It's probably a stupid little mistake in the code, which is why I wanted to fix it myself.
- Attachments
-
- SotB.zip
- (41.37 KiB) Downloaded 128 times
Re: Debugging a crash?
Do not overwrite the global variable print. The default error handler relies on it and explodes if it errors on that.
Shallow indentations.
Re: Debugging a crash?
Figures that was the error. Thank you.
-
- Prole
- Posts: 6
- Joined: Wed Jun 14, 2017 8:06 am
Re: Debugging a crash?
Where does that config.lua file go if LOVE is the interpreter ?mathacka wrote: ↑Fri Jan 04, 2013 9:25 pm Make or go to your config.lua file and addCode: Select all
t.console = true
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Debugging a crash?
>Bumping a thread from 2013
Please quit doing that.
Also, Löve is not an interpreter, it's a framework that uses LuaJIT to compile lua code and run it; your project is run by it finding a main.lua within your project folder (or a zip file with the extension renamed to .love), and you can have many more files next to it, conf.lua being one of them, that is treated a bit specially. See the wiki: Config_Files
Also please don't reply to me in this thread because that would bump it
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Who is online
Users browsing this forum: Bing [Bot] and 5 guests