The factory

Posted by

Click for larger versionOn the right, you can see a new unit I've been working on - the factory. The graphics are obviously just my crappy programmer art, but it kind of looks a bit factory-like.

But the factory itself is not of concern. The interesting part (and the thing that's taken me the longest to implement!) is the icon you can see on the right.

See, the way it works is that entities which can build things have a builder_component and entities that can be built, have a buildable_component. What happens is that when you select an entity that has a builder_component, the build window (which is the big one on the right) pops up. Then we look at the builder_component's build group and enumerate all entities with buildable_components with the same build group.

In the case of the new factory, it has a build group of "vehicles", so all of the entities with that same build group for their buildable_component (in this case, there's only one for now) get populated.

In the icon for the build button, we display a rendering of the mesh for that entity. When you hover over the button, the entity icon rotates - obviously a screenshot doesn't do it justice, but it's a nice little effect, and it took me a while to get it right :)

So that's it for now. I've actually been a bit sick lately, so I haven't really felt up to doing much work in my spare time, but I should be better now. Fingers crossed!

blog comments powered by Disqus