Jump to content
  • Advertisement
rjhwinner03

C++ Where can I find the source code for "Programming a Multiplayer FPS in DirectX"?

Recommended Posts

I have been searching endlessly to find the source code for "Programming a Multiplayer FPS in DirectX." I have not yet been able to find any websites that will give me the source code. Please do not tell me to throw away or sell the book because I just bought it. 

 

 

Please help me because the current source code is badly arranged and has lots of errors... It also seems to be missing files or they are out of place in the source code... 

Share this post


Link to post
Share on other sites
Advertisement

Again, as we've told you a couple times, anything you learn from this book will not work on modern Windows.  It is using D3D9 which is pretty much dead at this point.  But it's your time and knowledge to waste, I did a few google searches but I could find absolutely nothing.  Looks like you're going to have to resolve the issues yourself.  You'll have to try and find the correct SDK version for the book, likely need windows XP/Vista/7 and a completely outdated and unsupported version of Visual Studios then start resolving things error by error.  That bit will be a good learning experience in bringing very old and out-dated code bases into a more modern era.  By more modern I still mean 8-10 years old.

Only worry about the first error, as others after it can be caused by the first one.  If you're going to post them, we need the whole error message, OS version, visual studio version and SDK version info; but I would spend quite a bit of time trying to resolve them yourself because waiting on replies that might fix it from a forum will take you weeks or months to get anything working most likely.

I'm not trying to be a Debbie Downer here, just realistic.  There are free, online, modern examples and you seem to be just starting off in programming so this is likely a very ambitious project.

Share this post


Link to post
Share on other sites
Posted (edited)

I did some digging as well, for the heck of it. There were 2 versions of the latest source code, one if you had the first edition (or was it printing? not sure), and a different one for the second. Both were exe updaters that required the original source code and a password from somewhere inside the book.

Also, You can't program in DirectX as the title seems to suggest.

Edited by fleabay

Share this post


Link to post
Share on other sites
Posted (edited)

There were two editions? 

 

And here is the error that I get when I press play.

Program: Game.exe

Module:

File: f:\dd\vctools\crt\crtw32\misc\i386\chkesp.c

Line: 55

 

The value of ESP was not properly saved across a function call. This is usually a result of calling a function decleared with one calling convention with a function pointer declared with a different calling convention.

 

(Press Retry to debug the application)

When I click retry in the popup, I get sent to a window that claims that chkesp.c was not found, but when i check out the call stack, it says that the error is coming from the following:

>    Game.exe!_chkesp(...) Line 64    C
     Game.exe!Mesh::Mesh(char *,char *)    Unknown
     Game.exe!_GetFileAttributesExW@12()    Unknown
     Game.exe!_GetFileAttributesExW@12()    Unknown
     Game.exe!_GetFileAttributesExW@12()    Unknown
     Game.exe!_GetFileAttributesExW@12()    Unknown
     Game.exe!_GetFileAttributesExW@12()    C++
     Game.exe!_GetFileAttributesExW@12()    C++
     Game.exe!__except_handler3()    Unknown
     ntdll.dll!770a2500()    Unknown
     [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]    
     ntdll.dll!77092fba()    Unknown

Im pretty sure this means that something went wrong in the Mesh class, because in Windows XP, I get the same error...
 

 

Here is what I have tried:

I put all the files in the Engine folder into the normal project, but the Engine folder has not source files, just a static link library file. Perhaps this could be solved if I just link with the lib and not try to include all of the project files?

 

As a side note, I am not just starting off in programming, but I, as you have probably seen in other posts, was still using VC++ 6, VC++ 4, VS 2003, Borland 3, and Watcom... I still have those on my computer, believe it or not haha!

 

 

My reason for using DX9 is because I do not like dealing with the shaders... They are too annoying and do too little things in exchange for 20 mins of work... I can program in DirectX 12, but I choose not to because of the lack of documentation. (I learned from Frank Luna's book) 

 

I also know how to use OpenGL 3 - 4.5, but choose not to because I have difficulties with rendering fog, terrain, and other things that require a shader... 

Edited by rjhwinner03
Answer another post...

Share this post


Link to post
Share on other sites

Yes, if you have the headers and a compiled .lib file I would recommend using that.  Looks like you're compiling with the wrong character set then the library is expecting (the GetFileAttributesExW@12() bit gives this away).

VC4 and 6 are completely and totally worthless.  They're horrifically broken, do not even support the C or C++ standard (they used their own version) and mean your code will not safely (without work) be ported to a more modern C++ compiler.  Borland 3 and Watcom (wow flashback city) are also completely and totally pointless to keep around.  Hanging on to dead compilers and OS's along with programming mentality will likely hinder any progress you want to make.  Few people will be able to play any game you make.  Few people recommend DirectX 12, most still recommend 11.  Though the documentation for 12 is very extensive and complete:
https://docs.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-reference
https://docs.microsoft.com/en-us/windows/desktop/direct3d12/directx-12-programming-guide

Honestly, shaders are a lot faster then immediate mode and offer a ton more options.  I was hesitant to transition at first, as I stopped game coding during the period between OpenGL 1-2 and 3.  But now I'm so much faster with shaders then I ever was with glVertex*() etc.

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, rjhwinner03 said:

They are too annoying and do too little things in exchange for 20 mins of work...

That's not very much work at all. I think I spend more than double that time just compiling my code (ie. not actually working) every morning.You'll find as you gain experience that 20 minutes is a trivial amount of time - 20 minutes is well in the noise in the lifetime of any substantial project. It's certainly not an excuse I would accept to not to do things properly.

If you're not willing to accept that the book you're using won't actually be all that helpful to you, you might try not bothering trying to find the source and instead reconstructing it from the book. I suggest that you will probably learn more that way. And yes, get rid of the old compilers. You mentioned in another thread that you got some code working in VS 2017, just use that.

Edited by Oberon_Command

Share this post


Link to post
Share on other sites

Good news:

I got the source code for the book working... 

Bad news:

I used VC++ 6, and I plan to continue using it for this project...

Share this post


Link to post
Share on other sites
Posted (edited)

Again my advice is stop messing around with DX9. I literally had a working a working program that complied and ran on Windows 7 using DX9.  When I took to over to Windows 10 with the latest version of Visual Studio, I got a bunch of compiles errors.  The old executable itself actually stopped running after a particular Windows 10 update. I messed with it for a while trying to get it to compile and run and then decided it was a waste of time ...... and this was my OWN code! Rather than keep dicking with it further, I decided just to take the code that I needed from it and move to DX11.  Yes it took some doing but now I have a running program on the latest version of Visual Studio and I feel it was way worth it.

Really you should bite the bullet and make the move.  I admit that Microsoft has changed too much stuff with Direct X and provided too little help as far as documentation goes. Even most DX11 books are out of date. However at this point you just need to get over that hump. Take an up to date working DX11 or 12 program and go from there. It wont be a ready to go FPS but you should really learn to program that from the ground up, instead of just taking someones ancient code and tacking crap on to it which will give you more headaches in the long run.

Seriously, start here:

https://www.3dgep.com/introduction-to-directx-11/

You will have working code with a good tutorial.  This is exactly what I did. Now I'm building my engine and making progress every day without suffering with strange compile errors, run errors, bla bla bla......If this was your first post about this, it might be worth it to fix the old DX9 stuff, but clearly it's giving you trouble (which again is somewhat understandable given the the changes in Direct X). It seems you've been stalled for weeks, so IMHO it's time to move forward.

Edited by Gnollrunner

Share this post


Link to post
Share on other sites
30 minutes ago, rjhwinner03 said:

Bad news:

I used VC++ 6, and I plan to continue using it for this project...

Ok, you've ignored all the advice that people here have given you regarding this tool. If you really feel that you must keep using it, then that's your decision, but get used to hearing "for a start, ditch that compiler" in answer to every question you post. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!