informa
3 min read
article

3D Modeling & Programming RTS Units: Deterrence - Video Devlog 4

The 4th weekly video devlog for Deterrence. In this log, I use blender to model assets for the game and add unit selecting and unit move command.

Title_(1).png

A tower defense mixed with real-time strategy where you repel attacking sentient AI robots until they give up.


 

Modeling the CH-47

The most important part to modeling the chinook was reference images. Without them, the model would be have incorrect proportions and I wouldn't have gotten very far.

devlog4figure1.jpg

To texture the chinook, I tried the high resolution model method since I didn't have an actual chinook to capture pictures of. The high resolution model method will have all the finer details of the model created with geometry, then I would render an image of that model to paint on the lower resolution game ready model.

devlog4figure2.jpg

Making the propeller blades a separate object was important for the spinning effect I would add later in Unity.

devlog4figure3.jpg

To finish up the chinook, I took the color texture and began to change the RGBA channels for metal, smoothness, and a gray scaled normal map to be interpreted by Unity.

devlog4figure4.jpg

Modeling the Soldier

This was my first character model ever, I learned quite a bit and actually impressed myself with this one. I thought texturing the soldier would be incredibly difficult, but the method I used was simple and powerful. I would create the shapes I wanted to paint on the model with an image editor. I used those images to paint the color and height textures. They turned out pretty good in Unity.

devlog4figure5.jpg

As this was my first rig in my life and in Blender, I had to a bit of trouble getting the bones to work. If your character is built with one half and mirrored, then you should know that the bones on each side should have the same name (case sensitive) and end with .L or .R for their side. Also, it's a good idea to add a few more loop cuts to your limbs to prevent them from folding completely flat.

devlog4figure6.jpg

Unit Select Ring

The unit select ring is bascially a projector. If you've ever tried this, you'd know that Unity has a standard asset package that comes with projector shaders, and you'd know that those shaders aren't for opaque images. In order to get the projector opaque, I took the light projector shader and changed the blend to "SrcAlpha OneMinusSrcAlpha" and commented out all the fog related code. The trick to using this shader is to know that opaque black is transparency and all color data to be drawn is completely transparent.

devlog4figure7.jpg

RTS Drag Select

You're probably thinking drag selection is as simple as just testing if the unit is between the Xs and Ys of the rectangle, which would work if the rectangle is not on an angle. In this game, the camera can rotate 360 degrees and tilt 180 degrees making the drag select programming a real drag. With the help of an online search I was able to get it working with a very awesome math technique you can find here.

devlog4figure8.jpg

It works like this: you find the area of the rectangle using an uncommon formula that works for any rectangle at any angle.
Rectangle Area = 0.5 * Abs|(yA−yC)⋅(xD−xB)+(yB−yD)⋅(xA−xC)|

devlog4figure9.png

Next you use the unit coordinate to make four triangles with the rectangle. If the sum of all the triangle areas are equal to the the rectangle area, then the unit is inside the rectangle.
Triangle Area = 0.5 * Abs|(x1(y2−y3)+x2(y3−y1)+x3(y1−y2))|

devlog4figure10.png

If the unit was outside the rectangle, then the sum of all the triangle areas would be greater than the area of the rectangle.

devlog4figure11.png


Latest Jobs

Illfonic

Lakewood, Colorado
05.04.22
Release Manager

PLAYERUNKNOWN Productions

Remote OR Amsterdam, Netherlands
05.05.22
Network Programmer

McKinney, Texas
05.06.22
Associate Game Producer

Remedy Entertainment

Helsinki Metropolitan Area, Finland
05.09.22
Rigging Artist
More Jobs   

CONNECT WITH US

Register for a
Subscribe to
Follow us

Game Developer Account

Game Developer Newsletter

@gamedevdotcom

Register for a

Game Developer Account

Gain full access to resources (events, white paper, webinars, reports, etc)
Single sign-on to all Informa products

Register
Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Subscribe
Follow us

@gamedevdotcom

Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more