Monday, December 31, 2012

day 1 progress

Here's progress from Day 1. I didn't knock off much from my initial todo list, but that was expected. There were a few editor things that needed to be taken care of first, so now it's in a useful state. Previously I was generating the level contents from code, and I had only hooked up ways to edit existing objects in the level. Today I added a way to add and remove objects from a level. I can also load and save levels, which is sorta important :)

Added the PrimitiveMesh component. The engine has a few built-in primitives (cone, cube, cylinder) and I wanted a way to attach these meshes to a GameObject.

Adding new types of components to the engine is pretty straightforward. I'll paste the necessary code below so you get an idea. There is one bit unique to this particular situation - this is the first time I have a component with an enum member, so I manually had to write code for serializing it to json (since I wanted it to show up as a string in the editor). In the future I'll have an enum registration system so this code is completely autogenerated, and in the tool will automatically create a drop-down box in the tool to pick the value by name.

Also I need to add an Effect resource pointer to the PrimitiveMesh component, so you can choose the shader to render the mesh with. At this point is just uses a default shader. I also need to write a material parameter editor, so you can actually tweak the parameters of the shader you choose (textures, constants, etc).

Tomorrow I hope to actually tackle some initial gameplay.



Also, here's an example of a level file. It's called a level right now, but I'm going to rename this to prefab. It's really just a hierarchy of game objects with property values for components. Eventually there will be a way to reference other prefabs and override component properties, etc. For now everything is explicit. Here's the file:

No comments:

Post a Comment