Pinned Source Code v2.2

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

    • Source Code v2.2

      Here is the latest source code (v2.2) for the book!

      Some of the things that are in this release:

      Changes from 2.1 to 2.2
      ------------------------
      1. Fixed compile problems related to AGEIA's latest PhysX SDK v2.3
      2. Fixed a physics debug renderer problem - verts were being calculated incorrectly
      3. Fixed a problem with the random number generator's method to create a FLOAT randomly in a range
      4. Added debug memory checks to all the DXUTIL code to help find memory leaks (see DX_NEW)
      5. Fixed some build target malfunctions
      6. Moved all resources from GameCode2.lib project to TeapotWars project
      7. Created a new Teapot icon and got it to work (search for LoadIcon to see how this works)
      8. New member pure virtuals in GameCodeApp - VGetGameTitle(), VGetGameAppDirectory(), and VGetIcon(). These new vituals are implemented in TeapotWarsApp - and if you have been using 2.1 you'll need to do the same thing
      9. Added _CRTDBG_LEAK_CHECK_DF flag to the _CrtSetDbgFlag call - this ensures a memory leak dump just before the game exits. The call to _CrtDumpMemoryLeaks() was not catching all the globally constructed/destructed objects
      10. Added a destructor to TeapotWarsGame class to formally destroy actors - you'll need to reimplement this same method in your game or you'll have leaks too
        [/list=1]

        NOTE: This code was tested on VC 2003 - for those 2005 users you'll need to do a little tweaking to get rid of warnings and fix some other minor problems.
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • RE: Source Code v2.2

      I've been away for a while... So I tried downloading the 2.2 source... and I get a dialog asking me where to save the file and the file very, very, very quickly downloads (surprisingly so...). Then I look at the file in Windows Explorer and it is 0 kb. I double-click on it, and I get an error dialog saying:

      "C:\temp\GameCode2[1].2.exe is not a valid Win32 application."

      Mike, can you verify the file is intact on your server?
    • Hello Mike,

      How big is the code once extracted?

      [Edit]About 75 MB[/Edit]

      I've downloaded the GameCode2[1].2.exe file and ran it to get a "Program too big to fit in memory" message at the command prompt.

      [Edit]It's only a problem I have with the .exe self extractor. When I use UltimateZip to extact it mannully everything is fine[/Edit]

      Thanks
      Colm Mac

      [Edit - 17 June]Answered my own questions and problems.

      P.S Finished the book today. Great book Mike. [/Edit]

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

    • RE: Source Code v2.2

      I have downloaded vs2005 C++ and made it through most of the problems, by following the instructions for vs2003.
      I downloaded Directx SDK and then pointed vs2005 to it.
      I downloaded Platform SDK W2k3 and pointed Vs2005 to it.

      I am down to the last problem, which is this...

      fatal error C1083: Cannot open include file: 'atltypes.h': No such file or directory

      Any thoughts anyone...

      Thanks in Advance,

      Gerry
    • RE: Source Code v2.2

      Originally posted by gwashburn
      fatal error C1083: Cannot open include file: 'atltypes.h': No such file or directory

      Any thoughts anyone...

      Thanks in Advance,

      Gerry


      Yup! Check it out:
      mcshaffry.com/GameCode/thread.…ght=CRect&hilightuser=525

      -Rez
    • RE: Source Code v2.2

      Thanks,

      I take it the Express editions wont work with ALT/MFC. I read that Somewhere, but it didn't click.
      I have VS 2003 VC++ from previous MSDN Subscription. Is that my better choice?
      I figured since MSFT released the 2005 Express Editions and they work with their new game development platform "XNA", that they would be robust enough for my meager development efforts.
      I am primarily a VB programmer. Haven't touched C++ in long time. Most corporate database applications are written in VB with SQL hence I've been living in that realm for quite sometime. My main goal is to setup a decent Game Development Platform for myself. I've also setup Code Blocks with Borland C++ 5.5 Compiler and Turbo Debugger as well. Any thoughts which way to go?

      Thanks,

      Gerry
    • RE: Source Code v2.2

      Mike or Kain might correct me, but I believe The original engine was written using VS 2003, so that's probably your best best. You're correct in that the express version doesn't have ATL support, which is where your problem lies. You can always just write the classes yourself (or copy & paste mine).

      -Rez
    • RE: Source Code v2.2

      Are you working with VS2005 C++ Express? Any other gotchas you know of? I really wanted to use their latest IDE so I could get some experience with it and determine whether or not I would want to upgrade. Cost not really an issue, but is it worth the effort, as time is an isuue. Since I am still primarily using vb6 and vb2003 at work, and it looks like it will be a while before they will change and use the latest toolsets, I figured I would immerse myself in my own project with the latest tools.

      Thanks for the help,

      Gerry
    • RE: Source Code v2.2

      No, we use the full version of Visual Studio 2005 here. ATL support is the only issue I know of, but there are others on here who use it quite a bit and would know better than I. I have absolutely fallen in love with the debugging support, especially with the STL. Walking through a std::map is soooooo much nicer!

      -Rez
    • RE: Source Code v2.2

      Well I loaded up my MSDN version of VS2005 Professional and made what I thought were all the appropriate changes and am still getting an error, but different then before.

      Error 1 fatal error C1083: Cannot open include file: 'resource.h': No such file or directory d:\my documents\visual studio 2005\projects\gamecode v2.2\source\gamecode.h 42
      So I am now looking to solve this one...Quite the project this has become...

      Gerry
    • I'm getting the same thing. I converted the project to studio 2005...wonder if that had anything to do with it. I'm also getting a few more files missing.

      c:\projects\gamecode v2.2\source\gamecode.h(42) : fatal error C1083: Cannot open include file: 'resource.h': No such file or directory
      PhysicsEventListener.cpp
      c:\projects\gamecode v2.2\source\physics\physicseventlistener.cpp(45) : fatal error C1083: Cannot open include file: 'NxActor.h': No such file or directory
      PhysicsStream.cpp
      c:\projects\gamecode v2.2\source\physics\physicsstream.cpp(7) : fatal error C1083: Cannot open include file: 'NxPhysics.h': No such file or directory
      GameCode2.cpp

      forgot to install the physics sdk, so i'll get back in when I get that figured out..it still bothers me that there is no resource.h in the zip though.
      There are 10 types of people in this universe; those who understand binary and those who don't.

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

    • Found resource.h here for those facing the same problem. Thanks Jerry, as you helped me compile it. Now for a different question. How long does it take Agea to email login info? I applied for an account on the 20th of january...recieved an email stating that I would later receive my login info, and am still waiting.
      There are 10 types of people in this universe; those who understand binary and those who don't.
    • I first tackled this a year ago and at the time got the physics stuff working. If I remember right it took 1 or 2 business days.

      I just started getting back into the project on a new computer, and haven't attemped to download the physics package yet. So I'm not sure how long the wait is these days. I suspect it wouldn't be more than a couple days.
    • hmm...a year ago 2 days...
      6 months ago 2 weeks...
      ...[sarcasm]ok i'll have this in about 2 months then.[/sarcasm]

      thanks for the info daglamier22...i'll just sit on this one for a while.
      There are 10 types of people in this universe; those who understand binary and those who don't.
    • GetCPUSpeed() and Muticore?

      I do not have a multi-core computer at my disposal so I have to ask those that do. (I believe this is the appropriate section to ask, as it's related to the source code.)

      I wonder, how does the function GetCPUSpeed() behave on multi-core computers (especially the most recent ones designed to get the most out of single-thread apps)?

      I fear that the information obtained will be inaccurate.

      If it runs correctly and returns the speed of a single core, can we detect the presence of multi-core processors (or at least the processor name or product id, so that this information may be inferred)?
      ~ amblis
    • Check the processor's assembly instruction set and see if it returns that info in it's CPU info structure. It probably does and you can detect a dual-core processor if this field in the info structure does not exist or is empty. Most old assembly language CPU identification tricks worked in a similar fashion - try something and if it fails you fall back to other stuff until you get a positive and that must be your processor... lol.

      Of course, this assumes that the CPU's identification routine is compatible with your assembler.

      Um, enough rambling - I'd say go to Intel and AMD and look up their instructions on programatically identifying their CPUs.
      "Your job is not to die for your country. Your job is to make some other poor sod die for his."