Error running TeapotWars

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Error running TeapotWars

      Hi,

      I have followed the read me completely but i still get an error when i try to run TeapotWars.

      The Solution Rebuild worked without any errors (I'm using Windows 8 and Visual Studio 2012 (v110)). Of course I also used the precompiled libs for Windows8.

      After the successful build I hit f5 but the game crash and tells me that there occurred an unexpected exception ... a heap is damanged - untreated exception at ... c++ exception std:bad_alloc at memory

      Im confused why that happens?
      Can anyone give me a hint?

      Does it maybe have something to do with the fact, that i needed to #include <memory> in GameCodeStd.h ? Otherwise i couldn't build it, because any used smart pointer throws an syntax exception.

      Maybe the build output helps?

      pastebin.com/aHQSAKWu

      Regards Helgon

      EDIT:

      I now realized that i can run the editor without any error (even if i cant run TeapotWars_2010) - but no menu point seems to works. i can open the level world.xml and I see the skybox but the whole editor looks like he would have no functionality. Is it a bug or isn't anything implemented?

      The post was edited 4 times, last by Helgon ().

    • Sorry for the delay, we're crunching at work.

      A number of people have had issues running Teapot Wars on Windows 8 using Visual Studio 2012, though it's usually in the compiling & linking stages. Mike and I are still on 2010 and Windows 7 so we don't have any way to debug these issues. :( We'll give it a shot though! :)


      After the successful build I hit f5 but the game crash and tells me that there occurred an unexpected exception ... a heap is damanged - untreated exception at ... c++ exception std:bad_alloc at memory

      Im confused why that happens?
      Can anyone give me a hint?

      What's the call stack? bad_alloc usually means the game couldn't allocate some block of dynamic memory from the heap so the call stack should tell you where in the code it's failing.


      Does it maybe have something to do with the fact, that i needed to #include <memory> in GameCodeStd.h ? Otherwise i couldn't build it, because any used smart pointer throws an syntax exception.

      No, it wouldn't compile if there was a missing #include. The smart pointer issue is because Visual Studio 2010 hadn't switched that stuff to the std namespace yet, but I believe 2012 has. You should just be able to update those typedefs to use the std namespace (so you'd use std::shared_ptr and so on).


      I now realized that i can run the editor without any error (even if i cant run TeapotWars_2010) - but no menu point seems to works. i can open the level world.xml and I see the skybox but the whole editor looks like he would have no functionality. Is it a bug or isn't anything implemented?

      The level editor should work, but it connects to the game. You likely need to get that working first.

      -Rez
    • Hi, thanks for the answer.

      Here's the stack call:

      Source Code

      1. ntdll.dll!77f4a9ff() Unknown
      2. [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
      3. ntdll.dll!77f4bcf5() Unknown
      4. ntdll.dll!77ef868b() Unknown
      5. ntdll.dll!77ec5888() Unknown
      6. ntdll.dll!77ec55c5() Unknown
      7. ntdll.dll!77ec591e() Unknown
      8. ntdll.dll!77ec55c5() Unknown
      9. ntdll.dll!77f4ce9a() Unknown
      10. ntdll.dll!77ef85ff() Unknown
      11. ntdll.dll!77ec55c5() Unknown
      12. ntdll.dll!77ec591e() Unknown
      13. ntdll.dll!77ec55c5() Unknown
      14. ntdll.dll!77eb3748() Unknown
      15. > msvcr110d.dll!_heap_alloc_base(unsigned int size) Line 57 C
      16. msvcr110d.dll!_heap_alloc_dbg_impl(unsigned int nSize, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp) Line 431 C++
      17. msvcr110d.dll!_nh_malloc_dbg_impl(unsigned int nSize, int nhFlag, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp) Line 239 C++
      18. msvcr110d.dll!_nh_malloc_dbg(unsigned int nSize, int nhFlag, int nBlockUse, const char * szFileName, int nLine) Line 302 C++
      19. msvcr110d.dll!malloc(unsigned int nSize) Line 56 C++
      20. TeapotWars_2010Win32Debug.exe!btAllocDefault(unsigned int size) Line 24 C++
      21. TeapotWars_2010Win32Debug.exe!btAlignedAllocDefault(unsigned int size, int alignment) Line 70 C++
      22. TeapotWars_2010Win32Debug.exe!btAlignedAllocInternal(unsigned int size, int alignment) Line 163 C++
      23. TeapotWars_2010Win32Debug.exe!btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache * paircache) Line 137 C++
      24. TeapotWars_2010Win32Debug.exe!BulletPhysics::VInitialize() Line 404 C++
      25. TeapotWars_2010Win32Debug.exe!CreateGamePhysics() Line 1130 C++
      26. TeapotWars_2010Win32Debug.exe!TeapotWarsLogic::TeapotWarsLogic() Line 166 C++
      27. TeapotWars_2010Win32Debug.exe!TeapotWarsApp::VCreateGameAndView() Line 95 C++
      28. TeapotWars_2010Win32Debug.exe!GameCodeApp::InitInstance(HINSTANCE__ * hInstance, wchar_t * lpCmdLine, HWND__ * hWnd, int screenWidth, int screenHeight) Line 277 C++
      29. TeapotWars_2010Win32Debug.exe!GameCode4(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 166 C++
      30. TeapotWars_2010Win32Debug.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 80 C++
      31. TeapotWars_2010Win32Debug.exe!__tmainCRTStartup() Line 528 C
      32. TeapotWars_2010Win32Debug.exe!wWinMainCRTStartup() Line 377 C
      33. kernel32.dll!754f850d() Unknown
      34. ntdll.dll!77ecbf39() Unknown
      35. ntdll.dll!77ecbf0c() Unknown
      Display All


      Does it help?

      Regards
    • It looks like Bullet is the issue. We use the 3rd-party Bullet system for our physics and it's dying when trying to allocate memory. The only thing I can suggest is to try to get the latest version of bullet and see if you can get that to work.

      If you just want to run the game, you can also try disabling the physics system. You *should* be able to do this by change the call to CreateGamePhysics() to CreatNullPhysics() on line 166 of TeapotWars.cpp. If this works, you won't have any control and the game won't do much, but you can run it and set a few breakpoints. If it doesn't work, let me know and I'll poke at it a bit to see if I can figure out how to easily disable physics.

      I seem to remember some people getting it running on Visual Studio 2012 under Windows 8 but I don't recall what they had to do. Bullet was definitely an issue, but I think it was solved by using a specific version.

      -Rez
    • ... and that specific version was Bullet 2.80 for me.

      I found the clue in the caveats when downloading 3rd party libs here. It says that you must use Bullet 2.80 and not 2.81 (in the game code SVN there's a Bullet 2.79 version, but anyway...).

      I googled Bullet 2.80 and ended up here. I downloaded the source code, compiled it as a separate project and took the output files and pasted them in the Game Coding Complete folder, under Source\Lib\Win32Debug.

      After that, the error about btDbvtBroadphase simply disappeared.

      It's been a long time since this post, but I spent so much time on this that I thought it could be useful for someone.

      Hope it helps!

      By the way, I'm using Windows 7, not 8, but I don't think it relates to this problem.
    • Making a robust and high performance physics engine is a serious programming challenge indeed.

      It's not too bad to make a 2D physics engine though.
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • Source Code

      1. ntdll.dll!773b5ba7() Unknown
      2. [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
      3. ntdll.dll!7730cacc() Unknown
      4. ntdll.dll!7735ad95() Unknown
      5. ntdll.dll!773b6060() Unknown
      6. ntdll.dll!7735a77c() Unknown
      7. ntdll.dll!773b6060() Unknown
      8. ntdll.dll!7735a77c() Unknown
      9. ntdll.dll!77311634() Unknown
      10. msvcr120d.dll!1006c6e1() Unknown
      11. msvcr120d.dll!1007d72f() Unknown
      12. msvcr120d.dll!1007dbcd() Unknown
      13. msvcr120d.dll!1007db7a() Unknown
      14. msvcr120d.dll!1007e5a9() Unknown
      15. TeapotWars_2010Win32Debug.exe!btGeneric6DofConstraint::updateRHS(float) Unknown
      16. [color=#FF0000][b]> TeapotWars_2010Win32Debug.exe!CreateGamePhysics() Line 1130 C++[/b][/color]
      17. TeapotWars_2010Win32Debug.exe!TeapotWarsLogic::TeapotWarsLogic() Line 166 C++
      18. TeapotWars_2010Win32Debug.exe!TeapotWarsApp::VCreateGameAndView() Line 95 C++
      19. TeapotWars_2010Win32Debug.exe!GameCodeApp::InitInstance(HINSTANCE__ * hInstance, wchar_t * lpCmdLine, HWND__ * hWnd, int screenWidth, int screenHeight) Line 277 C++
      20. TeapotWars_2010Win32Debug.exe!GameCode4(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 166 C++
      21. TeapotWars_2010Win32Debug.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 80 C++
      22. TeapotWars_2010Win32Debug.exe!__tmainCRTStartup() Line 618 C
      23. TeapotWars_2010Win32Debug.exe!wWinMainCRTStartup() Line 466 C
      24. kernel32.dll!76dd7c04() Unknown
      25. ntdll.dll!7732b90f() Unknown
      26. ntdll.dll!7732b8da() Unknown
      Display All


      Visual Studio 2013 Ult, Windows 8.1 Pro x64, memory.h replaced with memory and such.
      Bullet Physics 2.80, compiled from source, libraries overwrote in lib.

      TeapotWars_2010 compiles, but...yeah. CreateNullPhysics works fine, but really defeats the purpose of a practical example.

      The cause seems slightly different, but still related to Bullet Physics. Any luck? Perhaps one of the authors could create a VM with a trial of Windows 8.1 x64 and Visual Studio 2013 and try creating a project that much more easily compiles.

      Also, I can't seem to put up for thought in the Books section the following:
      • http://www.amazon.com/Engine-Architecture-Second-Jason-Gregory/dp/1466560010/ref=sr_1_1?ie=UTF8&qid=1417284203&sr=8-1&keywords=Game+Engine+Design
      • http://www.amazon.com/Game-Engine-Design-Interactive-Technology/dp/0122290631/ref=sr_1_2?ie=UTF8&qid=1417284203&sr=8-2&keywords=Game+Engine+Design
      How useful would the second one be? What does anyone think of the first?

      The post was edited 3 times, last by Yuji Saeki ().

    • Mike and I need to spend some quality time with Teapot Wars to get it working with Visual Studio 2013. The problem is definitely with Bullet somewhere. I'm not sure about Windows 8.1 vs Windows 7 but I can't imagine any kind of compatibility issues with the physics system.

      I don't own either of the books you mentioned. The second one looks like a good companion to ours (and I think other members of this site have agreed). It speaks more in-depth about physics and graphics and covers things you didn't talk about, like animation. I would recommend checking it out.

      I don't know anything about the first one.

      -Rez
    • I just upgraded it to vs2013 and got it to build... It needs the old effects lib that comes with dxtools, and you have to set it to singlethreaded debug dll, the new effects library has changed the D3DX11CreateEffectFromMemory... Tried running it with bullet-2.80-rev2527 (You have to remove the .hlsl files from debug build, so you can get the BulletSoftBodySolvers_DX11_Debug.lib), but it crashes almost every time, it doesn't like the memory management... It seems the new 2013 code will have to be rewritten a bit to allow the new effects11 and the new bullet3 libraries to go with it, quite a bit of work :)

      Edit:
      This is where the error pops up

      Source Code

      1. TeapotWarsLogic::TeapotWarsLogic()
      2. {
      3. m_pPhysics.reset(CreateGamePhysics());
      4. RegisterAllDelegates();
      5. }

      It gets stuck on m_broadphase = GCC_NEW btDbvtBroadphase(); in BulletPhysics::VInitialize().

      The post was edited 1 time, last by Wolkec ().