There's only need for one forum for now. Discuss development. No advertising or thinly veiled attempts at advertising. Create a single thread for your project and be prepared to show and tell.
The engineer soldiers will be able to build advanced buildings. They're equipped with shotguns that make them short range so they won't be very good in most combat situations. The supply cost on engineers will be high so that the player should strategically guard these units.
The soldiers will all use the same soldier model, but have different equipment for different stats and to tell types of soliders apart. Later I may also amend the textures to differentiate the soldier more.
The bunkers will serve the same purpose as the sandbag walls. They will do everything the sandbag walls can, but have more hit points and defense. These buildings will be considered advanced and can only be built by engineers making them mid to late game defenses.
In addition to the cursor changing for move and attack move commands, the cursor will now glow when it's hovering over a selectable unit or building.
Unit to Unit Collisions in Unity Software
To mimic Starcraft 2 unit collisions, I gave the units capsule colliders and rigid bodies. In the unit code, I would adjust the mass of the rigid body so that moving units have greater mass than standing units.
By adding physics to the units and allowing them to nudge one another, this created problems with group movement. In many cases, units would be nudged so far from their path that a block would come between the unit and its next node causing the unit to get stuck. To solve this, the group movement was modified so that node offsets are much closer to the leaders nodes, box and sphere checks were used instead of raycasts to find blocks between nodes, and instead of simplifying the path, all the nodes are used to keep units on path.
The tower will be a mid to late game defense like bunkers, but they will lack in defense. The towers will instead give units a range bonus. I plan on towers having upgrades to their structure like steel, and concrete to boost their hit points and amount of garrisoned units. Also towers should have the ability to add a mounted machine gun just like bunkers and sandbag walls.
Simple RTS AI
To get enemy units moving, I created a simple enemy controller that acts like a player (aka artificial intelligence). The enemy controller will need to move groups of units all around the map, so a nested group class is needed to give commands to separate groups of units.
In order for the AI to tell these groups of units where to go, points of interest would need to be laid out on the map or defined in some way. Since this is a tower defense game, the enemies need to move towards the objects the player is defending. The enemy movement will use the same pathfinding as player units.
To add depth to how enemies move, the points of interest on the map are connected together in a waypoint system. This way, enemy units can have paths with multiple points of interest or paths that approach a point of interest from another direction (flank). The enemy controller will simply tell each group to move on to the next waypoint once the current waypoint is reached. If the current waypoint is a Landing Zone, then the group will wait until the landing zone is under enemy control before moving on.
Capturable Landing Zones
The landing zones will be a very important part of the game. Landing zones will be where the player gets supplies and calls in more units. The landing zones won't be able to be built by the player nor will enemies be able to destroy them; Instead, they'll be control points. A landing zone can be under player or enemy control, or be neutral.
Control works like most control points in RTS games: Units must be present at the control point to capture it. A landing zone with both enemy and player units on it will be contested and there will be no transfer of control. If units are moved away before the transfer of control is complete, control will return to the current team or fall back to neutral.
In the case that an enemy gains control of a landing zone while a chinook is delivering, I am still contemplating what to do. If you have any ideas, let me know in the comments.
Using Unity Animation Events
Since the enemy robot's animation shows the unit firing twice, I decided to also use events for each fire animation that would call the enemy unit's fire method. This gave me a lot of wiggle room to make units shoot in different ways and also made it very simple to calculate unit DPS (Damage Per Second). So, I decided to make player units follow this structure as well.
Calculating DPS using Unity animations required grabbing the RuntimeAnimatorController of the units Animator. With the RuntimeAnimatorController, I can find the fire animation by name and then simply use the animation length and number of events in the animation.
Unity animation event functions don't support methods that have multiple parameters, so, to get around this, I made a method with a string parameter and pass multiple parameters separated by a comma in a large string. With this trick, I can use animation events to spawn diverse enemy groups at any start point in the level. Doing it this way will make it easier to build levels by using the animations like event timelines and using the extra functionality that comes with animations.
Starting To Feel Like A Game
Now that enemy units can deal damage to player units and buildings, and can move towards points of interest; Play testing is now starting to feel like playing a game. I'm starting to balance stats and list of functionality to implement is dwindling. The game is approaching an alpha stage and by my estimate I believe there will be an alpha version of the game within the next 2 months.
It looks interesting but still damp, a couple of hands and a little bit more budget. It would be candy.
I agree. I plan on getting funding and hiring artists.
Outline Objects in Unity Engine
I found a really simple tutorial that outlines game objects on specific layers by Will Weissman that can be found here. But I didn't use this method to outline my RTS units because it very basic and there is no way of knowing if an object is obscured. Will Weissman's method would be for simple point and click or FPS game objects.
I needed an outline method that would only show outlines when the unit is obscured by other objects. I managed to find a free package in the Unity Asset store. Quick Outline has 5 different outline modes and one of them was exactly what I needed. You can find the Quick Outline asset here.
I tried to make something like Starcraft 2 end prompt. For now, the menu will have three options: main menu, retry, and quit; regardless of the game end condition. For a defeat, the camera will focus on the primary building to defend so the player can watch it collapse as the end game prompt transitions into view.
Command Menu Info Boxes
When the players cursor hovers over a command menu button, an info box for that button will show. The info boxes will show the command name, command type, cost, etc. The info boxes will be using a color code and have a standard order to make them legible at a glance. Later I will have info boxes change color and info dynamically to show unmet requirements for a command such as insufficient supplies.
Same as when a building is under construction, building destruction will change meshes to show damage and have 2 phases. In blender, I use the knife tool to cut holes in a copy of the building and fill them so that they crater. The new model will use the same material, I simply take the newly made faces and remap their UV coordinates to an area that makes sense. Alternatively you could also find a blank area on the UV map and paint a specific destruction texture.
When it came to destroying buildings, I thought of how Company of Heroes buildings would collapse into rubble. I chose this concept over Starcraft's approach to just blowing them up because I'm going for some realism. The building collapse needs 2 pieces: An animated building falling and a particle system for dust. Once the building reaches zero hit points it will spawn the building collapse and rubble. The dust particles will obscure the building so that it gives the illusion the building is collapsing into rubble.
Making Textures for Buildings
I found that pattern textures such as brick, sheet metal, and other sidings don't work well with the seamless texture tool I found, but it works great with dirt, grass, mulch, etc. You can find the seamless texture tool here.
Surprisingly, making brick and other sidings for buildings can be done with simple free tools. All that's needed to make them look good is a height map. To help with height maps, I use Project Dogwaffle version 1.2, a freeware version of Project Dogwaffle. You can find Project Dogwaffle here. It has a lot of great features, but is really old.
Another awesome tool that helps me with digital art is Artweaver. Artweaver is free to use and has a lot of awesome features like layers and editing photoshop files. you can find Artweaver here.
Additional Unit Behavior
Units needed a way to automatically attack their attackers if idle and alert nearby friendly units if they're idle also. I'm referring to the same behavior as in Starcraft 2; those units would run towards their attacker automatically. This would make management easier for the player and the units would behave as if they had a brain. Although there may be scenarios where the player may not want this behavior, so, in the future I plan to make a hold position command.
Tweaks and Polish
- Unit fire animations no longer use lights and the muzzle flash graphics were enlarged.
- All units garrisoned in a building now have the same origin for detected enemies in range.
- Changed the texture color of the engineer to make the unit more distinguishable to the player.
- Chinook rotor blades now have motion blur.
To complete the units, I added a way to instantiate game objects that would represent their death. Each death object was given a transform from some part of the unit instantiating it. Doing it this way would allow me to make many different ways a unit could die to accommodate all types from mechanical to biological units. For soldiers, they would instantiate an object that would play a death animation and instantiate a weapon that would use physics gravity.
For robots, they instantiate body parts that use physics and instantiate an explosion that gives the body parts an explosive force.
Custom Terrain Shader
I don't know how to program a shader, but thankfully Unity has a package to make shaders in a GUI environment called Shader Graph. To start off, I needed to recreate a standard terrain shader in shader graph. I managed to find a tutorial on how to do this in shader graph by
Léo Chaumartin here.
Once I had a complete terrain shader, I could add and edit it to stop textures from repeating. First, I added a procedural noise to blend with the final result of the textures. This would give the overall terrain light and dark areas.
To get the textures to stop repeating, I needed to rotate the UVs of each individual tile somehow. I managed to find a shader graph tutorial by Ben Cloward called infinite hex tiling. I followed all the instructions of his tutorial and I was left with a bunch of sub graphs that I used to replace the UV and sampling nodes in the terrain graph.
There are many water shader tutorials out there, I decided to go with PolyToots tutorial that can be found here. To make my own normal map asset for the water, I used the freeware version of Project Dogwaffle. In Project Dogwaffle, I rendered a black and white plasma noise, then to make the tiling seamless, I ran the texture through a seamless texture tool, and finally, I imported the texture into Unity and converted it to a normal map through gray scale.