Engineering II - Week 1
A downloadable project
This assignment was about setting up the base that we will be building game engine features into for the rest of the semester and how to add to it. If this assignment was skipped, you will not be able to do the next assignment. We were given a base C++ visual studio solution, engine code, and an example project. We needed to make our own project that would display a color animated triangle. This is the result:
After building the Graphics library, I needed to add references to the Application library, which in turn gets references within MyGame. The Graphics namespace is used within the Graphics library itself and only needs to include the specific header files it refers to since it is all contained within the same project.
One of the main points that was brought up in class was that instructions given to you in the real world could be outdated and inaccurate, but for most of this project I was able to follow them to a tee. The points of struggle came from some intentional bugs where the solution was hinted at.
Issues I ran into:
1. Linker errors in x86 but not x64. In the added Graphics static library, we needed to add references to other parts of the Engine like Asserts, Logging, Math, etc. When I tested building x64 (Direct3D) worked but not x86 (OpenGL), and since I was getting linker errors, I knew that I messed up a reference somewhere. I ended up finding one of the Unresolved External Symbol calls, and peeking at the definition made me realize that I did not Reference the OpenGLExtensions despite adding it to my Forced Include File. I had also missed a Math reference but found it while clicking through all the files and noting their includes.
2. Excludes from Build not working like intended. By default, it appears that Visual Studio sets the file properties pages to your active configuration. Which means that when you exclude a platform, it will only take effect when you are working in that configuration. I was able to select “All Configurations” and redo the excludes to fix this.
3. Adding a New Icon. I started using the provided link to generate an icon of my personal GitHub picture. Then I added an existing item to my project directory and edited the Resource.h file because that’s where it seemed the original icon calls were coming from. Nothing happened, so after some clicking around and googling, I found out that you need to add “resource” instead of "existing", but I wasn’t able to add a resource because “file in use”. The Resource.h file needs to be closed to add a resource, so I did. Still nothing happened, but a new window appeared in my visual studio, and I explored it. The Resource View window referenced the MyGame.rc file, so I added the icon directly to that, and got a bunch of notifications telling me that the existing.rc file was not using the standard Windows syntax and to change it. Appon, changing it, a bunch of things were added to the Resource.h file, and I tried to use my new icon and existing icon to test the changes, but the solution would not compile due to missing files. I was able to edit the MyGame.rc file and update the icon locations. Also, I commented out what I think is a header guard for some kind of language settings because it was also throwing an error. After all that, I was able to add my icon to the window application.
4. AssetsToBuild lua error. This popped up when I started working with the shader. I saw that it was related to the BuildMyGameAssets (a project that builds shaders), which was copied from the example project, so I ended up going back to the directions for adding it and realized copying the files did not bring the dependencies. So I copied the dependencies from the example and was able to compile.
This I learned this week:
- LNK errors occur when the compiler cannot find libraries or object code within the references you defined.
- Direct3D is used for the x64 architecture, and OpenGL is used on the x86 architecture.
- Direct3D uses left-handed triangles (clockwise), while OpenGL uses right (counterclockwise). Note to self: the L in OpenG’L’ is a lie.
- Dynamic libraries are loaded at runtime, while static libraries’ code gets embedded into the executable at the built time.
- If Project A is dependent on Project B, then Project B must be built before Project A.
- Visual Studio sets the build order automatically based on dependencies made by the user.
- You can exclude files from a build based on the platform.
- Properties sheets are based on priority and can override each other.
I found the first week of class riveting. Low-level engine code has always been something I’ve been interested in but daunting to learn. I like the way the assignments are laid out with working code to study off of. On the other hand, the more user-friendly design of established game engines is appealing to me for prototyping and making games quickly. Higher-level system architecture / abstraction for games and building tools for nonprogrammers is something I hope we eventually discuss (which I think we will with our final projects). I also hope to learn more about shaders and textures and how the GPU works in general.
In terms of how the engine code has been given to us, I think it’s great. I like the way it’s separated into clearly defined files within the engine, and the separated libraries within the engine are nice to only include what you need for quicker compiling. The code style is similar to what I’ve used in the past with m_ denoting member variables, s_ for static, c for class, s for struct, etc. PascalCase for functions is a classic, and camelCase for variables is what I use. There is one thing I do not like: {} brackets moving to the next line. I’m going to slowly change all of those to start on the current line.
Leave a comment
Log in with itch.io to leave a comment.