12 Aug

Week 19 Recap

Looking Back

It was a slow week. I just could not stay focused. Some smaller issues have been resolved, though:

  • When planning building foundations, they will now snap to the unit grid
  • Pause functionality is in, still requires some visual cues in some instances (e.g. dimming the screen)
  • Found and fixed an issue with the AI not properly resetting when NPCs searched and ate food

Animations are still somewhat borked:

Animation Fail

Animation Fail

What is happening here is that some of the animations have movement and offsets encoded within them. If not properly compensated, it leads to flying dorks which are supposed to look around on the ground.

Looking Forward

I will take another look at animations and add some more NPC behaviours. I would like to be able to assign generic gathering tasks to NPCs, combined with a drop-off at a storage pad.

Thanks for reading and I hope I will soon be able to show more stuff again…

07 Aug

Week 18 Recap

Looking Back

My life just kind of imploded during the last two weeks. I had to take a few days off. Afterwards, I dug into a task which required my full attention, as a way of getting my mind off of any other issues…

So what did I work on, then? Merging coplanar triangles on terrain geometry.

Those of you who are familiar with 3D graphics will already know that all geometry in games is made from triangles of varying sizes and orientations (at least currently, there are approaches using mathematical boundary functions to define volumes of theoretically infinite precision). Triangles consist of three vertices, which hold some more information than just a three-dimensional position. One of the many bottlenecks in real-time graphical rendering is the amount of vertices which an application needs to display at any moment. Therefore, any approach which can reduce vertices at loading time will yield better performance at run time. It is best explained with an image:

Merging coplanar triangles

Before and after shot of terrain geometry

In the image above you will recognize the fine-grained mesh on the left from one of my earlier posts when I explained how the terrain is built using pre-defined building blocks. This mesh contains lots of triangles which lie on the same plane and whose vertices hold exactly the same information as their neighbors, save for their position. On the right, only the minimally necessary amount of vertices and triangles are retained. No geometry detail was lost, but it is no longer possible to smooth normals around >=90° angles as before. Normals are shared along much further distances and the visual effect is rather unpleasant if I were to smooth them out.

The experts among you will wonder how I solved the problem of UV coordinates, since terrain is usually textured using a texture atlas and UVs would just get mangled and invalid during vertex merges. I completely avoided the issue by ignoring UVs altogether. Instead, the terrain shader now uses full tri-planar mapping based on world coordinates, which is totally fine for static geometry like terrain. The texture atlas tile index is simply encoded into the vertex colors, which the shader can interpret and apply.

Looking Forward

Because I have not done a single thing I set out to do, please see the last post for my next tasks: http://incharge.ctool.ch/2016/07/22/week-16-recap/

Thanks for reading!