Download this week’s game with the simple one-click download below! Once downloaded, unzip, play the executable, enjoy!
NancyNewren_ExampleGame 11
What’s new
Gameplay movement is the same but faster, and I updated the 3D objects’ colors and shape and added textures! Time for winter!
Controls
Main object: Use arrow keys to move main object left/right/up/down
Camera: Left/Right (A/D), Up/down (W/S), Zoom in/out (Q/E)
(When moving the camera things in the world will appear to move opposite. Thus when you move camera left, the world will appear to move right.)
About the Project
This week I created a Maya plugin, based on code provided to us by our professor, to export objects created in Maya to my Lua based human readable file format (which I made last week) which then imported the meshes into the game.
The Maya plugin code was a project we added to our solution called MayMeshExporter (MME). Once importing it into my code solution and assigning the proper property sheets, as well as setting the path environment variables for maya and for the maya plugin, no other settings were required (i.e. no project build dependencies nor references). This is because, while the game relies on the output from Maya via the plugin for the mesh data, the output of the MayaMeshExporter is the plugin for Maya, not the mesh data itself. So once the exporter is built we can manually export our objects, and then build the solution to have the MeshBuilder project “build” the mesh files. Essentially as long as we have some files for our meshes, either from the MME or manually made, at build time then we have what we need for our game. And since the MME doesn’t rely on any of the projects in our solution, no references were needed.
I think it’s neat that you can use Visual Studio to debug running programs. I did this with my maya plugin. Here I put a breakpoint inside the “initializePlugin” which is used to load the plugin in Maya.
I’ve used this (the attach debugger to process) frequently when debugging code for Unity and Unreal based projects. It’s incredibly helpful to be able to step through your code this way.
With the MME working, I had a plugin to export data. So I created my plane and a new object for the player game object in Maya, set some vertex colors, and exported. This is what I had:
Maya creates more data than I was using: tangent, bitangent, texcoords, and normals. I chose to export all of them as it was a simple process to export them into my human readable file, and they are just ignored by the mesh import. I decided to do this so that if I chose to include these things in the future in my game it would be one less step I’d have to code in. This was actually helpful then when I added textures to my 3D objects…
The last thing I did was add textures to the meshes. This was a fairly straightforward process, though there were several steps involved, since I had done this previously for the UI elements, and didn’t take that long. This change touched code in graphics (the renderer thread, meshes, and the shaders), to the game graphic objects (where the 3DObjects are stored), to the game itself, but I’m really liking the result!
After applying textures to the meshes the game looks like this:
And… it’s ready for snowfall!