Game Engineering – II|Assignment – 6

For this assignment the primary objective was to completely remove any hard coded data for meshes in our game. Instead this data would now be loaded from a file at run-time. The most obvious advantage here is that now we don’t have to rebuild the project every time we need a new mesh. We can just go and change the external data file and we will have a new mesh.

Here is the executable MyGame_

Controls :

  • F1 – F2 — Move camera up – down
  • F3 – F4 — Move camera left – right
  • directional keys — move shape
  • SPACE — remove shape

For now we store this data in a simple lua file and when loaded in, the game runs it through a lua parser which extracts all the information needed to create a mesh. (This will change later when we will use straight binary files).

MeshData
MeshData

There is an obvious advantage to have a lua file as opposed to a binary file and that is readability. A lua data file can be made in a way such that it is human readable, debug-able, understandable etc. The main advantage of having a human readable file is that non-engineers can then change or modify these external data files for testing.

The flip side to this is that the more readable a lua file is, to more difficult it is to parse (relatively). Finding that right balance was the main learning point for this assignment (especially since we won’t be using it after this.)

A personal challenge (if I would call it that) that I faced for this assignment was where to put my lua parser. Since it would only be used for parsing files specific to a mesh would it be better to create its own separate class or just put it inside the mesh class?

I ended up doing the latter since again, we wont be using it for long. The only downside to this was that now I had to add the lua project as a reference to the graphics project.

And finally the game but now with meshes loaded from a data file.

game

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s