Sunday, October 14, 2012

Character TD Reel {

Finally, I have finished my Character TD reel! What do you guys think?

Note: I suggest you watch it in HD (720) because pixels.



-K

Sunday, October 7, 2012

Unity RTS Grid (1.1) {

I've made some improvements to my Unity RTS Grid System. For starters, no more brick boxes and spheres! Here's a list of the significant changes since the last post.

Change Log (1.1):
  • Integrated Unity Navigation for unit pathing
  • Modified Grid System to be independent of models/shaders
  • Added fast rectangle marquee selection system (No Ray-tracing)
  • Added temporary artwork (So my eyes stop bleeding)
  • Created R-Tree system (WIP)
And here's a video demonstrating the selection system and Navigation integration:


A note on the Navigation. The building is also a NavMesh, since they will be dynamically added. Currently NavMeshes apparently can push each other around. This is a bug I am going to fix, not a strange design choice.

Selection {

The most accurate way to select an object is to trace rays from the camera's mouse position, into world-space and check for collisions with objects. For rectangular selection, the amount of rays needed increase dramatically. Since I want this system to be able to run on mobile platforms, I needed a faster method.

First thing that came to mind is unprojecting the unit's position from world-space to screen-space. Then simply checking whether the new point was within my rectangle would determine if it is selected. This only works for the single point of the unit's pivot, meaning my rectangle could intersect with most of the model without selecting it. So I simply added a radius and made it a circle. The circle is then tested for intersection with the selection rectangle and more accurate, if still approximate, selection is determined.

There are a few shortcomings with my system, however. Firstly, circles by no means accurately express all models' shapes. Also, my method [currently] doesn't take into account perspective. That is, the circles don't scale with distance from the camera. I have a solution to this but I am unsure if it is necessary or fast enough to be worth it, since my RTS camera may not create much perspective anyways. I'll just save that for another update.

}

R-Tree {

And for those interested in some technical background, here's a video demonstrating the current progress of my R-Tree spacial data structure.


This will be used to sub-group units and items into proximity based bounding rectangles (R for Rectangle). The R-Tree will allow for fast look-up of units based on position. So, for instance, when calculating precise line-of-sight, I only want to check units close to a given unit for efficiency. This allows me to quickly obtain these units.

I am not quite happy with the amount of overlap in the tree at the moment, so I will be working to minimize overlap and area of rectangle groups when I integrate it into the Grid system.

}

I'd be happy to go into more depth in any of the techniques mentioned or unmentioned, so feel free to post a question in the comments below!

-K