March 10, 2015 at 8:16 am #331
I have been following through the chapters on my machine and have run into difficulty when running the chapter 12 code.
The specific VS error code is MSB3073 – which is a build error arising from the build events inputted from p245. The specific error states that the build exited with code 9009 (which I believe is an error relating to the MakeSpriteFont.exe not being obtainable)
Since I have been writing the code on my end rather than just copying it over (increase my understanding) my directiory structure I think is different (by mistake, but now its a bit annoying), which I know will change the build scripts but I cant seem to figure out what to.
My directory structure is as follows:
-Game (Game $(ProjectDir) )
-Library (Library $(ProjectDir))
– Debug ($(OutDir))
-Library (Lib project src code)
-Game (Game project src code)
Is there any chance you can help at all. I am not sure where my content really should go and where it should be in relation to my executable, hopefully I have been as descriptive as possible. And I am sorry for the really awful directory structure, its no wonder I am struggling
Thanks a lot =)March 10, 2015 at 8:20 am #332
Just to be clear (since it has formatted my dir structure badly above)
Game and Library lie within Rendering
Game and Library (projectDirs) lie within the corresponding Game and Library folders (ie Rendering – Game – Game : stupid I know)
similarly (source – Library, source – Game ).
cheers againMarch 10, 2015 at 9:50 am #333
Please post the post-build script you’re getting an error on and I’ll take a look.
In the book’s structure, this is the event I’m executing for Chapter 12’s Game project:
mkdir "$(OutDir)Content" IF EXIST "$(SolutionDir)..\content" xcopy /E /Y "$(SolutionDir)..\content" "$(OutDir)Content\" IF EXIST "$(ProjectDir)content" xcopy /E /Y "$(ProjectDir)Content" "$(OutDir)Content\"
This creates a “Content” directory in the directory that the Game.exe file resides (in my config that’s Chapter12\build\Debug). Then the script looks for a “content” directory up one directory from the solution directory. This is a duplicated directory, from the Library project, that gets copied there in a Library project post-build step. I do this so that I don’t have to iterate down into the direectory structure of the Library project. Not that doing so would be a horrible thing, it just means that I can’t move the location of the Library project easily. If that $(SolutionDir)..\content directory exists, it copies the contents to the newly created $(OutDir)Content directory.
Finally, I do this again for a content folder in the Game project (if one exists). This setup allows me to store content that’s referenced in the Library project and content specific to the Game project. Both sets of content need to be copied to a directory that’s within or beneath the Game.exe directory.
Note that the script puts double quotes around the various directory references. That’s to allow for spaces in directory names. These are just DOS batch scripts, and a space is a delimiter so you need to quote the path. Also note that the $(SolutionDir), $(ProjectDir), and $(OutDir) directories all have a trailing backslash, so you won’t supply one explicitly.
PaulMarch 10, 2015 at 10:20 am #334
Cheers for the quick reply.
I used the same scripts as you initially, but both the Lib post build and Game pre build fail to work.
so my solutiondir is build/Rendering/ and contains the projectdirs Game/Game and Library/Library. Both contain the .vcxproj files and Debug. They don’t contain the src code as this is in build/Rendering/source/(Library or Game).
So the mkdir “$(SolutionDir)..\content” will make this folder in build/ and “$(Outdir)Content” in build/rendering/Game/Game/Debug.
Although “$(SolutionDir)..\content” exists it does not get anything copied to it, suggesting IF EXIST “$(ProjectDir)Content … in the lib post build isn’t working.
Do I need to explicitely make a Content folder in the Library project dir (ie build/rendering/Library/Library/)?
I know it’s a horribly nested dir structure but I thought it may still work. Other things I tried was to make the content folder as follows
mkdir “$(SolutionDir)../source/Library/content/” ie in the Library source folder folder one up from the solution dir but this also didn’t work.
Sorry if this is confusing, I really appreciate your help here =)
MitchMarch 10, 2015 at 10:58 am #335
You’ll need to create a Content directory in whichever Library location you want that content to exist, and then update your Library project’s post-build copy script to match. My advice would be to put that Library Content directory in the same directory as your Library.vcxproj file. That way you can access it, through your Library post-build script, as simply $(ProjectDir)Content.
Irrespective of “where” you put things, just understand that your scripts reference those locations. The goal here is to copy Library and Project-specific content to the output directory of your Game project (where your Game.exe lives). In Chapter 12, the only content that’s required is a .spritefont file, but more content gets add as you continue in the book.
You might start by manually creating the OutDir content directory (actually that .spritefont file lives in content\fonts) and manually copying files just so that you understand what your script should be doing. Then mimic that action in a post-build event.
Finally, you’ve mentioned a couple of times that you aren’t happy with your directory structure, so my advice there is to change it. Personally, I find that storing the .vcxproj files alongside the source (and content) files to be very helpful. It makes referencing those locations in between projects and in build events easier.
And look at my versions of the projects, on bitbucket.org, for comparison.
PaulMarch 10, 2015 at 1:05 pm #336
I tested it manually and it works fine. The issue is when I add in the build scripts. I have placed my Content directory (with .spritefont file inside) in the Directory with the lib.vcxproj inside and I used $(ProjectDir)Content and it still fails to work. The error is still “exited with code 9009”.
It’s puzzling me greatly as I am following the file paths in the error output and the IF EXIST folders all exist, it is creating the content folders but then they are empty suggesting either the check fails or there is a copy error.
Are there any other requirements for the code in the book to work? It seems odd especially why the Library post script code is failing. Since all the builds are failing the game.exe doesn’t exist? Is this a problem (I mean it makes sense if the builds fail)
Cheers for the help and sorry for my ignorance
MitchMarch 10, 2015 at 2:05 pm #337
Have you tried building the unmodified source from the bitbucket.org repository? I’m wondering if this could be a path issue to xcopy.exe. By default that file exists at c:\windows\System32\xcopy.exe. It would be strange not to have c:\windows\System32 in your PATH environment variable, but that could be it. If you build my code and still see the error, this could be the problem.
Alternately, it could be a space somewhere in one of your paths. Make certain that you have double quotes around all of your path references.
Give that a shot, but as a final ditch you could upload your code somewhere and I could take a look.
PaulMarch 10, 2015 at 2:07 pm #338
I am so annoyed with myself! Shall I tell you what my problem was.. I put the copy path on a new line in my build scripts, which is the dumbest thing I think I could do. I was wondering why it wasn’t working? That is literally hours of my life gone lol.
Thanks so much for your help Paul. I have been learning to code myself for quite a few years now and wanted to apply it in an interesting field. Sine I studied Maths and Physics Graphics seemed one of the best applications and I am so far finding it so interesting. (Aim is to hopefully do it pro one day).
I guess one final question would be what a Graphics programmer would spend the larger amounts of their day doing? Ie engine writing or shader writing? I am particulalry interested in the effects stuff.
Thanks again for your help, feeling pretty stupid at the moment.
MitchMarch 10, 2015 at 2:46 pm #339
Actually that being said my joy is short lived as the game.exe won’t open. It’s throwing a Debug error – R610 and saying abort() called. I have now used all the code from bitbucket. Is that a hardware issue do you think?March 10, 2015 at 3:00 pm #340
Glad you figured out the build step error. To your run-time error, step through the code in the debugger to see where it’s crashing. I can’t say what the error is before knowing a bit more, so I won’t jump to a conclusion that it’s a hardware issue. That said, if you’re using an older video card, check its specs to be sure that it supports DirectX 11 and install the latest drivers.
As to what a graphics programmers spends more time on… In my experience it’s often that graphics programmers are also engine programmers. But more and more you see shaders being written by technical artists or other non-engine-specific engineers. It largely depends on the company you’re working for and if they are using a third-party engine or something homegrown.
PaulMarch 10, 2015 at 5:02 pm #341
It doesn’t seem to let me debug my project (just says unable to start program <dir>\Library.lib). As is the case it just seems to be one error after another now. My graphics drivers are up to date apparently although my graphics card sucks. I know its not a code problem as it is identical to your src code, so I am a bit stumped tbh.
Thanks for the info. Ah so the HLSL would be less commonly used by say a Graphics programmer in the games industry?
MitchMarch 10, 2015 at 7:36 pm #342
In order to run the Game application in the Visual Studio debugger, right click on the Game project and choose “Set as Startup Project” from the context menu. Then you can press F5 or choose Debug | Start Debugging to launch the application. Alternately, you can right click the Game project and choose Debug | Start New Instance.
No, HLSL is very much in use by graphics programmers in the games industry. For the most part it’s either HLSL or GLSL (the OpenGL Shading Language). But graphics programmers also, commonly, write in C++. Whereas technical artists are more apt to write shaders in HLSL and less likely to write in C++. It just depends on the company and the individual. I’ve met many technical artists that are hard-core programmers, and their title just implies that they focus on the art side of the pipeline.
PaulMarch 11, 2015 at 3:07 am #343
Thanks again for the response, I did that and the debugger worked =) so cheers for that (I had set the Library project as StartUp project initially so that was my confusion).
The error appears to be in BinaryReader.cpp more specifically at the command mPos = mOwnedData.get(). Its throwing an exception at a specific memory address on my machine. Is anything leaping out at you initially as to the cause? I will continue to look myself also.
Thanks for the info, yeah I like HLSL and certainly appreciate the graphics in games (particularly the special effects like shadowing or complex lighting effects). I guess I will work on both of them throughout the book and delve into further topics later too =)
MitchMarch 11, 2015 at 12:00 pm #344
Hey Paul, it all works (what can I say, I am used to debugging my apps =P ). It was an exception thrown due to the fact that my .spritefont file wasn’t nested in a Fonts files like yours, so the directory I was using to obtain the file didn’t exist.
Thanks for the help overall. You have been awesome. And I really do love the book, it’s been such a useful grounding into Graphics Programming.
MitchMarch 11, 2015 at 5:32 pm #345
Glad to hear you got your code working and that you’re enjoying the book. Shout if you have any other questions.
You must be logged in to reply to this topic.